apply suggestions

This commit is contained in:
Einhornimmond 2023-08-16 13:16:49 +02:00
parent 16739e7e4d
commit 8f6d2b5f3c
3 changed files with 61 additions and 4 deletions

View File

@ -148,6 +148,63 @@ describe('TransactionLinkResolver', () => {
])
})
it('throws error when memo text is too short', async () => {
jest.clearAllMocks()
const { errors: errorObjects } = await mutate({
mutation: createTransactionLink,
variables: {
amount: 100,
memo: 'Test',
},
})
expect(errorObjects).toMatchObject([
{
message: 'Argument Validation Error',
extensions: {
exception: {
validationErrors: [
{
property: 'memo',
constraints: {
minLength: 'memo must be longer than or equal to 5 characters',
},
},
],
},
},
},
])
})
it('throws error when memo text is too long', async () => {
jest.clearAllMocks()
const { errors: errorObjects } = await mutate({
mutation: createTransactionLink,
variables: {
identifier: 'peter@lustig.de',
amount: 100,
memo: 'test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test t',
},
})
expect(errorObjects).toMatchObject([
{
message: 'Argument Validation Error',
extensions: {
exception: {
validationErrors: [
{
property: 'memo',
constraints: {
maxLength: 'memo must be shorter than or equal to 255 characters',
},
},
],
},
},
},
])
})
it('throws error when user has not enough GDD', async () => {
jest.clearAllMocks()
await expect(

View File

@ -14,11 +14,11 @@ export const schema = async (): Promise<GraphQLSchema> => {
scalarsMap: [{ type: Decimal, scalar: DecimalScalar }],
validate: {
validationError: { target: false },
skipMissingProperties: true,
skipMissingProperties: false,
skipNullProperties: true,
skipUndefinedProperties: true,
forbidUnknownValues: false,
stopAtFirstError: false,
skipUndefinedProperties: false,
forbidUnknownValues: true,
stopAtFirstError: true,
},
})
}