mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #2921 from gradido/eslint-disable-tests-typesafer
refactor(backend): eslint disable tests typesafer
This commit is contained in:
commit
cb3b800d5c
@ -1,8 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
import { testEnvironment } from '@test/helpers'
|
||||
@ -23,8 +24,12 @@ import {
|
||||
sendTransactionReceivedEmail,
|
||||
} from './sendEmailVariants'
|
||||
|
||||
let con: any
|
||||
let testEnv: any
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
testEnv = await testEnvironment(logger, localization)
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
|
||||
import { testEnvironment, cleanDB } from '@test/helpers'
|
||||
import { logger } from '@test/testSetup'
|
||||
|
||||
import { validateCommunities } from './validateCommunities'
|
||||
|
||||
let con: any
|
||||
let testEnv: any
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
testEnv = await testEnvironment(logger)
|
||||
|
||||
@ -1,20 +1,19 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
|
||||
import { testEnvironment } from '@test/helpers'
|
||||
|
||||
import { getCommunities } from '@/seeds/graphql/queries'
|
||||
|
||||
let query: any
|
||||
|
||||
// to do: We need a setup for the tests that closes the connection
|
||||
let con: any
|
||||
let testEnv: any
|
||||
let query: ApolloServerTestClient['query'], con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
testEnv = await testEnvironment()
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { GraphQLError } from 'graphql'
|
||||
|
||||
@ -24,8 +22,14 @@ import { listContributionLinks } from '@/seeds/graphql/queries'
|
||||
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||
|
||||
let mutate: any, query: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
testEnv = await testEnvironment()
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { GraphQLError } from 'graphql'
|
||||
|
||||
import { cleanDB, resetToken, testEnvironment } from '@test/helpers'
|
||||
@ -35,8 +35,12 @@ jest.mock('@/emails/sendEmailVariants', () => {
|
||||
}
|
||||
})
|
||||
|
||||
let mutate: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
let result: any
|
||||
|
||||
beforeAll(async () => {
|
||||
|
||||
@ -1,22 +1,18 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Contribution } from '@entity/Contribution'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||
import { User } from '@entity/User'
|
||||
import { UserInputError } from 'apollo-server-express'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { GraphQLError } from 'graphql'
|
||||
|
||||
import { ContributionStatus } from '@enum/ContributionStatus'
|
||||
import { Order } from '@enum/Order'
|
||||
import { ContributionListResult } from '@model/Contribution'
|
||||
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
||||
import {
|
||||
cleanDB,
|
||||
resetToken,
|
||||
@ -62,8 +58,14 @@ import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
||||
|
||||
jest.mock('@/emails/sendEmailVariants')
|
||||
|
||||
let mutate: any, query: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
let creation: Contribution | void
|
||||
let admin: User
|
||||
let pendingContribution: any
|
||||
@ -165,7 +167,7 @@ describe('ContributionResolver', () => {
|
||||
describe('createContribution', () => {
|
||||
describe('unauthenticated', () => {
|
||||
it('returns an error', async () => {
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: createContribution,
|
||||
variables: { amount: 100.0, memo: 'Test Contribution', creationDate: 'not-valid' },
|
||||
})
|
||||
@ -190,7 +192,7 @@ describe('ContributionResolver', () => {
|
||||
it('throws error when memo length smaller than 5 chars', async () => {
|
||||
jest.clearAllMocks()
|
||||
const date = new Date()
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: createContribution,
|
||||
variables: {
|
||||
amount: 100.0,
|
||||
@ -209,7 +211,7 @@ describe('ContributionResolver', () => {
|
||||
it('throws error when memo length greater than 255 chars', async () => {
|
||||
jest.clearAllMocks()
|
||||
const date = new Date()
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: createContribution,
|
||||
variables: {
|
||||
amount: 100.0,
|
||||
@ -226,7 +228,7 @@ describe('ContributionResolver', () => {
|
||||
|
||||
it('throws error when creationDate not-valid', async () => {
|
||||
jest.clearAllMocks()
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: createContribution,
|
||||
variables: {
|
||||
amount: 100.0,
|
||||
@ -249,7 +251,7 @@ describe('ContributionResolver', () => {
|
||||
it('throws error when creationDate 3 month behind', async () => {
|
||||
jest.clearAllMocks()
|
||||
const date = new Date()
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: createContribution,
|
||||
variables: {
|
||||
amount: 100.0,
|
||||
@ -297,7 +299,7 @@ describe('ContributionResolver', () => {
|
||||
describe('updateContribution', () => {
|
||||
describe('unauthenticated', () => {
|
||||
it('returns an error', async () => {
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: updateContribution,
|
||||
variables: {
|
||||
contributionId: 1,
|
||||
@ -326,7 +328,7 @@ describe('ContributionResolver', () => {
|
||||
it('throws error', async () => {
|
||||
jest.clearAllMocks()
|
||||
const date = new Date()
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: updateContribution,
|
||||
variables: {
|
||||
contributionId: pendingContribution.data.createContribution.id,
|
||||
@ -347,7 +349,7 @@ describe('ContributionResolver', () => {
|
||||
it('throws error', async () => {
|
||||
jest.clearAllMocks()
|
||||
const date = new Date()
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: updateContribution,
|
||||
variables: {
|
||||
contributionId: pendingContribution.data.createContribution.id,
|
||||
@ -399,7 +401,7 @@ describe('ContributionResolver', () => {
|
||||
|
||||
it('throws an error', async () => {
|
||||
jest.clearAllMocks()
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: updateContribution,
|
||||
variables: {
|
||||
contributionId: pendingContribution.data.createContribution.id,
|
||||
@ -432,7 +434,7 @@ describe('ContributionResolver', () => {
|
||||
|
||||
it('throws an error', async () => {
|
||||
jest.clearAllMocks()
|
||||
const { errors: errorObjects }: { errors: GraphQLError[] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: adminUpdateContribution,
|
||||
variables: {
|
||||
id: pendingContribution.data.createContribution.id,
|
||||
@ -511,7 +513,7 @@ describe('ContributionResolver', () => {
|
||||
|
||||
it('throws an error', async () => {
|
||||
jest.clearAllMocks()
|
||||
const { errors: errorObjects }: { errors: GraphQLError[] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: updateContribution,
|
||||
variables: {
|
||||
contributionId: pendingContribution.data.createContribution.id,
|
||||
@ -540,7 +542,7 @@ describe('ContributionResolver', () => {
|
||||
it('throws an error', async () => {
|
||||
jest.clearAllMocks()
|
||||
const date = new Date()
|
||||
const { errors: errorObjects }: { errors: GraphQLError[] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: updateContribution,
|
||||
variables: {
|
||||
contributionId: pendingContribution.data.createContribution.id,
|
||||
@ -563,7 +565,7 @@ describe('ContributionResolver', () => {
|
||||
it('updates contribution', async () => {
|
||||
const {
|
||||
data: { updateContribution: contribution },
|
||||
}: { data: { updateContribution: UnconfirmedContribution } } = await mutate({
|
||||
} = await mutate({
|
||||
mutation: updateContribution,
|
||||
variables: {
|
||||
contributionId: pendingContribution.data.createContribution.id,
|
||||
@ -602,7 +604,7 @@ describe('ContributionResolver', () => {
|
||||
describe('denyContribution', () => {
|
||||
describe('unauthenticated', () => {
|
||||
it('returns an error', async () => {
|
||||
const { errors: errorObjects }: { errors: GraphQLError[] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: denyContribution,
|
||||
variables: {
|
||||
id: 1,
|
||||
@ -625,7 +627,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
|
||||
it('returns an error', async () => {
|
||||
const { errors: errorObjects }: { errors: GraphQLError[] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: denyContribution,
|
||||
variables: {
|
||||
id: 1,
|
||||
@ -650,7 +652,7 @@ describe('ContributionResolver', () => {
|
||||
describe('wrong contribution id', () => {
|
||||
it('throws an error', async () => {
|
||||
jest.clearAllMocks()
|
||||
const { errors: errorObjects }: { errors: GraphQLError[] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: denyContribution,
|
||||
variables: {
|
||||
id: -1,
|
||||
@ -694,7 +696,7 @@ describe('ContributionResolver', () => {
|
||||
},
|
||||
})
|
||||
|
||||
const { errors: errorObjects }: { errors: GraphQLError[] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: denyContribution,
|
||||
variables: {
|
||||
id: contribution.data.createContribution.id,
|
||||
@ -739,7 +741,7 @@ describe('ContributionResolver', () => {
|
||||
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
||||
})
|
||||
|
||||
const { errors: errorObjects }: { errors: GraphQLError[] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: denyContribution,
|
||||
variables: {
|
||||
id: contribution.data.createContribution.id,
|
||||
@ -784,7 +786,7 @@ describe('ContributionResolver', () => {
|
||||
},
|
||||
})
|
||||
|
||||
const { errors: errorObjects }: { errors: GraphQLError[] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: denyContribution,
|
||||
variables: {
|
||||
id: contribution.data.createContribution.id,
|
||||
@ -806,7 +808,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
const {
|
||||
data: { denyContribution: isDenied },
|
||||
}: { data: { denyContribution: boolean } } = await mutate({
|
||||
} = await mutate({
|
||||
mutation: denyContribution,
|
||||
variables: {
|
||||
id: contributionToDeny.data.createContribution.id,
|
||||
@ -845,8 +847,8 @@ describe('ContributionResolver', () => {
|
||||
describe('deleteContribution', () => {
|
||||
describe('unauthenticated', () => {
|
||||
it('returns an error', async () => {
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
query: deleteContribution,
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: deleteContribution,
|
||||
variables: {
|
||||
id: -1,
|
||||
},
|
||||
@ -870,7 +872,7 @@ describe('ContributionResolver', () => {
|
||||
describe('wrong contribution id', () => {
|
||||
it('returns an error', async () => {
|
||||
jest.clearAllMocks()
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: deleteContribution,
|
||||
variables: {
|
||||
id: -1,
|
||||
@ -898,7 +900,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
|
||||
it('returns an error', async () => {
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: deleteContribution,
|
||||
variables: {
|
||||
id: contributionToDelete.data.createContribution.id,
|
||||
@ -934,7 +936,7 @@ describe('ContributionResolver', () => {
|
||||
it('deletes successfully', async () => {
|
||||
const {
|
||||
data: { deleteContribution: isDenied },
|
||||
}: { data: { deleteContribution: boolean } } = await mutate({
|
||||
} = await mutate({
|
||||
mutation: deleteContribution,
|
||||
variables: {
|
||||
id: contributionToDelete.data.createContribution.id,
|
||||
@ -973,7 +975,7 @@ describe('ContributionResolver', () => {
|
||||
mutation: login,
|
||||
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
|
||||
})
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await mutate({
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: deleteContribution,
|
||||
variables: {
|
||||
id: contributionToConfirm.data.createContribution.id,
|
||||
@ -997,7 +999,7 @@ describe('ContributionResolver', () => {
|
||||
describe('listContributions', () => {
|
||||
describe('unauthenticated', () => {
|
||||
it('returns an error', async () => {
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await query({
|
||||
const { errors: errorObjects } = await query({
|
||||
query: listContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1025,7 +1027,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns creations', async () => {
|
||||
const {
|
||||
data: { listContributions: contributionListResult },
|
||||
}: { data: { listContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1077,7 +1079,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns only unconfirmed creations', async () => {
|
||||
const {
|
||||
data: { listContributions: contributionListResult },
|
||||
}: { data: { listContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1127,7 +1129,7 @@ describe('ContributionResolver', () => {
|
||||
describe('listAllContribution', () => {
|
||||
describe('unauthenticated', () => {
|
||||
it('returns an error', async () => {
|
||||
const { errors: errorObjects }: { errors: [GraphQLError] } = await query({
|
||||
const { errors: errorObjects } = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1153,7 +1155,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
|
||||
it('throws an error with "NOT_VALID" in statusFilter', async () => {
|
||||
const { errors: errorObjects }: { errors: [GraphQLError | UserInputError] } = await query({
|
||||
const { errors: errorObjects } = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1170,7 +1172,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
|
||||
it('throws an error with a null in statusFilter', async () => {
|
||||
const { errors: errorObjects }: { errors: [Error] } = await query({
|
||||
const { errors: errorObjects } = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1187,7 +1189,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
|
||||
it('throws an error with null and "NOT_VALID" in statusFilter', async () => {
|
||||
const { errors: errorObjects }: { errors: [Error] } = await query({
|
||||
const { errors: errorObjects } = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1209,7 +1211,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns all contributions without statusFilter', async () => {
|
||||
const {
|
||||
data: { listAllContributions: contributionListObject },
|
||||
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1273,7 +1275,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns all contributions for statusFilter = null', async () => {
|
||||
const {
|
||||
data: { listAllContributions: contributionListObject },
|
||||
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1338,7 +1340,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns all contributions for statusFilter = []', async () => {
|
||||
const {
|
||||
data: { listAllContributions: contributionListObject },
|
||||
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1403,7 +1405,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns all CONFIRMED contributions', async () => {
|
||||
const {
|
||||
data: { listAllContributions: contributionListObject },
|
||||
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1453,7 +1455,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns all PENDING contributions', async () => {
|
||||
const {
|
||||
data: { listAllContributions: contributionListObject },
|
||||
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1491,7 +1493,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns all IN_PROGRESS Creation', async () => {
|
||||
const {
|
||||
data: { listAllContributions: contributionListObject },
|
||||
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1529,7 +1531,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns all DENIED Creation', async () => {
|
||||
const {
|
||||
data: { listAllContributions: contributionListObject },
|
||||
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1573,7 +1575,7 @@ describe('ContributionResolver', () => {
|
||||
it('does not return any DELETED Creation', async () => {
|
||||
const {
|
||||
data: { listAllContributions: contributionListObject },
|
||||
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -1592,7 +1594,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns all CONFIRMED and PENDING Creation', async () => {
|
||||
const {
|
||||
data: { listAllContributions: contributionListObject },
|
||||
}: { data: { listAllContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: listAllContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
@ -2675,7 +2677,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns 17 creations in total', async () => {
|
||||
const {
|
||||
data: { adminListContributions: contributionListObject },
|
||||
}: { data: { adminListContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: adminListContributions,
|
||||
})
|
||||
expect(contributionListObject.contributionList).toHaveLength(17)
|
||||
@ -2842,7 +2844,7 @@ describe('ContributionResolver', () => {
|
||||
it('returns two pending creations with page size set to 2', async () => {
|
||||
const {
|
||||
data: { adminListContributions: contributionListObject },
|
||||
}: { data: { adminListContributions: ContributionListResult } } = await query({
|
||||
} = await query({
|
||||
query: adminListContributions,
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { User as DbUser } from '@entity/User'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { GraphQLError } from 'graphql'
|
||||
|
||||
import { testEnvironment, cleanDB } from '@test/helpers'
|
||||
@ -13,8 +11,14 @@ import { CONFIG } from '@/config'
|
||||
import { createUser, setPassword, forgotPassword } from '@/seeds/graphql/mutations'
|
||||
import { queryOptIn } from '@/seeds/graphql/queries'
|
||||
|
||||
let mutate: any, query: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
CONFIG.EMAIL_CODE_VALID_TIME = 1440
|
||||
CONFIG.EMAIL_CODE_REQUEST_TIME = 10
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
import { Transaction } from '@entity/Transaction'
|
||||
import { User } from '@entity/User'
|
||||
import { UserContact } from '@entity/UserContact'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { GraphQLError } from 'graphql'
|
||||
|
||||
@ -44,8 +42,14 @@ import { transactionLinkCode } from './TransactionLinkResolver'
|
||||
jest.mock('@/util/TRANSACTIONS_LOCK')
|
||||
TRANSACTIONS_LOCK.acquire = jest.fn().mockResolvedValue(jest.fn())
|
||||
|
||||
let mutate: any, query: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
let user: User
|
||||
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
import { Transaction } from '@entity/Transaction'
|
||||
import { User } from '@entity/User'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { GraphQLError } from 'graphql'
|
||||
|
||||
@ -26,13 +25,16 @@ import { garrickOllivander } from '@/seeds/users/garrick-ollivander'
|
||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
||||
|
||||
let mutate: any, query: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
testEnv = await testEnvironment(logger)
|
||||
mutate = testEnv.mutate
|
||||
query = testEnv.query
|
||||
con = testEnv.con
|
||||
await cleanDB()
|
||||
})
|
||||
@ -273,7 +275,7 @@ describe('send coins', () => {
|
||||
})
|
||||
|
||||
// login as admin
|
||||
await query({ mutation: login, variables: peterData })
|
||||
await mutate({ mutation: login, variables: peterData })
|
||||
|
||||
// confirm the contribution
|
||||
await mutate({
|
||||
@ -282,7 +284,7 @@ describe('send coins', () => {
|
||||
})
|
||||
|
||||
// login as bob again
|
||||
await query({ mutation: login, variables: bobData })
|
||||
await mutate({ mutation: login, variables: bobData })
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
|
||||
@ -3,12 +3,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
import { TransactionLink } from '@entity/TransactionLink'
|
||||
import { User } from '@entity/User'
|
||||
import { UserContact } from '@entity/UserContact'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { GraphQLError } from 'graphql'
|
||||
import { v4 as uuidv4, validate as validateUUID, version as versionUUID } from 'uuid'
|
||||
|
||||
@ -87,8 +88,14 @@ jest.mock('@/apis/KlicktippController', () => {
|
||||
|
||||
let admin: User
|
||||
let user: User
|
||||
let mutate: any, query: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
testEnv = await testEnvironment(logger, localization)
|
||||
@ -235,7 +242,7 @@ describe('UserResolver', () => {
|
||||
})
|
||||
|
||||
describe('user already exists', () => {
|
||||
let mutation: User
|
||||
let mutation: any
|
||||
beforeAll(async () => {
|
||||
mutation = await mutate({ mutation: createUser, variables })
|
||||
})
|
||||
@ -637,7 +644,7 @@ describe('UserResolver', () => {
|
||||
publisherId: 1234,
|
||||
}
|
||||
|
||||
let result: User
|
||||
let result: any
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDB()
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
import { cleanDB, testEnvironment, contributionDateFormatter } from '@test/helpers'
|
||||
@ -23,8 +22,12 @@ import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||
|
||||
let mutate: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
testEnv = await testEnvironment()
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Contribution } from '@entity/Contribution'
|
||||
import { User } from '@entity/User'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
|
||||
import { testEnvironment, cleanDB, contributionDateFormatter } from '@test/helpers'
|
||||
|
||||
@ -16,8 +12,12 @@ import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||
|
||||
import { getUserCreation } from './creations'
|
||||
|
||||
let mutate: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
con: Connection
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
testEnv = await testEnvironment()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user