Fakultas Ilmu Komputer UI

Commit 1add5bc7 authored by Kristianto's avatar Kristianto
Browse files

Merge branch '1606889856-142' into 'master'

#142 - Front-end Test Fixing

See merge request !168
parents bc54b300 c8c4dc19
Pipeline #25199 passed with stages
in 14 minutes and 45 seconds
......@@ -5,6 +5,40 @@ import fetchMock from 'fetch-mock';
import ProfilePage from '../ProfilePage';
import { studentSession, companyUser, response, response2 } from '../object/Response';
const studentUserVerified = {
role: 'student',
data: {
url: 'http://localhost:8000/api/users/9/',
username: 'muhammad.reza42',
email: 'muhammad.reza42@ui.ac.id',
is_staff: false,
company: null,
supervisor: null,
student: {
id: 3,
user: {
url: 'http://localhost:8000/api/users/9/',
username: 'muhammad.reza42',
email: 'muhammad.reza42@ui.ac.id',
is_staff: false,
},
name: 'Muhammad R.',
created: '2017-03-28T13:33:46.147241Z',
updated: '2017-03-28T13:33:46.148248Z',
npm: 1406543593,
resume: null,
phone_number: null,
bookmarked_vacancies: [
3,
],
applied_vacancies: [
3,
1,
],
},
},
};
describe('ProfilePage', () => {
it('renders without problem', () => {
fetchMock.get('*', response);
......@@ -32,6 +66,21 @@ describe('ProfilePage', () => {
fetchMock.restore();
});
it('get student profile without problem', () => {
fetchMock.get('*', response);
const profile = ReactTestUtils.renderIntoDocument(
<ProfilePage route={{ own: true, data: studentSession }} user={{ data: studentSession }} params={{}} />);
profile.getProfile().then(()=> {
expect(profile.state.name).to.equal(studentUserVerified.data.student.name);
expect(profile.state.npm).to.equal(studentUserVerified.data.student.npm);
expect(profile.state.birth_date).to.equal(studentUserVerified.data.student.birth_date);
expect(profile.state.major).to.equal(studentUserVerified.data.student.major);
expect(profile.state.batch).to.equal(studentUserVerified.data.student.batch);
expect(profile.state.bookmarked_vacancies).to.equal(studentUserVerified.data.student.bookmarked_vacancies);
expect(profile.state.applied_vacancies).to.equal(studentUserVerified.data.student.applied_vacancies);
});
})
it('renders edit profile default value', () => {
fetchMock.get('*', response);
const profile = ReactTestUtils.renderIntoDocument(
......@@ -72,3 +121,4 @@ describe('ProfilePage', () => {
});
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment