mirror of
https://github.com/SomboChea/ui
synced 2024-05-18 09:21:37 +07:00
97e8448098
* chore: refactoring version page * refactor: migrate version page to hooks * refactor: Version page better imports * fix: #100 render not found on click item * test: add test for version page * chore: update mocks * test: add scenario for not found package * chore: fix wrong mock path * chore: update mock * chore: add todo list
43 lines
980 B
TypeScript
43 lines
980 B
TypeScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
|
|
describe('<Version /> component', () => {
|
|
beforeEach(() => {
|
|
jest.resetModules();
|
|
});
|
|
|
|
test('should render the component in default state', () => {
|
|
const packageMeta = {
|
|
versions: {
|
|
'1.0.0': {
|
|
version: '1.0.0',
|
|
},
|
|
'2.0.0': {
|
|
version: '2.0.0',
|
|
},
|
|
'3.0.0': {
|
|
version: '3.0.0',
|
|
},
|
|
},
|
|
time: {
|
|
'1.0.0': '2016-08-26T22:36:41.762Z',
|
|
'2.0.0': '2017-08-26T22:36:41.762Z',
|
|
'3.0.0': '2018-02-07T06:43:22.801Z',
|
|
},
|
|
'dist-tags': {
|
|
latest: '3.0.0',
|
|
},
|
|
};
|
|
|
|
jest.doMock('../../pages/Version', () => ({
|
|
DetailContextConsumer: component => {
|
|
return component.children({ packageMeta });
|
|
},
|
|
}));
|
|
|
|
const Version = require('./Versions').default;
|
|
const wrapper = shallow(<Version />);
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
});
|
|
});
|