-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(requests-table):Implement requests table [Finishes #171380698]
- Loading branch information
1 parent
8c78fbd
commit 4a2c297
Showing
42 changed files
with
1,315 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
{ | ||
"presets": ["@babel/preset-env","@babel/preset-react"], | ||
"plugins": ["transform-class-properties"] | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-react" | ||
], | ||
"plugins": [ | ||
"transform-class-properties", | ||
"@babel/plugin-proposal-class-properties", | ||
"@babel/plugin-transform-regenerator", | ||
"@babel/plugin-transform-runtime" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: "2" | ||
checks: | ||
method-lines: | ||
config: | ||
threshold: 40 | ||
exclude_patterns: | ||
- "**/__tests__/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-disable no-undef */ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { cleanup } from '@testing-library/react'; | ||
import thunk from 'redux-thunk'; | ||
import { Provider } from 'react-redux'; | ||
import configureStore from 'redux-mock-store'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
import RequestsTablePage from '../views/RequestsTablePage/RequestsTablePage'; | ||
import requests from './data/data'; | ||
|
||
const mockStore = configureStore([]); | ||
const store = mockStore( | ||
{ | ||
loading: true, | ||
tripRequests: [], | ||
error: '', | ||
}, | ||
); | ||
store.dispatch = jest.fn(); | ||
|
||
const fetchTripRequests = jest.fn(); | ||
const props = { | ||
requests, | ||
fetchTripRequests, | ||
}; | ||
|
||
describe('<RequestsTablePage/>', () => { | ||
afterEach(cleanup); | ||
it('Should return true if the RequestsTablePage component exists', () => { | ||
const tree = mount( | ||
<Provider store={store}> | ||
<Router> | ||
<RequestsTablePage {...props} /> | ||
</Router> | ||
</Provider>, | ||
); | ||
expect(tree.find('Card').exists()).toBe(true); | ||
}); | ||
|
||
it('Should render props for the RequestsTablePage component', () => { | ||
const tree = mount( | ||
<Provider store={store}> | ||
<Router> | ||
<RequestsTablePage {...props} /> | ||
</Router> | ||
</Provider>, | ||
); | ||
expect(tree.find('StyledTableCell').exists()).toBe(true); | ||
}); | ||
|
||
it('Should match the RequestsTablePage snapshot', () => { | ||
const tree = mount( | ||
<Provider store={store}> | ||
<Router> | ||
<RequestsTablePage {...props} /> | ||
</Router> | ||
</Provider>, | ||
); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import { cleanup } from '@testing-library/react'; | ||
import SectionHeader from '../components/SectionHeader/SectionHeader'; | ||
|
||
describe('<SectionHeader/>', () => { | ||
afterEach(cleanup); | ||
it('Should match the SectionHeader component snapshot', () => { | ||
const tree = renderer.create(<SectionHeader />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<SectionHeader/> Should match the SectionHeader component snapshot 1`] = ` | ||
<p | ||
className="MuiTypography-root makeStyles-title-1 MuiTypography-body1" | ||
/> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const requests = { | ||
tripRequests: [ | ||
{ | ||
id: 1, | ||
trips: [ | ||
{ | ||
travelDate: '2020-09-15', | ||
travelFrom: 'Kigali', | ||
travelTo: 'Durban', | ||
}, | ||
], | ||
travelReason: 'Africa Tech Summit', | ||
accommodation: true, | ||
status: 'pending', | ||
}, | ||
{ | ||
id: 2, | ||
trips: [ | ||
{ | ||
travelDate: '2020-09-10', | ||
travelFrom: 'Kigali', | ||
travelTo: 'Dubai', | ||
}, | ||
], | ||
travelReason: 'Africa Tech Summit', | ||
accommodation: true, | ||
status: 'pending', | ||
}, | ||
], | ||
}; | ||
|
||
export default requests; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.