diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.test.ts b/backend/src/graphql/resolver/TransactionLinkResolver.test.ts index 59e8047c6..fe047b35a 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.test.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.test.ts @@ -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( diff --git a/backend/src/graphql/schema.ts b/backend/src/graphql/schema.ts index 878bb747c..a2e4ca71f 100644 --- a/backend/src/graphql/schema.ts +++ b/backend/src/graphql/schema.ts @@ -14,11 +14,11 @@ export const schema = async (): Promise => { 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, }, }) } diff --git a/backend/src/graphql/validator/Alias.ts b/backend/src/graphql/validator/Alias.ts deleted file mode 100644 index e69de29bb..000000000