This repository has been archived by the owner on Jun 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test DependencyManagementPane component (#363)
* moved related components to DependencyManagementPane * added tests * fixed flow * added a constant instead of Date.now() * updated snapshot * removed white-spaces * removed verbose * fixed linting & mocked AlgoliaLogo * move related component files & moved tests to __tests__ folder * Add script for test:dev
- Loading branch information
Showing
41 changed files
with
1,043 additions
and
56 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
8 changes: 8 additions & 0 deletions
8
src/components/DependencyManagementPane/__mocks__/dependency.js
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,8 @@ | ||
// @flow | ||
export const mockReactHit = { | ||
name: 'React', | ||
version: '16.0.0', | ||
license: 'MIT', | ||
modified: 1549828927372, | ||
humanDownloadsLast30Days: 1000000, | ||
}; |
24 changes: 24 additions & 0 deletions
24
src/components/DependencyManagementPane/__tests__/AddDependencyInitialScreen.test.js
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,24 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
|
||
import AddDependencyInitialScreen, { | ||
InstructionsParagraph, | ||
PoweredByWrapper, | ||
} from '../AddDependencyInitialScreen'; | ||
|
||
jest.mock('../AlgoliaLogo', () => 'svg'); | ||
|
||
describe('AddDependencyInitialScreen component', () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
wrapper = mount(<AddDependencyInitialScreen />); | ||
}); | ||
|
||
it('should render instruction paragraphs', () => { | ||
expect(wrapper.find(InstructionsParagraph)).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render powered by Algolia link', () => { | ||
expect(wrapper.find(PoweredByWrapper)).toMatchSnapshot(); | ||
}); | ||
}); |
26 changes: 26 additions & 0 deletions
26
src/components/DependencyManagementPane/__tests__/AddDependencyModal.test.js
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,26 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { InfiniteHits } from 'react-instantsearch/dom'; | ||
|
||
import { AddDependencyModal } from '../AddDependencyModal'; | ||
import AddDependencyInitialScreen from '../AddDependencyInitialScreen'; | ||
|
||
describe('AddDependencyModal component', () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
wrapper = shallow(<AddDependencyModal isVisible={true} />); | ||
}); | ||
|
||
it('should render initial screen', () => { | ||
expect(wrapper.find(AddDependencyInitialScreen)).toHaveLength(1); | ||
}); | ||
|
||
it('should render hits', () => { | ||
wrapper.setProps({ | ||
searchResults: { | ||
query: 'React', | ||
}, | ||
}); | ||
expect(wrapper.find(InfiniteHits)).toHaveLength(1); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
src/components/DependencyManagementPane/__tests__/AddDependencySearchBox.test.js
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 { shallow } from 'enzyme'; | ||
|
||
import AddDependencySearchBox from '../AddDependencySearchBox'; | ||
|
||
describe('AddDependencySearchBox component', () => { | ||
const wrapper = shallow(<AddDependencySearchBox />); | ||
|
||
it('should render SearchBox', () => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
src/components/DependencyManagementPane/__tests__/AddDependencySearchProvider.test.js
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,16 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import AddDependencySearchProvider from '../AddDependencySearchProvider'; | ||
|
||
describe('AddDependencySearchProvider component', () => { | ||
const wrapper = shallow( | ||
<AddDependencySearchProvider> | ||
<div /> | ||
</AddDependencySearchProvider> | ||
); | ||
|
||
it('should render SearchBox', () => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.