Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Migrate Enterprise Login * Fix types for enterprise login * Migrate comms test * Migrate component with test * Setup Circle CI * Fix circle config * Add webpack build config * Test Loading Component
- Loading branch information
Showing
20 changed files
with
1,854 additions
and
812 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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
node: | ||
docker: | ||
- image: circleci/node:10.17.0 | ||
|
||
commands: | ||
install-dependencies: | ||
description: 'Install Dependencies' | ||
steps: | ||
- run: | ||
name: Install Dependencies | ||
command: yarn install --frozen-lockfile | ||
|
||
restore-yarn: | ||
description: 'Restore Yarn Package Cache' | ||
steps: | ||
- restore_cache: | ||
key: yarn-packages-{{ checksum "yarn.lock" }} | ||
|
||
save-yarn: | ||
description: 'Save Yarn Package Cache' | ||
steps: | ||
- save_cache: | ||
key: yarn-packages-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ~/.cache/yarn | ||
|
||
jobs: | ||
setup: | ||
executor: node | ||
steps: | ||
- checkout | ||
- restore-yarn | ||
- install-dependencies | ||
- save-yarn | ||
- persist_to_workspace: | ||
root: ./ | ||
paths: | ||
- ./ | ||
|
||
run-unit-tests: | ||
executor: node | ||
steps: | ||
- attach_workspace: | ||
at: ./ | ||
- run: | ||
name: Run Prettier (Check) | ||
command: yarn prettier-check | ||
- run: | ||
name: Run Jest | ||
command: yarn test --coverage | ||
|
||
build-ts: | ||
executor: node | ||
steps: | ||
- attach_workspace: | ||
at: ./ | ||
- run: | ||
name: 'Build TS' | ||
command: yarn build | ||
|
||
workflows: | ||
version: 2.1 | ||
|
||
run-tests: | ||
jobs: | ||
- setup | ||
- run-unit-tests: | ||
requires: | ||
- setup | ||
- build-ts: | ||
requires: | ||
- setup |
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
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`components/oops.js should render itself & its children 1`] = ` | ||
<div | ||
className="container-fluid main-container notifications errored" | ||
> | ||
<h2> | ||
Oops something went wrong. | ||
</h2> | ||
<h4> | ||
Couldn't get your notifications. | ||
</h4> | ||
<h1 | ||
className="emoji" | ||
> | ||
😔 | ||
</h1> | ||
</div> | ||
`; | ||
|
||
exports[`components/oops.tsx should render itself & its children 1`] = ` | ||
<div | ||
className="container-fluid main-container notifications errored" | ||
> | ||
<h2> | ||
Oops something went wrong. | ||
</h2> | ||
<h4> | ||
Couldn't get your notifications. | ||
</h4> | ||
<h1 | ||
className="emoji" | ||
> | ||
😔 | ||
</h1> | ||
</div> | ||
`; |
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,60 @@ | ||
import * as React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { shallow, mount } from 'enzyme'; | ||
import { Map } from 'immutable'; | ||
import * as NProgress from 'nprogress'; | ||
|
||
import { Loading, mapStateToProps } from './loading'; | ||
|
||
jest.mock('nprogress', () => { | ||
return { | ||
configure: jest.fn(), | ||
start: jest.fn(), | ||
done: jest.fn(), | ||
remove: jest.fn(), | ||
}; | ||
}); | ||
|
||
describe('components/loading.js', function() { | ||
beforeEach(() => { | ||
NProgress.configure.mockReset(); | ||
NProgress.start.mockReset(); | ||
NProgress.done.mockReset(); | ||
NProgress.remove.mockReset(); | ||
}); | ||
|
||
it('should test the mapStateToProps method', () => { | ||
const state = { | ||
notifications: Map({ | ||
isFetching: false, | ||
}), | ||
}; | ||
|
||
const mappedProps = mapStateToProps(state); | ||
|
||
expect(mappedProps.isLoading).toBeFalsy(); | ||
}); | ||
|
||
it('should check that NProgress is getting called in getDerivedStateFromProps (loading)', function() { | ||
const { container } = render(<Loading isLoading={true} />); | ||
|
||
expect(container.innerHTML).toBe(''); | ||
expect(NProgress.configure).toHaveBeenCalledTimes(1); | ||
expect(NProgress.start).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('should check that NProgress is getting called in getDerivedStateFromProps (not loading)', function() { | ||
const { container } = render(<Loading isLoading={false} />); | ||
|
||
expect(container.innerHTML).toBe(''); | ||
expect(NProgress.configure).toHaveBeenCalledTimes(1); | ||
expect(NProgress.done).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('should remove NProgress on unmount', function() { | ||
const { unmount } = render(<Loading isLoading={false} />); | ||
expect(NProgress.remove).toHaveBeenCalledTimes(0); | ||
unmount(); | ||
expect(NProgress.remove).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
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.