Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
c8c4dc19
Commit
c8c4dc19
authored
Nov 15, 2019
by
Kristianto
Browse files
#142
- Front-end Test Fixing
parent
bc54b300
Changes
2
Hide whitespace changes
Inline
Side-by-side
assets/js/__test__/ProfilePage-test.jsx
View file @
c8c4dc19
...
...
@@ -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', () => {
});
});
assets/js/__test__/components/CompanyVacancy-test.js
→
assets/js/__test__/components/CompanyVacancy-test.js
x
View file @
c8c4dc19
File moved
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment