remove empty string check since we do a length check on memeo & name

This commit is contained in:
Ulf Gebhardt 2023-02-07 11:01:35 +01:00
parent db1ed715ca
commit a04d4d3985
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
2 changed files with 0 additions and 50 deletions

View File

@ -319,27 +319,6 @@ describe('Contribution Links', () => {
)
})
it('returns an error if name is an empty string', async () => {
jest.clearAllMocks()
await expect(
mutate({
mutation: createContributionLink,
variables: {
...variables,
name: '',
},
}),
).resolves.toEqual(
expect.objectContaining({
errors: [new GraphQLError('The name must be initialized')],
}),
)
})
it('logs the error thrown', () => {
expect(logger.error).toBeCalledWith('The name must be initialized')
})
it('returns an error if name is shorter than 5 characters', async () => {
jest.clearAllMocks()
await expect(
@ -382,27 +361,6 @@ describe('Contribution Links', () => {
expect(logger.error).toBeCalledWith('The value of name is too long', 101)
})
it('returns an error if memo is an empty string', async () => {
jest.clearAllMocks()
await expect(
mutate({
mutation: createContributionLink,
variables: {
...variables,
memo: '',
},
}),
).resolves.toEqual(
expect.objectContaining({
errors: [new GraphQLError('The memo must be initialized')],
}),
)
})
it('logs the error thrown', () => {
expect(logger.error).toBeCalledWith('The memo must be initialized')
})
it('returns an error if memo is shorter than 5 characters', async () => {
jest.clearAllMocks()
await expect(

View File

@ -40,20 +40,12 @@ export class ContributionLinkResolver {
}: ContributionLinkArgs,
): Promise<ContributionLink> {
isStartEndDateValid(validFrom, validTo)
// TODO: this should be enforced by the schema.
if (!name) {
throw new LogError('The name must be initialized')
}
if (name.length < CONTRIBUTIONLINK_NAME_MIN_CHARS) {
throw new LogError('The value of name is too short', name.length)
}
if (name.length > CONTRIBUTIONLINK_NAME_MAX_CHARS) {
throw new LogError('The value of name is too long', name.length)
}
// TODO: this should be enforced by the schema.
if (!memo) {
throw new LogError('The memo must be initialized')
}
if (memo.length < MEMO_MIN_CHARS) {
throw new LogError('The value of memo is too short', memo.length)
}