diff --git a/assets/js/CompanyProfile.jsx b/assets/js/CompanyProfile.jsx index f76eb7e498848141c626b6658406020d8fb6a9eb..1216c76757d13c5aa3f7672e164f7a89657bfbc3 100755 --- a/assets/js/CompanyProfile.jsx +++ b/assets/js/CompanyProfile.jsx @@ -40,18 +40,28 @@ export default class CompanyProfile extends React.Component { this.getProfile = this.getProfile.bind(this); this.handleChange = this.handleChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); + Server.get( `/companies/${this.props.user.data.company.id}/vacancies/`, false, ).then((result) => { this.setState({ vacancies: result.results }); - }); + }, + (error) => error.then(() => { + console.log(error); + }), + ); + Server.get( `/companies/${this.props.user.data.company.id}/applications/`, false, ).then((result) => { this.setState({ applications: result.results }); - }); + }, + (error) => error.then(() => { + console.log(error); + }), + ); } getProfile() { @@ -72,6 +82,7 @@ export default class CompanyProfile extends React.Component { }, (error) => error.then(() => { this.state.name = 'Gagal mendapatkan informasi'; + console.log(error); }), ); } diff --git a/assets/js/__test__/CompanyProfile-test.jsx b/assets/js/__test__/CompanyProfile-test.jsx index 453253e7ce1d977f02f416f6a7389f1b1d88129c..7dbc604e3493280182948f18e423aacde6545d31 100755 --- a/assets/js/__test__/CompanyProfile-test.jsx +++ b/assets/js/__test__/CompanyProfile-test.jsx @@ -29,15 +29,14 @@ describe('CompanyProfile', () => { route={{ own: true, data: companySession }} user={{ data: companySession }} params={{}} />) - profile.getProfile().then(() => { - expect(profile.state.id).to.equal(companySession.company.id); - }); + expect(profile.state.id).to.equal(companySession.company.id); + }); - it('handle submit without problem', () => { + it('handle submit with problem', () => { const profile = ReactTestUtils.renderIntoDocument( <CompanyProfile - route={{ own: false, data: companySession }} + route={{ own: true, data: companySession }} user={{ data: companySession }} params={{}} />); profile.state.form = {name:'Restopedia', address:'Bulan', description:'Martabak Tilaar', @@ -48,12 +47,15 @@ describe('CompanyProfile', () => { const form = ReactTestUtils.findRenderedDOMComponentWithTag(profile, 'Form'); ReactTestUtils.Simulate.submit(form); + + // There's an error, so it remains unchanged + expect(profile.state.name).to.not.equal('Restopedia'); }); it('handle change without problem', () => { const profile = ReactTestUtils.renderIntoDocument( <CompanyProfile - route={{ own: false, data: companySession }} + route={{ own: true, data: companySession }} user={{ data: companySession }} params={{}} />);