mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
test send coins via alias
This commit is contained in:
parent
6aa8ae9bf4
commit
2e865c6744
@ -19,6 +19,7 @@ import {
|
||||
createContribution,
|
||||
login,
|
||||
sendCoins,
|
||||
updateUserInfos,
|
||||
} from '@/seeds/graphql/mutations'
|
||||
import { transactionsQuery } from '@/seeds/graphql/queries'
|
||||
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
||||
@ -52,10 +53,13 @@ let bobData: any
|
||||
let peterData: any
|
||||
let user: User[]
|
||||
|
||||
let bob: User
|
||||
let peter: User
|
||||
|
||||
describe('send coins', () => {
|
||||
beforeAll(async () => {
|
||||
await userFactory(testEnv, peterLustig)
|
||||
await userFactory(testEnv, bobBaumeister)
|
||||
peter = await userFactory(testEnv, peterLustig)
|
||||
bob = await userFactory(testEnv, bobBaumeister)
|
||||
await userFactory(testEnv, stephenHawking)
|
||||
await userFactory(testEnv, garrickOllivander)
|
||||
|
||||
@ -376,6 +380,114 @@ describe('send coins', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('send coins via gradido ID', () => {
|
||||
it('sends the coins', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: peter?.gradidoID,
|
||||
amount: 10,
|
||||
memo: 'send via gradido ID',
|
||||
},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
data: {
|
||||
sendCoins: true,
|
||||
},
|
||||
errors: undefined,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('send coins via alias', () => {
|
||||
beforeAll(async () => {
|
||||
await mutate({
|
||||
mutation: updateUserInfos,
|
||||
variables: {
|
||||
alias: 'bob',
|
||||
},
|
||||
})
|
||||
await mutate({
|
||||
mutation: login,
|
||||
variables: peterData,
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await mutate({
|
||||
mutation: login,
|
||||
variables: bobData,
|
||||
})
|
||||
})
|
||||
|
||||
it('sends the coins', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
mutation: sendCoins,
|
||||
variables: {
|
||||
identifier: 'bob',
|
||||
amount: 6.66,
|
||||
memo: 'send via alias',
|
||||
},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
data: {
|
||||
sendCoins: true,
|
||||
},
|
||||
errors: undefined,
|
||||
})
|
||||
})
|
||||
|
||||
describe("peter's transactions", () => {
|
||||
it('has all expected transactions', async () => {
|
||||
await expect(query({ query: transactionsQuery })).resolves.toMatchObject({
|
||||
data: {
|
||||
transactionList: {
|
||||
balance: expect.any(Object),
|
||||
transactions: [
|
||||
expect.objectContaining({
|
||||
typeId: 'DECAY',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
amount: expect.decimalEqual(-6.66),
|
||||
linkedUser: {
|
||||
firstName: 'Bob',
|
||||
gradidoID: bob?.gradidoID,
|
||||
lastName: 'der Baumeister',
|
||||
},
|
||||
memo: 'send via alias',
|
||||
typeId: 'SEND',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
amount: expect.decimalEqual(10),
|
||||
linkedUser: {
|
||||
firstName: 'Bob',
|
||||
gradidoID: bob?.gradidoID,
|
||||
lastName: 'der Baumeister',
|
||||
},
|
||||
memo: 'send via gradido ID',
|
||||
typeId: 'RECEIVE',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
amount: expect.decimalEqual(50),
|
||||
linkedUser: {
|
||||
firstName: 'Bob',
|
||||
gradidoID: bob?.gradidoID,
|
||||
lastName: 'der Baumeister',
|
||||
},
|
||||
memo: 'unrepeatable memo',
|
||||
typeId: 'RECEIVE',
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
errors: undefined,
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('more transactions to test semaphore', () => {
|
||||
it('sends the coins four times in a row', async () => {
|
||||
await expect(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user