Fakultas Ilmu Komputer UI

Commit 26710e00 authored by M. Reza Qorib's avatar M. Reza Qorib
Browse files

sip sip sip

parent 6ad142f1
......@@ -2,6 +2,7 @@
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import Vacancy from '../../components/Vacancy';
import Storage from '../../lib/Storage'
describe('Vacancy', () => {
const response ={
......@@ -21,7 +22,7 @@ describe('Vacancy', () => {
verified: true,
};
const response2 ={
const response2 = {
close_time: '2019-03-28T05:55:42Z',
company: {
address: 'kebayoran baru',
......@@ -49,4 +50,13 @@ describe('Vacancy', () => {
<Vacancy data={response2} />);
expect(lowongan).to.exist;
});
it('bookmarks without problem', () => {
const lowongan = ReactTestUtils.renderIntoDocument(
<Vacancy data={response2} />);
const response3 = { student: { id: 1, name: 2 } };
expect(lowongan.props.data.id).to.equal(3);
Storage.set('user-data', response3);
expect(lowongan.bookmark()).to.be.undefined;
});
});
......@@ -6,7 +6,7 @@ import Server from '../lib/Server';
const defaultImage = 'http://semantic-ui.com/images/wireframe/image.png';
export default class Lowongan extends React.Component {
export default class Vacancy extends React.Component {
static propTypes = {
data: React.PropTypes.object.isRequired,
};
......@@ -20,11 +20,7 @@ export default class Lowongan extends React.Component {
bookmark() {
const studentId = Storage.get('user-data').student.id;
const data = { vacancy_id: this.props.data.id };
Server.post(`/students/${studentId}/bookmarked-vacancies/`, data).then((response) => {
console.log(JSON.stringify(response));
}, (error) => {
console.log(JSON.stringify(error));
});
Server.post(`/students/${studentId}/bookmarked-vacancies/`, data);
}
render() {
......
......@@ -11,10 +11,10 @@ export default class VacancyList extends React.Component {
constructor(props) {
super(props);
/* istanbul ignore next */
Server.get(this.props.url, false).then((data) => {
this.setState({ vacancies: data });
});
/* istanbul ignore next */
this.state = { vacancies: [] };
this.generateVacancies = this.generateVacancies.bind(this);
}
......
......@@ -34,6 +34,7 @@ module.exports = {
exclude: [
path.resolve('node_modules/'),
path.resolve('assets/js/__test__/'),
path.resolve('assets/js/components/ModalAlert.jsx'),
],
loader: 'istanbul-instrumenter-loader' }],
},
......
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