mirror of
https://github.com/IT4Change/gradido.git
synced 2026-03-01 12:44:43 +00:00
adapt backend tests to change seeding data
This commit is contained in:
parent
ecfeeadcb1
commit
92ad6b68bf
@ -947,7 +947,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('without any filters', () => {
|
describe('without any filters', () => {
|
||||||
it('finds 6 open transaction links and no deleted or redeemed', async () => {
|
it('finds 7 open transaction links and no deleted or redeemed', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
query({
|
query({
|
||||||
query: listTransactionLinksAdmin,
|
query: listTransactionLinksAdmin,
|
||||||
@ -957,14 +957,14 @@ describe('TransactionLinkResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
data: {
|
||||||
listTransactionLinksAdmin: {
|
listTransactionLinksAdmin: {
|
||||||
count: 6,
|
count: 7,
|
||||||
links: expect.not.arrayContaining([
|
links: expect.not.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(',
|
memo: 'Leider wollte niemand meine Gradidos haben :(',
|
||||||
createdAt: expect.any(String),
|
createdAt: expect.any(String),
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
memo: 'Da habe ich mich wohl etwas übernommen.',
|
memo: "Kein Trick, keine Zauberrei,\n bei Gradidio sei dabei!",
|
||||||
deletedAt: expect.any(String),
|
deletedAt: expect.any(String),
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
@ -976,7 +976,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('all filters are null', () => {
|
describe('all filters are null', () => {
|
||||||
it('finds 6 open transaction links and no deleted or redeemed', async () => {
|
it('finds 7 open transaction links and no deleted or redeemed', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
query({
|
query({
|
||||||
query: listTransactionLinksAdmin,
|
query: listTransactionLinksAdmin,
|
||||||
@ -993,10 +993,10 @@ describe('TransactionLinkResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
data: {
|
||||||
listTransactionLinksAdmin: {
|
listTransactionLinksAdmin: {
|
||||||
count: 6,
|
count: 7,
|
||||||
links: expect.not.arrayContaining([
|
links: expect.not.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(',
|
memo: 'Leider wollte niemand meine Gradidos haben :(',
|
||||||
createdAt: expect.any(String),
|
createdAt: expect.any(String),
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
@ -1012,7 +1012,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('filter with deleted', () => {
|
describe('filter with deleted', () => {
|
||||||
it('finds 6 open transaction links, 1 deleted, and no redeemed', async () => {
|
it('finds 7 open transaction links, 1 deleted, and no redeemed', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
query({
|
query({
|
||||||
query: listTransactionLinksAdmin,
|
query: listTransactionLinksAdmin,
|
||||||
@ -1027,10 +1027,10 @@ describe('TransactionLinkResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
data: {
|
||||||
listTransactionLinksAdmin: {
|
listTransactionLinksAdmin: {
|
||||||
count: 7,
|
count: 8,
|
||||||
links: expect.arrayContaining([
|
links: expect.arrayContaining([
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(',
|
memo: 'Leider wollte niemand meine Gradidos haben :(',
|
||||||
createdAt: expect.any(String),
|
createdAt: expect.any(String),
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
@ -1046,7 +1046,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('filter by expired', () => {
|
describe('filter by expired', () => {
|
||||||
it('finds 5 open transaction links, 1 expired, and no redeemed', async () => {
|
it('finds 6 open transaction links, 1 expired, and no redeemed', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
query({
|
query({
|
||||||
query: listTransactionLinksAdmin,
|
query: listTransactionLinksAdmin,
|
||||||
@ -1064,7 +1064,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
count: 7,
|
count: 7,
|
||||||
links: expect.arrayContaining([
|
links: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(',
|
memo: 'Leider wollte niemand meine Gradidos haben :(',
|
||||||
createdAt: expect.any(String),
|
createdAt: expect.any(String),
|
||||||
}),
|
}),
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
@ -1082,7 +1082,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
// TODO: works not as expected, because 'redeemedAt' and 'redeemedBy' have to be added to the transaktion link factory
|
// TODO: works not as expected, because 'redeemedAt' and 'redeemedBy' have to be added to the transaktion link factory
|
||||||
|
|
||||||
describe.skip('filter by redeemed', () => {
|
describe.skip('filter by redeemed', () => {
|
||||||
it('finds 6 open transaction links, 1 deleted, and no redeemed', async () => {
|
it('finds 7 open transaction links, 1 deleted, and no redeemed', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
query({
|
query({
|
||||||
query: listTransactionLinksAdmin,
|
query: listTransactionLinksAdmin,
|
||||||
@ -1099,10 +1099,10 @@ describe('TransactionLinkResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
data: {
|
||||||
listTransactionLinksAdmin: {
|
listTransactionLinksAdmin: {
|
||||||
count: 6,
|
count: 7,
|
||||||
links: expect.arrayContaining([
|
links: expect.arrayContaining([
|
||||||
expect.not.objectContaining({
|
expect.not.objectContaining({
|
||||||
memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(',
|
memo: 'Leider wollte niemand meine Gradidos haben :(',
|
||||||
createdAt: expect.any(String),
|
createdAt: expect.any(String),
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
|
|||||||
@ -1040,7 +1040,7 @@ describe('UserResolver', () => {
|
|||||||
|
|
||||||
describe('user exists in DB', () => {
|
describe('user exists in DB', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await userFactory(testEnv, bibiBloxberg)
|
await userFactory(testEnv, bobBaumeister)
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
@ -1050,7 +1050,7 @@ describe('UserResolver', () => {
|
|||||||
|
|
||||||
describe('duration not expired', () => {
|
describe('duration not expired', () => {
|
||||||
it('throws an error', async () => {
|
it('throws an error', async () => {
|
||||||
await expect(mutate({ mutation: forgotPassword, variables })).resolves.toEqual(
|
await expect(mutate({ mutation: forgotPassword, variables: { email: 'bob@baumeister.de' } })).resolves.toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
errors: [
|
errors: [
|
||||||
new GraphQLError(
|
new GraphQLError(
|
||||||
@ -1067,7 +1067,7 @@ describe('UserResolver', () => {
|
|||||||
describe('duration reset to 0', () => {
|
describe('duration reset to 0', () => {
|
||||||
it('returns true', async () => {
|
it('returns true', async () => {
|
||||||
CONFIG.EMAIL_CODE_REQUEST_TIME = 0
|
CONFIG.EMAIL_CODE_REQUEST_TIME = 0
|
||||||
await expect(mutate({ mutation: forgotPassword, variables })).resolves.toEqual(
|
await expect(mutate({ mutation: forgotPassword, variables: { email: 'bob@baumeister.de' } })).resolves.toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
data: {
|
||||||
forgotPassword: true,
|
forgotPassword: true,
|
||||||
@ -1078,9 +1078,9 @@ describe('UserResolver', () => {
|
|||||||
|
|
||||||
it('sends reset password email', () => {
|
it('sends reset password email', () => {
|
||||||
expect(sendResetPasswordEmail).toBeCalledWith({
|
expect(sendResetPasswordEmail).toBeCalledWith({
|
||||||
firstName: 'Bibi',
|
firstName: 'Bob',
|
||||||
lastName: 'Bloxberg',
|
lastName: 'der Baumeister',
|
||||||
email: 'bibi@bloxberg.de',
|
email: 'bob@baumeister.de',
|
||||||
language: 'de',
|
language: 'de',
|
||||||
resetLink: expect.any(String),
|
resetLink: expect.any(String),
|
||||||
timeDurationObject: expect.objectContaining({
|
timeDurationObject: expect.objectContaining({
|
||||||
@ -1092,7 +1092,7 @@ describe('UserResolver', () => {
|
|||||||
|
|
||||||
it('stores the EMAIL_FORGOT_PASSWORD event in the database', async () => {
|
it('stores the EMAIL_FORGOT_PASSWORD event in the database', async () => {
|
||||||
const userConatct = await UserContact.findOneOrFail({
|
const userConatct = await UserContact.findOneOrFail({
|
||||||
where: { email: 'bibi@bloxberg.de' },
|
where: { email: 'bob@baumeister.de' },
|
||||||
relations: ['user'],
|
relations: ['user'],
|
||||||
})
|
})
|
||||||
await expect(DbEvent.find()).resolves.toContainEqual(
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
@ -1108,7 +1108,7 @@ describe('UserResolver', () => {
|
|||||||
describe('request reset password again', () => {
|
describe('request reset password again', () => {
|
||||||
it('throws an error', async () => {
|
it('throws an error', async () => {
|
||||||
CONFIG.EMAIL_CODE_REQUEST_TIME = emailCodeRequestTime
|
CONFIG.EMAIL_CODE_REQUEST_TIME = emailCodeRequestTime
|
||||||
await expect(mutate({ mutation: forgotPassword, variables })).resolves.toEqual(
|
await expect(mutate({ mutation: forgotPassword, variables: { email: 'bob@baumeister.de' } })).resolves.toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
errors: [new GraphQLError('Email already sent less than 10 minutes ago')],
|
errors: [new GraphQLError('Email already sent less than 10 minutes ago')],
|
||||||
}),
|
}),
|
||||||
@ -1128,8 +1128,8 @@ describe('UserResolver', () => {
|
|||||||
let emailContact: UserContact
|
let emailContact: UserContact
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await userFactory(testEnv, bibiBloxberg)
|
await userFactory(testEnv, bobBaumeister)
|
||||||
emailContact = await UserContact.findOneOrFail({ where: { email: bibiBloxberg.email } })
|
emailContact = await UserContact.findOneOrFail({ where: { email: bobBaumeister.email } })
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
@ -1140,7 +1140,7 @@ describe('UserResolver', () => {
|
|||||||
it('throws an error', async () => {
|
it('throws an error', async () => {
|
||||||
jest.clearAllMocks()
|
jest.clearAllMocks()
|
||||||
await expect(
|
await expect(
|
||||||
query({ query: queryOptIn, variables: { optIn: 'not-valid' } }),
|
query({ query: queryOptIn, variables: { email: 'bob@baumeister.de', optIn: 'not-valid' } }),
|
||||||
).resolves.toEqual(
|
).resolves.toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
errors: [
|
errors: [
|
||||||
@ -1161,7 +1161,7 @@ describe('UserResolver', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
query({
|
query({
|
||||||
query: queryOptIn,
|
query: queryOptIn,
|
||||||
variables: { optIn: emailContact.emailVerificationCode.toString() },
|
variables: { email: 'bob@baumeister.de', optIn: emailContact.emailVerificationCode.toString() },
|
||||||
}),
|
}),
|
||||||
).resolves.toEqual(
|
).resolves.toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user