mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Deconstruct the listAllContributions test.
This commit is contained in:
parent
bcf63ec334
commit
96feb30476
@ -1075,8 +1075,7 @@ describe('ContributionResolver', () => {
|
|||||||
describe('listAllContribution', () => {
|
describe('listAllContribution', () => {
|
||||||
describe('unauthenticated', () => {
|
describe('unauthenticated', () => {
|
||||||
it('returns an error', async () => {
|
it('returns an error', async () => {
|
||||||
await expect(
|
const { errors: errorObjects }: { errors: [GraphQLError] } = await query({
|
||||||
query({
|
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1084,12 +1083,8 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: null,
|
statusFilter: null,
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(errorObjects).toMatchObject([new GraphQLError('401 Unauthorized')])
|
||||||
expect.objectContaining({
|
|
||||||
errors: [new GraphQLError('401 Unauthorized')],
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1106,8 +1101,7 @@ describe('ContributionResolver', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('throws an error with "NOT_VALID" in statusFilter', async () => {
|
it('throws an error with "NOT_VALID" in statusFilter', async () => {
|
||||||
await expect(
|
const { errors: errorObjects }: { errors: [GraphQLError | UserInputError] } = await query({
|
||||||
query({
|
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1115,21 +1109,16 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: ['NOT_VALID'],
|
statusFilter: ['NOT_VALID'],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(errorObjects).toMatchObject([
|
||||||
expect.objectContaining({
|
|
||||||
errors: [
|
|
||||||
new UserInputError(
|
new UserInputError(
|
||||||
'Variable "$statusFilter" got invalid value "NOT_VALID" at "statusFilter[0]"; Value "NOT_VALID" does not exist in "ContributionStatus" enum.',
|
'Variable "$statusFilter" got invalid value "NOT_VALID" at "statusFilter[0]"; Value "NOT_VALID" does not exist in "ContributionStatus" enum.',
|
||||||
),
|
),
|
||||||
],
|
])
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throws an error with a null in statusFilter', async () => {
|
it('throws an error with a null in statusFilter', async () => {
|
||||||
await expect(
|
const { errors: errorObjects }: { errors: [Error] } = await query({
|
||||||
query({
|
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1137,21 +1126,16 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: [null],
|
statusFilter: [null],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(errorObjects).toMatchObject([
|
||||||
expect.objectContaining({
|
|
||||||
errors: [
|
|
||||||
new UserInputError(
|
new UserInputError(
|
||||||
'Variable "$statusFilter" got invalid value null at "statusFilter[0]"; Expected non-nullable type "ContributionStatus!" not to be null.',
|
'Variable "$statusFilter" got invalid value null at "statusFilter[0]"; Expected non-nullable type "ContributionStatus!" not to be null.',
|
||||||
),
|
),
|
||||||
],
|
])
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('throws an error with null and "NOT_VALID" in statusFilter', async () => {
|
it('throws an error with null and "NOT_VALID" in statusFilter', async () => {
|
||||||
await expect(
|
const { errors: errorObjects }: { errors: [Error] } = await query({
|
||||||
query({
|
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1159,69 +1143,63 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: [null, 'NOT_VALID'],
|
statusFilter: [null, 'NOT_VALID'],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(errorObjects).toMatchObject([
|
||||||
expect.objectContaining({
|
|
||||||
errors: [
|
|
||||||
new UserInputError(
|
new UserInputError(
|
||||||
'Variable "$statusFilter" got invalid value null at "statusFilter[0]"; Expected non-nullable type "ContributionStatus!" not to be null.',
|
'Variable "$statusFilter" got invalid value null at "statusFilter[0]"; Expected non-nullable type "ContributionStatus!" not to be null.',
|
||||||
),
|
),
|
||||||
new UserInputError(
|
new UserInputError(
|
||||||
'Variable "$statusFilter" got invalid value "NOT_VALID" at "statusFilter[1]"; Value "NOT_VALID" does not exist in "ContributionStatus" enum.',
|
'Variable "$statusFilter" got invalid value "NOT_VALID" at "statusFilter[1]"; Value "NOT_VALID" does not exist in "ContributionStatus" enum.',
|
||||||
),
|
),
|
||||||
],
|
])
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns all contributions without statusFilter', async () => {
|
it('returns all contributions without statusFilter', async () => {
|
||||||
await expect(
|
const {
|
||||||
query({
|
data: { listAllContributions: contributionListObject },
|
||||||
|
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 25,
|
pageSize: 25,
|
||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(contributionListObject).toMatchObject({
|
||||||
expect.objectContaining({
|
|
||||||
data: {
|
|
||||||
listAllContributions: {
|
|
||||||
contributionCount: 7,
|
contributionCount: 7,
|
||||||
contributionList: expect.arrayContaining([
|
contributionList: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
amount: '100',
|
amount: '100',
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
id: expect.any(Number),
|
id: contributionToConfirm.data.createContribution.id,
|
||||||
memo: 'Test contribution to confirm',
|
memo: 'Test contribution to confirm',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: pendingContribution.data.createContribution.id,
|
||||||
state: 'PENDING',
|
state: 'PENDING',
|
||||||
memo: 'Test PENDING contribution update',
|
memo: 'Test PENDING contribution update',
|
||||||
amount: '10',
|
amount: '10',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDeny.data.createContribution.id,
|
||||||
state: 'DENIED',
|
state: 'DENIED',
|
||||||
memo: 'Test contribution to deny',
|
memo: 'Test contribution to deny',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDelete.data.createContribution.id,
|
||||||
state: 'DELETED',
|
state: 'DELETED',
|
||||||
memo: 'Test contribution to delete',
|
memo: 'Test contribution to delete',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: inProgressContribution.data.createContribution.id,
|
||||||
state: 'IN_PROGRESS',
|
state: 'IN_PROGRESS',
|
||||||
memo: 'Test IN_PROGRESS contribution',
|
memo: 'Test IN_PROGRESS contribution',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: bibiCreatedContribution.id,
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
memo: 'Herzlich Willkommen bei Gradido!',
|
memo: 'Herzlich Willkommen bei Gradido!',
|
||||||
amount: '1000',
|
amount: '1000',
|
||||||
@ -1239,15 +1217,13 @@ describe('ContributionResolver', () => {
|
|||||||
amount: '166',
|
amount: '166',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
},
|
})
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns all contributions for statusFilter = null', async () => {
|
it('returns all contributions for statusFilter = null', async () => {
|
||||||
await expect(
|
const {
|
||||||
query({
|
data: { listAllContributions: contributionListObject },
|
||||||
|
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1255,45 +1231,42 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: null,
|
statusFilter: null,
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(contributionListObject).toMatchObject({
|
||||||
expect.objectContaining({
|
|
||||||
data: {
|
|
||||||
listAllContributions: {
|
|
||||||
contributionCount: 7,
|
contributionCount: 7,
|
||||||
contributionList: expect.arrayContaining([
|
contributionList: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
amount: '100',
|
amount: '100',
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
id: expect.any(Number),
|
id: contributionToConfirm.data.createContribution.id,
|
||||||
memo: 'Test contribution to confirm',
|
memo: 'Test contribution to confirm',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: pendingContribution.data.createContribution.id,
|
||||||
state: 'PENDING',
|
state: 'PENDING',
|
||||||
memo: 'Test PENDING contribution update',
|
memo: 'Test PENDING contribution update',
|
||||||
amount: '10',
|
amount: '10',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDeny.data.createContribution.id,
|
||||||
state: 'DENIED',
|
state: 'DENIED',
|
||||||
memo: 'Test contribution to deny',
|
memo: 'Test contribution to deny',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDelete.data.createContribution.id,
|
||||||
state: 'DELETED',
|
state: 'DELETED',
|
||||||
memo: 'Test contribution to delete',
|
memo: 'Test contribution to delete',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: inProgressContribution.data.createContribution.id,
|
||||||
state: 'IN_PROGRESS',
|
state: 'IN_PROGRESS',
|
||||||
memo: 'Test IN_PROGRESS contribution',
|
memo: 'Test IN_PROGRESS contribution',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: bibiCreatedContribution.id,
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
memo: 'Herzlich Willkommen bei Gradido!',
|
memo: 'Herzlich Willkommen bei Gradido!',
|
||||||
amount: '1000',
|
amount: '1000',
|
||||||
@ -1311,15 +1284,13 @@ describe('ContributionResolver', () => {
|
|||||||
amount: '166',
|
amount: '166',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
},
|
})
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns all contributions for statusFilter = []', async () => {
|
it('returns all contributions for statusFilter = []', async () => {
|
||||||
await expect(
|
const {
|
||||||
query({
|
data: { listAllContributions: contributionListObject },
|
||||||
|
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1327,45 +1298,42 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: [],
|
statusFilter: [],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(contributionListObject).toMatchObject({
|
||||||
expect.objectContaining({
|
|
||||||
data: {
|
|
||||||
listAllContributions: {
|
|
||||||
contributionCount: 7,
|
contributionCount: 7,
|
||||||
contributionList: expect.arrayContaining([
|
contributionList: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
amount: '100',
|
amount: '100',
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
id: expect.any(Number),
|
id: contributionToConfirm.data.createContribution.id,
|
||||||
memo: 'Test contribution to confirm',
|
memo: 'Test contribution to confirm',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: pendingContribution.data.createContribution.id,
|
||||||
state: 'PENDING',
|
state: 'PENDING',
|
||||||
memo: 'Test PENDING contribution update',
|
memo: 'Test PENDING contribution update',
|
||||||
amount: '10',
|
amount: '10',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDeny.data.createContribution.id,
|
||||||
state: 'DENIED',
|
state: 'DENIED',
|
||||||
memo: 'Test contribution to deny',
|
memo: 'Test contribution to deny',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDelete.data.createContribution.id,
|
||||||
state: 'DELETED',
|
state: 'DELETED',
|
||||||
memo: 'Test contribution to delete',
|
memo: 'Test contribution to delete',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: inProgressContribution.data.createContribution.id,
|
||||||
state: 'IN_PROGRESS',
|
state: 'IN_PROGRESS',
|
||||||
memo: 'Test IN_PROGRESS contribution',
|
memo: 'Test IN_PROGRESS contribution',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: bibiCreatedContribution.id,
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
memo: 'Herzlich Willkommen bei Gradido!',
|
memo: 'Herzlich Willkommen bei Gradido!',
|
||||||
amount: '1000',
|
amount: '1000',
|
||||||
@ -1383,15 +1351,13 @@ describe('ContributionResolver', () => {
|
|||||||
amount: '166',
|
amount: '166',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
},
|
})
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns all CONFIRMED contributions', async () => {
|
it('returns all CONFIRMED contributions', async () => {
|
||||||
await expect(
|
const {
|
||||||
query({
|
data: { listAllContributions: contributionListObject },
|
||||||
|
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1399,45 +1365,42 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: ['CONFIRMED'],
|
statusFilter: ['CONFIRMED'],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(contributionListObject).toMatchObject({
|
||||||
expect.objectContaining({
|
|
||||||
data: {
|
|
||||||
listAllContributions: {
|
|
||||||
contributionCount: 3,
|
contributionCount: 3,
|
||||||
contributionList: expect.arrayContaining([
|
contributionList: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
amount: '100',
|
amount: '100',
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
id: expect.any(Number),
|
id: contributionToConfirm.data.createContribution.id,
|
||||||
memo: 'Test contribution to confirm',
|
memo: 'Test contribution to confirm',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: pendingContribution.data.createContribution.id,
|
||||||
state: 'PENDING',
|
state: 'PENDING',
|
||||||
memo: 'Test PENDING contribution update',
|
memo: 'Test PENDING contribution update',
|
||||||
amount: '10',
|
amount: '10',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDeny.data.createContribution.id,
|
||||||
state: 'DENIED',
|
state: 'DENIED',
|
||||||
memo: 'Test contribution to deny',
|
memo: 'Test contribution to deny',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDelete.data.createContribution.id,
|
||||||
state: 'DELETED',
|
state: 'DELETED',
|
||||||
memo: 'Test contribution to delete',
|
memo: 'Test contribution to delete',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: inProgressContribution.data.createContribution.id,
|
||||||
state: 'IN_PROGRESS',
|
state: 'IN_PROGRESS',
|
||||||
memo: 'Test IN_PROGRESS contribution',
|
memo: 'Test IN_PROGRESS contribution',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: bibiCreatedContribution.id,
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
memo: 'Herzlich Willkommen bei Gradido!',
|
memo: 'Herzlich Willkommen bei Gradido!',
|
||||||
amount: '1000',
|
amount: '1000',
|
||||||
@ -1455,15 +1418,13 @@ describe('ContributionResolver', () => {
|
|||||||
amount: '166',
|
amount: '166',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
},
|
})
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns all PENDING contributions', async () => {
|
it('returns all PENDING contributions', async () => {
|
||||||
await expect(
|
const {
|
||||||
query({
|
data: { listAllContributions: contributionListObject },
|
||||||
|
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1471,45 +1432,42 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: ['PENDING'],
|
statusFilter: ['PENDING'],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(contributionListObject).toMatchObject({
|
||||||
expect.objectContaining({
|
|
||||||
data: {
|
|
||||||
listAllContributions: {
|
|
||||||
contributionCount: 1,
|
contributionCount: 1,
|
||||||
contributionList: expect.arrayContaining([
|
contributionList: expect.arrayContaining([
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
amount: '100',
|
amount: '100',
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
id: expect.any(Number),
|
id: contributionToConfirm.data.createContribution.id,
|
||||||
memo: 'Test contribution to confirm',
|
memo: 'Test contribution to confirm',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: pendingContribution.data.createContribution.id,
|
||||||
state: 'PENDING',
|
state: 'PENDING',
|
||||||
memo: 'Test PENDING contribution update',
|
memo: 'Test PENDING contribution update',
|
||||||
amount: '10',
|
amount: '10',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDeny.data.createContribution.id,
|
||||||
state: 'DENIED',
|
state: 'DENIED',
|
||||||
memo: 'Test contribution to deny',
|
memo: 'Test contribution to deny',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDelete.data.createContribution.id,
|
||||||
state: 'DELETED',
|
state: 'DELETED',
|
||||||
memo: 'Test contribution to delete',
|
memo: 'Test contribution to delete',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: inProgressContribution.data.createContribution.id,
|
||||||
state: 'IN_PROGRESS',
|
state: 'IN_PROGRESS',
|
||||||
memo: 'Test IN_PROGRESS contribution',
|
memo: 'Test IN_PROGRESS contribution',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: bibiCreatedContribution.id,
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
memo: 'Herzlich Willkommen bei Gradido!',
|
memo: 'Herzlich Willkommen bei Gradido!',
|
||||||
amount: '1000',
|
amount: '1000',
|
||||||
@ -1527,15 +1485,13 @@ describe('ContributionResolver', () => {
|
|||||||
amount: '166',
|
amount: '166',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
},
|
})
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns all IN_PROGRESS Creation', async () => {
|
it('returns all IN_PROGRESS Creation', async () => {
|
||||||
await expect(
|
const {
|
||||||
query({
|
data: { listAllContributions: contributionListObject },
|
||||||
|
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1543,45 +1499,42 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: ['IN_PROGRESS'],
|
statusFilter: ['IN_PROGRESS'],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(contributionListObject).toMatchObject({
|
||||||
expect.objectContaining({
|
|
||||||
data: {
|
|
||||||
listAllContributions: {
|
|
||||||
contributionCount: 1,
|
contributionCount: 1,
|
||||||
contributionList: expect.arrayContaining([
|
contributionList: expect.arrayContaining([
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
amount: '100',
|
amount: '100',
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
id: expect.any(Number),
|
id: contributionToConfirm.data.createContribution.id,
|
||||||
memo: 'Test contribution to confirm',
|
memo: 'Test contribution to confirm',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: pendingContribution.data.createContribution.id,
|
||||||
state: 'PENDING',
|
state: 'PENDING',
|
||||||
memo: 'Test PENDING contribution update',
|
memo: 'Test PENDING contribution update',
|
||||||
amount: '10',
|
amount: '10',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDeny.data.createContribution.id,
|
||||||
state: 'DENIED',
|
state: 'DENIED',
|
||||||
memo: 'Test contribution to deny',
|
memo: 'Test contribution to deny',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDelete.data.createContribution.id,
|
||||||
state: 'DELETED',
|
state: 'DELETED',
|
||||||
memo: 'Test contribution to delete',
|
memo: 'Test contribution to delete',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: inProgressContribution.data.createContribution.id,
|
||||||
state: 'IN_PROGRESS',
|
state: 'IN_PROGRESS',
|
||||||
memo: 'Test IN_PROGRESS contribution',
|
memo: 'Test IN_PROGRESS contribution',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: bibiCreatedContribution.id,
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
memo: 'Herzlich Willkommen bei Gradido!',
|
memo: 'Herzlich Willkommen bei Gradido!',
|
||||||
amount: '1000',
|
amount: '1000',
|
||||||
@ -1599,15 +1552,13 @@ describe('ContributionResolver', () => {
|
|||||||
amount: '166',
|
amount: '166',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
},
|
})
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns all DENIED Creation', async () => {
|
it('returns all DENIED Creation', async () => {
|
||||||
await expect(
|
const {
|
||||||
query({
|
data: { listAllContributions: contributionListObject },
|
||||||
|
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1615,45 +1566,42 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: ['DENIED'],
|
statusFilter: ['DENIED'],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(contributionListObject).toMatchObject({
|
||||||
expect.objectContaining({
|
|
||||||
data: {
|
|
||||||
listAllContributions: {
|
|
||||||
contributionCount: 2,
|
contributionCount: 2,
|
||||||
contributionList: expect.arrayContaining([
|
contributionList: expect.arrayContaining([
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
amount: '100',
|
amount: '100',
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
id: expect.any(Number),
|
id: contributionToConfirm.data.createContribution.id,
|
||||||
memo: 'Test contribution to confirm',
|
memo: 'Test contribution to confirm',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: pendingContribution.data.createContribution.id,
|
||||||
state: 'PENDING',
|
state: 'PENDING',
|
||||||
memo: 'Test PENDING contribution update',
|
memo: 'Test PENDING contribution update',
|
||||||
amount: '10',
|
amount: '10',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDeny.data.createContribution.id,
|
||||||
state: 'DENIED',
|
state: 'DENIED',
|
||||||
memo: 'Test contribution to deny',
|
memo: 'Test contribution to deny',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDelete.data.createContribution.id,
|
||||||
state: 'DELETED',
|
state: 'DELETED',
|
||||||
memo: 'Test contribution to delete',
|
memo: 'Test contribution to delete',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: inProgressContribution.data.createContribution.id,
|
||||||
state: 'IN_PROGRESS',
|
state: 'IN_PROGRESS',
|
||||||
memo: 'Test IN_PROGRESS contribution',
|
memo: 'Test IN_PROGRESS contribution',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: bibiCreatedContribution.id,
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
memo: 'Herzlich Willkommen bei Gradido!',
|
memo: 'Herzlich Willkommen bei Gradido!',
|
||||||
amount: '1000',
|
amount: '1000',
|
||||||
@ -1671,15 +1619,13 @@ describe('ContributionResolver', () => {
|
|||||||
amount: '166',
|
amount: '166',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
},
|
})
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns all DELETED Creation', async () => {
|
it('does not return any DELETED Creation', async () => {
|
||||||
await expect(
|
const {
|
||||||
query({
|
data: { listAllContributions: contributionListObject },
|
||||||
|
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1687,22 +1633,17 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: ['DELETED'],
|
statusFilter: ['DELETED'],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(contributionListObject).toMatchObject({
|
||||||
expect.objectContaining({
|
|
||||||
data: {
|
|
||||||
listAllContributions: {
|
|
||||||
contributionCount: 0,
|
contributionCount: 0,
|
||||||
contributionList: [],
|
contributionList: [],
|
||||||
},
|
})
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns all CONFIRMED and PENDING Creation', async () => {
|
it('returns all CONFIRMED and PENDING Creation', async () => {
|
||||||
await expect(
|
const {
|
||||||
query({
|
data: { listAllContributions: contributionListObject },
|
||||||
|
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||||
query: listAllContributions,
|
query: listAllContributions,
|
||||||
variables: {
|
variables: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -1710,45 +1651,42 @@ describe('ContributionResolver', () => {
|
|||||||
order: 'DESC',
|
order: 'DESC',
|
||||||
statusFilter: ['CONFIRMED', 'PENDING'],
|
statusFilter: ['CONFIRMED', 'PENDING'],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
).resolves.toEqual(
|
expect(contributionListObject).toMatchObject({
|
||||||
expect.objectContaining({
|
|
||||||
data: {
|
|
||||||
listAllContributions: {
|
|
||||||
contributionCount: 4,
|
contributionCount: 4,
|
||||||
contributionList: expect.arrayContaining([
|
contributionList: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
amount: '100',
|
amount: '100',
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
id: expect.any(Number),
|
id: contributionToConfirm.data.createContribution.id,
|
||||||
memo: 'Test contribution to confirm',
|
memo: 'Test contribution to confirm',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: pendingContribution.data.createContribution.id,
|
||||||
state: 'PENDING',
|
state: 'PENDING',
|
||||||
memo: 'Test PENDING contribution update',
|
memo: 'Test PENDING contribution update',
|
||||||
amount: '10',
|
amount: '10',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDeny.data.createContribution.id,
|
||||||
state: 'DENIED',
|
state: 'DENIED',
|
||||||
memo: 'Test contribution to deny',
|
memo: 'Test contribution to deny',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: contributionToDelete.data.createContribution.id,
|
||||||
state: 'DELETED',
|
state: 'DELETED',
|
||||||
memo: 'Test contribution to delete',
|
memo: 'Test contribution to delete',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
id: expect.any(Number),
|
id: inProgressContribution.data.createContribution.id,
|
||||||
state: 'IN_PROGRESS',
|
state: 'IN_PROGRESS',
|
||||||
memo: 'Test IN_PROGRESS contribution',
|
memo: 'Test IN_PROGRESS contribution',
|
||||||
amount: '100',
|
amount: '100',
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(Number),
|
id: bibiCreatedContribution.id,
|
||||||
state: 'CONFIRMED',
|
state: 'CONFIRMED',
|
||||||
memo: 'Herzlich Willkommen bei Gradido!',
|
memo: 'Herzlich Willkommen bei Gradido!',
|
||||||
amount: '1000',
|
amount: '1000',
|
||||||
@ -1766,10 +1704,7 @@ describe('ContributionResolver', () => {
|
|||||||
amount: '166',
|
amount: '166',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
},
|
})
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user