diff --git a/components/Comment.spec.js b/components/Comment.spec.js index c0cb8ebfc..c10daca44 100644 --- a/components/Comment.spec.js +++ b/components/Comment.spec.js @@ -15,17 +15,24 @@ describe('Comment.vue', () => { let Wrapper let propsData let mocks + let getters beforeEach(() => { propsData = {} mocks = { $t: jest.fn(), } + getters = { + 'auth/isModerator': () => false + } }) describe('shallowMount', () => { const Wrapper = () => { - return shallowMount(Comment, { propsData, mocks, localVue }) + const store = new Vuex.Store({ + getters + }) + return shallowMount(Comment, { store, propsData, mocks, localVue }) } describe('given a comment', () => { @@ -56,6 +63,17 @@ describe('Comment.vue', () => { const expected = [['comment.content.disabled-placeholder']] expect(calls).toEqual(expect.arrayContaining(expected)) }) + + describe('for a moderator', () => { + beforeEach(() => { + getters['auth/isModerator'] = () => true + }) + + it('renders comment data', () => { + const wrapper = Wrapper() + expect(wrapper.text()).toMatch('comment content') + }) + }) }) }) }) diff --git a/components/Comment.vue b/components/Comment.vue index f24bad7d4..4a8d81ded 100644 --- a/components/Comment.vue +++ b/components/Comment.vue @@ -10,6 +10,8 @@