mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
improved spec for refetch after filter updates
This commit is contained in:
parent
0a13a78172
commit
cfac7a81d6
@ -92,14 +92,14 @@ const defaultData = () => {
|
|||||||
|
|
||||||
describe('CreationConfirm', () => {
|
describe('CreationConfirm', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
const adminListAllContributionsMock = jest.fn()
|
||||||
const adminDeleteContributionMock = jest.fn()
|
const adminDeleteContributionMock = jest.fn()
|
||||||
const adminDenyContributionMock = jest.fn()
|
const adminDenyContributionMock = jest.fn()
|
||||||
const confirmContributionMock = jest.fn()
|
const confirmContributionMock = jest.fn()
|
||||||
|
|
||||||
mockClient.setRequestHandler(
|
mockClient.setRequestHandler(
|
||||||
adminListAllContributions,
|
adminListAllContributions,
|
||||||
jest
|
adminListAllContributionsMock
|
||||||
.fn()
|
|
||||||
.mockRejectedValueOnce({ message: 'Ouch!' })
|
.mockRejectedValueOnce({ message: 'Ouch!' })
|
||||||
.mockResolvedValue({ data: defaultData() }),
|
.mockResolvedValue({ data: defaultData() }),
|
||||||
)
|
)
|
||||||
@ -331,97 +331,79 @@ describe('CreationConfirm', () => {
|
|||||||
|
|
||||||
describe('filter tabs', () => {
|
describe('filter tabs', () => {
|
||||||
describe('click tab "confirmed"', () => {
|
describe('click tab "confirmed"', () => {
|
||||||
let requestIdCounter
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
requestIdCounter = wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId
|
jest.clearAllMocks()
|
||||||
await wrapper.find('a[data-test="confirmed"]').trigger('click')
|
await wrapper.find('a[data-test="confirmed"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('refetches contributions', () => {
|
it('refetches contributions with proper filter', () => {
|
||||||
expect(wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId).toBe(
|
expect(adminListAllContributionsMock).toBeCalledWith({
|
||||||
`${Number(requestIdCounter) + 1}`,
|
currentPage: 1,
|
||||||
)
|
order: 'DESC',
|
||||||
})
|
pageSize: 25,
|
||||||
|
statusFilter: ['CONFIRMED'],
|
||||||
it('has statusFilter set to ["CONFIRMED"]', () => {
|
})
|
||||||
expect(
|
|
||||||
wrapper.vm.$apollo.queries.ListAllContributions.observer.options.variables,
|
|
||||||
).toMatchObject({ statusFilter: ['CONFIRMED'] })
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('click tab "open"', () => {
|
describe('click tab "open"', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
requestIdCounter = wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId
|
jest.clearAllMocks()
|
||||||
await wrapper.find('a[data-test="open"]').trigger('click')
|
await wrapper.find('a[data-test="open"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('refetches contributions', () => {
|
it('refetches contributions with proper filter', () => {
|
||||||
expect(wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId).toBe(
|
expect(adminListAllContributionsMock).toBeCalledWith({
|
||||||
`${Number(requestIdCounter) + 1}`,
|
currentPage: 1,
|
||||||
)
|
order: 'DESC',
|
||||||
})
|
pageSize: 25,
|
||||||
|
statusFilter: ['IN_PROGRESS', 'PENDING'],
|
||||||
it('has statusFilter set to ["IN_PROGRESS", "PENDING"]', () => {
|
})
|
||||||
expect(
|
|
||||||
wrapper.vm.$apollo.queries.ListAllContributions.observer.options.variables,
|
|
||||||
).toMatchObject({ statusFilter: ['IN_PROGRESS', 'PENDING'] })
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('click tab "denied"', () => {
|
describe('click tab "denied"', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
requestIdCounter = wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId
|
jest.clearAllMocks()
|
||||||
await wrapper.find('a[data-test="denied"]').trigger('click')
|
await wrapper.find('a[data-test="denied"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('refetches contributions', () => {
|
it('refetches contributions with proper filter', () => {
|
||||||
expect(wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId).toBe(
|
expect(adminListAllContributionsMock).toBeCalledWith({
|
||||||
`${Number(requestIdCounter) + 1}`,
|
currentPage: 1,
|
||||||
)
|
order: 'DESC',
|
||||||
})
|
pageSize: 25,
|
||||||
|
statusFilter: ['DENIED'],
|
||||||
it('has statusFilter set to ["DENIED"]', () => {
|
})
|
||||||
expect(
|
|
||||||
wrapper.vm.$apollo.queries.ListAllContributions.observer.options.variables,
|
|
||||||
).toMatchObject({ statusFilter: ['DENIED'] })
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('click tab "deleted"', () => {
|
describe('click tab "deleted"', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
requestIdCounter = wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId
|
jest.clearAllMocks()
|
||||||
await wrapper.find('a[data-test="deleted"]').trigger('click')
|
await wrapper.find('a[data-test="deleted"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('refetches contributions', () => {
|
it('refetches contributions with proper filter', () => {
|
||||||
expect(wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId).toBe(
|
expect(adminListAllContributionsMock).toBeCalledWith({
|
||||||
`${Number(requestIdCounter) + 1}`,
|
currentPage: 1,
|
||||||
)
|
order: 'DESC',
|
||||||
})
|
pageSize: 25,
|
||||||
|
statusFilter: ['DELETED'],
|
||||||
it('has statusFilter set to ["DELETED"]', () => {
|
})
|
||||||
expect(
|
|
||||||
wrapper.vm.$apollo.queries.ListAllContributions.observer.options.variables,
|
|
||||||
).toMatchObject({ statusFilter: ['DELETED'] })
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('click tab "all"', () => {
|
describe('click tab "all"', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
requestIdCounter = wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId
|
jest.clearAllMocks()
|
||||||
await wrapper.find('a[data-test="all"]').trigger('click')
|
await wrapper.find('a[data-test="all"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('refetches contributions', () => {
|
it('refetches contributions with proper filter', () => {
|
||||||
expect(wrapper.vm.$apollo.queries.ListAllContributions.observer.queryId).toBe(
|
expect(adminListAllContributionsMock).toBeCalledWith({
|
||||||
`${Number(requestIdCounter) + 1}`,
|
currentPage: 1,
|
||||||
)
|
order: 'DESC',
|
||||||
})
|
pageSize: 25,
|
||||||
it('has statusFilter set to ["IN_PROGRESS", "PENDING", "CONFIRMED", "DENIED", "DELETED"]', () => {
|
|
||||||
expect(
|
|
||||||
wrapper.vm.$apollo.queries.ListAllContributions.observer.options.variables,
|
|
||||||
).toMatchObject({
|
|
||||||
statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'],
|
statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user