mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #2705 from gradido/authenticated_tests_for_TransactionLinkResolver
test(backend): authentication tests for TransactionLinkResolver
This commit is contained in:
commit
40d08120e3
@ -53,6 +53,21 @@ afterAll(async () => {
|
|||||||
|
|
||||||
describe('TransactionLinkResolver', () => {
|
describe('TransactionLinkResolver', () => {
|
||||||
describe('createTransactionLink', () => {
|
describe('createTransactionLink', () => {
|
||||||
|
describe('unauthenticated', () => {
|
||||||
|
it('throws an error', async () => {
|
||||||
|
jest.clearAllMocks()
|
||||||
|
resetToken()
|
||||||
|
await expect(
|
||||||
|
mutate({ mutation: createTransactionLink, variables: { amount: 0, memo: 'Test' } }),
|
||||||
|
).resolves.toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
errors: [new GraphQLError('401 Unauthorized')],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('authenticated', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await mutate({
|
await mutate({
|
||||||
mutation: login,
|
mutation: login,
|
||||||
@ -114,6 +129,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
expect(logger.error).toBeCalledWith('User has not enough GDD', expect.any(Number))
|
expect(logger.error).toBeCalledWith('User has not enough GDD', expect.any(Number))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('redeemTransactionLink', () => {
|
describe('redeemTransactionLink', () => {
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
@ -121,6 +137,21 @@ describe('TransactionLinkResolver', () => {
|
|||||||
resetToken()
|
resetToken()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('unauthenticated', () => {
|
||||||
|
it('throws an error', async () => {
|
||||||
|
jest.clearAllMocks()
|
||||||
|
resetToken()
|
||||||
|
await expect(
|
||||||
|
mutate({ mutation: redeemTransactionLink, variables: { code: 'CL-123456' } }),
|
||||||
|
).resolves.toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
errors: [new GraphQLError('401 Unauthorized')],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('authenticated', () => {
|
||||||
describe('contributionLink', () => {
|
describe('contributionLink', () => {
|
||||||
describe('input not valid', () => {
|
describe('input not valid', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
@ -478,6 +509,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('listTransactionLinksAdmin', () => {
|
describe('listTransactionLinksAdmin', () => {
|
||||||
const variables = {
|
const variables = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user