debian-mirror-gitlab/spec/frontend/notes/components/note_signed_out_widget_spec.js
2020-04-22 19:07:51 +05:30

42 lines
1.1 KiB
JavaScript

import Vue from 'vue';
import noteSignedOut from '~/notes/components/note_signed_out_widget.vue';
import createStore from '~/notes/stores';
import { notesDataMock } from '../mock_data';
describe('note_signed_out_widget component', () => {
let store;
let vm;
beforeEach(() => {
const Component = Vue.extend(noteSignedOut);
store = createStore();
store.dispatch('setNotesData', notesDataMock);
vm = new Component({
store,
}).$mount();
});
afterEach(() => {
vm.$destroy();
});
it('should render sign in link provided in the store', () => {
expect(vm.$el.querySelector(`a[href="${notesDataMock.newSessionPath}"]`).textContent).toEqual(
'sign in',
);
});
it('should render register link provided in the store', () => {
expect(vm.$el.querySelector(`a[href="${notesDataMock.registerPath}"]`).textContent).toEqual(
'register',
);
});
it('should render information text', () => {
expect(vm.$el.textContent.replace(/\s+/g, ' ').trim()).toEqual(
'Please register or sign in to reply',
);
});
});