Fix broken tests

This commit is contained in:
mattwr18 2019-11-29 20:49:46 +01:00
parent c088c6eac4
commit 985d53e52b
6 changed files with 13 additions and 14 deletions

View File

@ -130,7 +130,7 @@ Given('somebody reported the following posts:', table => {
.authenticateAs(submitter)
.mutate(`mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) {
fileReport(resourceId: $resourceId, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription) {
type
id
}
}`, {
resourceId,

View File

@ -85,7 +85,7 @@ describe('ContentMenu.vue', () => {
.filter(item => item.text() === 'post.menu.delete')
.at(0)
.trigger('click')
expect(openModalSpy).toHaveBeenCalledWith('delete')
expect(openModalSpy).toHaveBeenCalledWith('confirm', 'delete')
})
})
@ -166,7 +166,7 @@ describe('ContentMenu.vue', () => {
.filter(item => item.text() === 'comment.menu.delete')
.at(0)
.trigger('click')
expect(openModalSpy).toHaveBeenCalledWith('delete')
expect(openModalSpy).toHaveBeenCalledWith('confirm', 'delete')
})
})
@ -332,7 +332,7 @@ describe('ContentMenu.vue', () => {
.filter(item => item.text() === 'release.contribution.title')
.at(0)
.trigger('click')
expect(openModalSpy).toHaveBeenCalledWith('release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8')
expect(openModalSpy).toHaveBeenCalledWith('release')
})
it('can release comments', () => {
@ -350,7 +350,7 @@ describe('ContentMenu.vue', () => {
.filter(item => item.text() === 'release.comment.title')
.at(0)
.trigger('click')
expect(openModalSpy).toHaveBeenCalledWith('release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8')
expect(openModalSpy).toHaveBeenCalledWith('release')
})
it('can release users', () => {
@ -368,7 +368,7 @@ describe('ContentMenu.vue', () => {
.filter(item => item.text() === 'release.user.title')
.at(0)
.trigger('click')
expect(openModalSpy).toHaveBeenCalledWith('release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8')
expect(openModalSpy).toHaveBeenCalledWith('release')
})
it('can release organizations', () => {
@ -386,7 +386,7 @@ describe('ContentMenu.vue', () => {
.filter(item => item.text() === 'release.organization.title')
.at(0)
.trigger('click')
expect(openModalSpy).toHaveBeenCalledWith('release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8')
expect(openModalSpy).toHaveBeenCalledWith('release')
})
})

View File

@ -64,9 +64,9 @@ describe('DropdownFilter.vue', () => {
expect(unreadLink.text()).toEqual('Unread')
})
it('clicking on menu item emits filterNotifications', () => {
it('clicking on menu item emits filter', () => {
allLink.trigger('click')
expect(wrapper.emitted().filterNotifications[0]).toEqual(
expect(wrapper.emitted().filter[0]).toEqual(
propsData.filterOptions.filter(option => option.label === 'All'),
)
})

View File

@ -20,10 +20,10 @@ storiesOf('DropdownFilter', module)
selected: filterOptions[0].label,
}),
methods: {
filterNotifications: action('filterNotifications'),
filter: action('filter'),
},
template: `<dropdown-filter
@filterNotifications="filterNotifications"
@filter="filter"
:filterOptions="filterOptions"
:selected="selected"
/>`,

View File

@ -64,7 +64,6 @@
params: params(report.resource),
hash: hashParam(report.resource),
}"
@click.native="markNotificationAsRead(report.resource.id)"
>
<b>{{ report.resource.title || report.resource.contentExcerpt | truncate(50) }}</b>
</nuxt-link>

View File

@ -71,7 +71,7 @@ describe('PostIndex', () => {
}
})
describe('filterNotifications', () => {
describe('filter', () => {
beforeEach(() => {
propsData.filterOptions = [
{ label: 'All', value: null },
@ -79,7 +79,7 @@ describe('PostIndex', () => {
{ label: 'Unread', value: false },
]
wrapper = Wrapper()
wrapper.find(DropdownFilter).vm.$emit('filterNotifications', propsData.filterOptions[1])
wrapper.find(DropdownFilter).vm.$emit('filter', propsData.filterOptions[1])
})
it('sets `notificationRead` to value of received option', () => {