2020-03-13 15:44:24 +05:30
|
|
|
import { shallowMount } from '@vue/test-utils';
|
|
|
|
import IdenticonComponent from '~/vue_shared/components/identicon.vue';
|
|
|
|
|
|
|
|
describe('Identicon', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const createComponent = () => {
|
|
|
|
wrapper = shallowMount(IdenticonComponent, {
|
|
|
|
propsData: {
|
|
|
|
entityId: 1,
|
|
|
|
entityName: 'entity-name',
|
|
|
|
sizeClass: 's40',
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
});
|
2020-03-13 15:44:24 +05:30
|
|
|
};
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
wrapper = null;
|
2017-09-10 17:25:29 +05:30
|
|
|
});
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
it('matches snapshot', () => {
|
|
|
|
createComponent();
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
expect(wrapper.element).toMatchSnapshot();
|
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
it('adds a correct class to identicon', () => {
|
|
|
|
createComponent();
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
expect(wrapper.find({ ref: 'identicon' }).classes()).toContain('bg2');
|
2017-09-10 17:25:29 +05:30
|
|
|
});
|
|
|
|
});
|