1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/webui/components/PackageSidebar/lastsync.spec.js

35 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-12-20 05:10:53 +01:00
/**
* LastSync component
*/
import React from 'react';
import { mount, shallow } from 'enzyme';
import LastSync from '../../../../src/webui/src/components/PackageSidebar/modules/LastSync';
import { packageMeta } from '../store/packageMeta';
jest.mock(
'../../../../src/webui/utils/datetime',
() => require('../__mocks__/datetime').default
);
console.error = jest.fn();
describe.skip('<PackageSidebar /> : <LastSync />', () => {
2017-12-20 05:10:53 +01:00
it('should load the component and check getters: lastUpdate, recentReleases with package data', () => {
const wrapper = mount(<LastSync packageMeta={packageMeta} />);
const instance = wrapper.instance();
const result = [
{ time: 'Dec 14, 2017, 3:43 PM', version: '2.7.1' },
{ time: 'Dec 5, 2017, 11:25 PM', version: '2.7.0' },
{ time: 'Nov 8, 2017, 10:47 PM', version: '2.6.6' }
];
expect(instance.lastUpdate).toEqual('Dec 14, 2017, 3:43 PM');
expect(instance.recentReleases).toEqual(result);
});
it('should load the LastSync component and match snapshot', () => {
const wrapper = shallow(<LastSync packageMeta={packageMeta} />);
expect(wrapper.html()).toMatchSnapshot();
});
});