forked from sombochea/verdaccio-ui
feat: update material-ui@4.x (#123)
* chore: update material-ui@4.x * test: update test for ActionBar and TestField * chore: add types * chore: update types * test: update test for Author * chore: fixed bunch of unit test * chore: remove unused import * chore: remove comments * chore: replace shallow my mount * chore: update git hooks * chore: fix styles * chore: update dependencies * chore: remove types material-ui
This commit is contained in:
committed by
GitHub
parent
376b84f8c9
commit
67d7188cf5
@@ -1,5 +1,37 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import Versions from './Versions';
|
||||
|
||||
const mockPackageMeta = jest.fn(() => ({
|
||||
latest: {
|
||||
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.mock('../../pages/Version', () => ({
|
||||
DetailContextConsumer: component => {
|
||||
return component.children({ packageMeta: mockPackageMeta() });
|
||||
},
|
||||
}));
|
||||
|
||||
describe('<Version /> component', () => {
|
||||
beforeEach(() => {
|
||||
@@ -7,36 +39,7 @@ describe('<Version /> component', () => {
|
||||
});
|
||||
|
||||
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 />);
|
||||
const wrapper = mount(<Versions />);
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user