mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
fix backend test
This commit is contained in:
parent
9a8fac54ae
commit
38d5388029
@ -7,9 +7,9 @@ import { IsPositiveDecimal } from '@/graphql/validator/Decimal'
|
||||
|
||||
@ArgsType()
|
||||
export class TransactionSendArgs {
|
||||
@Field(() => String)
|
||||
@Field(() => String, { nullable: true })
|
||||
@IsString()
|
||||
recipientCommunityIdentifier: string
|
||||
recipientCommunityIdentifier?: string | null | undefined
|
||||
|
||||
@Field(() => String)
|
||||
@IsString()
|
||||
|
||||
@ -12,7 +12,7 @@ import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
|
||||
import { cleanDB, testEnvironment } from '@test/helpers'
|
||||
|
||||
import { getCommunities, getCommunitySelections } from '@/seeds/graphql/queries'
|
||||
import { getCommunities, communities } from '@/seeds/graphql/queries'
|
||||
|
||||
// to do: We need a setup for the tests that closes the connection
|
||||
let query: ApolloServerTestClient['query'], con: Connection
|
||||
@ -234,7 +234,7 @@ describe('CommunityResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('getCommunitySelections', () => {
|
||||
describe('communities', () => {
|
||||
let homeCom1: DbCommunity
|
||||
let foreignCom1: DbCommunity
|
||||
let foreignCom2: DbCommunity
|
||||
@ -248,9 +248,9 @@ describe('CommunityResolver', () => {
|
||||
it('returns no community entry', async () => {
|
||||
// const result: Community[] = await query({ query: getCommunities })
|
||||
// expect(result.length).toEqual(0)
|
||||
await expect(query({ query: getCommunitySelections })).resolves.toMatchObject({
|
||||
await expect(query({ query: communities })).resolves.toMatchObject({
|
||||
data: {
|
||||
getCommunitySelections: [],
|
||||
communities: [],
|
||||
},
|
||||
})
|
||||
})
|
||||
@ -275,9 +275,9 @@ describe('CommunityResolver', () => {
|
||||
})
|
||||
|
||||
it('returns 1 home-community entry', async () => {
|
||||
await expect(query({ query: getCommunitySelections })).resolves.toMatchObject({
|
||||
await expect(query({ query: communities })).resolves.toMatchObject({
|
||||
data: {
|
||||
getCommunitySelections: [
|
||||
communities: [
|
||||
{
|
||||
id: expect.any(Number),
|
||||
foreign: homeCom1.foreign,
|
||||
@ -337,9 +337,9 @@ describe('CommunityResolver', () => {
|
||||
})
|
||||
|
||||
it('returns 3 community entries', async () => {
|
||||
await expect(query({ query: getCommunitySelections })).resolves.toMatchObject({
|
||||
await expect(query({ query: communities })).resolves.toMatchObject({
|
||||
data: {
|
||||
getCommunitySelections: [
|
||||
communities: [
|
||||
{
|
||||
id: expect.any(Number),
|
||||
foreign: homeCom1.foreign,
|
||||
|
||||
@ -91,7 +91,7 @@ describe('send coins', () => {
|
||||
await mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'wrong@email.com',
|
||||
recipientIdentifier: 'wrong@email.com',
|
||||
amount: 100,
|
||||
memo: 'test test',
|
||||
},
|
||||
@ -119,7 +119,7 @@ describe('send coins', () => {
|
||||
await mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'stephen@hawking.uk',
|
||||
recipientIdentifier: 'stephen@hawking.uk',
|
||||
amount: 100,
|
||||
memo: 'test test',
|
||||
},
|
||||
@ -148,7 +148,7 @@ describe('send coins', () => {
|
||||
await mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'garrick@ollivander.com',
|
||||
recipientIdentifier: 'garrick@ollivander.com',
|
||||
amount: 100,
|
||||
memo: 'test test',
|
||||
},
|
||||
@ -184,7 +184,7 @@ describe('send coins', () => {
|
||||
await mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'bob@baumeister.de',
|
||||
recipientIdentifier: 'bob@baumeister.de',
|
||||
amount: 100,
|
||||
memo: 'test test',
|
||||
},
|
||||
@ -207,7 +207,7 @@ describe('send coins', () => {
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'peter@lustig.de',
|
||||
recipientIdentifier: 'peter@lustig.de',
|
||||
amount: 100,
|
||||
memo: 'Test',
|
||||
},
|
||||
@ -238,7 +238,7 @@ describe('send coins', () => {
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'peter@lustig.de',
|
||||
recipientIdentifier: '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',
|
||||
},
|
||||
@ -270,7 +270,7 @@ describe('send coins', () => {
|
||||
await mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'peter@lustig.de',
|
||||
recipientIdentifier: 'peter@lustig.de',
|
||||
amount: 100,
|
||||
memo: 'testing',
|
||||
},
|
||||
@ -319,7 +319,7 @@ describe('send coins', () => {
|
||||
const { errors: errorObjects } = await mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'peter@lustig.de',
|
||||
recipientIdentifier: 'peter@lustig.de',
|
||||
amount: -50,
|
||||
memo: 'testing negative',
|
||||
},
|
||||
@ -350,7 +350,7 @@ describe('send coins', () => {
|
||||
await mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'peter@lustig.de',
|
||||
recipientIdentifier: 'peter@lustig.de',
|
||||
amount: 50,
|
||||
memo: 'unrepeatable memo',
|
||||
},
|
||||
@ -456,7 +456,7 @@ describe('send coins', () => {
|
||||
mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: peter?.gradidoID,
|
||||
recipientIdentifier: peter?.gradidoID,
|
||||
amount: 10,
|
||||
memo: 'send via gradido ID',
|
||||
},
|
||||
@ -496,7 +496,7 @@ describe('send coins', () => {
|
||||
mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'bob',
|
||||
recipientIdentifier: 'bob',
|
||||
amount: 6.66,
|
||||
memo: 'send via alias',
|
||||
},
|
||||
@ -564,7 +564,7 @@ describe('send coins', () => {
|
||||
mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'peter@lustig.de',
|
||||
recipientIdentifier: 'peter@lustig.de',
|
||||
amount: 10,
|
||||
memo: 'first transaction',
|
||||
},
|
||||
@ -580,7 +580,7 @@ describe('send coins', () => {
|
||||
mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'peter@lustig.de',
|
||||
recipientIdentifier: 'peter@lustig.de',
|
||||
amount: 20,
|
||||
memo: 'second transaction',
|
||||
},
|
||||
@ -596,7 +596,7 @@ describe('send coins', () => {
|
||||
mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'peter@lustig.de',
|
||||
recipientIdentifier: 'peter@lustig.de',
|
||||
amount: 30,
|
||||
memo: 'third transaction',
|
||||
},
|
||||
@ -612,7 +612,7 @@ describe('send coins', () => {
|
||||
mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'peter@lustig.de',
|
||||
recipientIdentifier: 'peter@lustig.de',
|
||||
amount: 40,
|
||||
memo: 'fourth transaction',
|
||||
},
|
||||
|
||||
@ -156,7 +156,11 @@ describe('semaphore', () => {
|
||||
})
|
||||
const bibisTransaction = mutate({
|
||||
mutation: sendCoins,
|
||||
variables: { identifier: 'bob@baumeister.de', amount: '50', memo: 'Das ist für dich, Bob' },
|
||||
variables: {
|
||||
recipientIdentifier: 'bob@baumeister.de',
|
||||
amount: '50',
|
||||
memo: 'Das ist für dich, Bob',
|
||||
},
|
||||
})
|
||||
await mutate({
|
||||
mutation: login,
|
||||
@ -172,7 +176,11 @@ describe('semaphore', () => {
|
||||
})
|
||||
const bobsTransaction = mutate({
|
||||
mutation: sendCoins,
|
||||
variables: { identifier: 'bibi@bloxberg.de', amount: '50', memo: 'Das ist für dich, Bibi' },
|
||||
variables: {
|
||||
recipientIdentifier: 'bibi@bloxberg.de',
|
||||
amount: '50',
|
||||
memo: 'Das ist für dich, Bibi',
|
||||
},
|
||||
})
|
||||
await mutate({
|
||||
mutation: login,
|
||||
|
||||
@ -5,7 +5,6 @@ import { SEND_TYPES } from '@/pages/Send'
|
||||
import { createMockClient } from 'mock-apollo-client'
|
||||
import VueApollo from 'vue-apollo'
|
||||
import { user as userQuery, selectCommunities as selectCommunitiesQuery } from '@/graphql/queries'
|
||||
import { COMMUNITY_NAME } from '@/config'
|
||||
|
||||
const mockClient = createMockClient()
|
||||
const apolloProvider = new VueApollo({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user