mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
also test getPublicKey for 1.1
This commit is contained in:
parent
97513c1b25
commit
33375c347f
@ -0,0 +1,56 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { createTestClient } from 'apollo-server-testing'
|
||||
import createServer from '@/server/createServer'
|
||||
import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
let query: any
|
||||
|
||||
// to do: We need a setup for the tests that closes the connection
|
||||
let con: any
|
||||
|
||||
CONFIG.FEDERATION_API = '1_1'
|
||||
|
||||
beforeAll(async () => {
|
||||
const server = await createServer()
|
||||
con = server.con
|
||||
query = createTestClient(server.apollo).query
|
||||
DbFederatedCommunity.clear()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await con.close()
|
||||
})
|
||||
|
||||
describe('PublicKeyResolver', () => {
|
||||
const getPublicKeyQuery = `
|
||||
query {
|
||||
getPublicKey
|
||||
{
|
||||
publicKey
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
describe('getPublicKey', () => {
|
||||
beforeEach(async () => {
|
||||
const homeCom = new DbFederatedCommunity()
|
||||
homeCom.foreign = false
|
||||
homeCom.apiVersion = '1_0'
|
||||
homeCom.endPoint = 'endpoint-url'
|
||||
homeCom.publicKey = Buffer.from('homeCommunity-publicKey')
|
||||
await DbFederatedCommunity.insert(homeCom)
|
||||
})
|
||||
|
||||
it('returns homeCommunity-publicKey', async () => {
|
||||
await expect(query({ query: getPublicKeyQuery })).resolves.toMatchObject({
|
||||
data: {
|
||||
getPublicKey: {
|
||||
publicKey: expect.stringMatching('homeCommunity-publicKey'),
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user