Skip to content

Commit

Permalink
attempt to do intergration testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyubinhan committed Jun 26, 2018
1 parent 79abdbe commit 82f2781
Show file tree
Hide file tree
Showing 12 changed files with 3,000 additions and 2,929 deletions.
206 changes: 109 additions & 97 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions src/api/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// import { v4 } from 'node-uuid';
import { fakeAgreements, fakePlan } from '../tests/intergration/mockData';
import { mockAgreements, mockPlan } from '../tests/intergration/mockData';

const fakeDatabase = {
paginatedAgreements: fakeAgreements,
plan: fakePlan,
const mockDatabase = {
paginatedAgreements: mockAgreements,
plan: mockPlan,
};

const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
Expand All @@ -12,9 +12,9 @@ export const fetchAgreements = filter => (
delay(500).then(() => {
switch (filter) {
case 'all':
return fakeDatabase.paginatedAgreements;
return mockDatabase.paginatedAgreements;
// case 'complete':
// return fakeDatabase.paginatedAgreements.agreements.filter(t => !t.draft);
// return mockDatabase.paginatedAgreements.agreements.filter(t => !t.draft);
default:
throw new Error(`Unknown filter: ${filter}`);
}
Expand All @@ -23,7 +23,7 @@ export const fetchAgreements = filter => (

export const fetchPlan = () => (
delay(500).then(() => {
return fakeDatabase.plan;
return mockDatabase.plan;
})
);

Expand All @@ -34,13 +34,13 @@ export const fetchPlan = () => (
// text,
// completed: false,
// };
// fakeDatabase.todos.push(todo);
// mockDatabase.todos.push(todo);
// return todo;
// });

// export const toggleTodo = (id) =>
// delay(500).then(() => {
// const todo = fakeDatabase.todos.find(t => t.id === id);
// const todo = mockDatabase.todos.find(t => t.id === id);
// todo.completed = !todo.completed;
// return todo;
// });
19 changes: 17 additions & 2 deletions src/components/Home.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import React, { Component } from 'react';
// import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import Agreement from './agreement';
// import { getAgreements, getAgreementsPagination } from '../reducers/rootReducer';

/* eslint-disable react/prefer-stateless-function */
const propTypes = {
location: PropTypes.shape({ search: PropTypes.string }),
history: PropTypes.shape({}),
};
const defaultProps = {
location: {
search: '',
pathname: '/home',
},
history: {
push: () => {},
},
};
class Home extends Component {
componentDidMount() {

Expand All @@ -24,6 +38,7 @@ class Home extends Component {
// agreementsMap: getAlbums(state),
// };
// };

Home.propTypes = propTypes;
Home.defaultProps = defaultProps;
export default Home;
// export default connect(mapStateToProps, {})(Home);
// export default connect(null, {})(Home);
Loading

0 comments on commit 82f2781

Please sign in to comment.