gitlab-org--gitlab-foss/spec/frontend/vue_shared/components/identicon_spec.js

34 lines
714 B
JavaScript
Raw Normal View History

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-08-01 09:08:09 +00:00
});
};
2017-08-01 09:08:09 +00:00
afterEach(() => {
wrapper.destroy();
wrapper = null;
2017-08-01 09:08:09 +00:00
});
it('matches snapshot', () => {
createComponent();
expect(wrapper.element).toMatchSnapshot();
});
it('adds a correct class to identicon', () => {
createComponent();
expect(wrapper.find({ ref: 'identicon' }).classes()).toContain('bg2');
2017-08-01 09:08:09 +00:00
});
});