mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add test and increase coverage
This commit is contained in:
parent
b18dd8e636
commit
ed1ace5aab
@ -7,10 +7,10 @@ import { Field, ObjectType } from 'type-graphql'
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export class GetPublicCommunityInfoResult {
|
||||
constructor(dbCom: DbCommunity) {
|
||||
this.publicKey = dbCom.publicKey.toString('hex')
|
||||
this.publicKey = dbCom.publicKey.toString()
|
||||
this.name = dbCom.name
|
||||
this.description = dbCom.description
|
||||
this.createdAt = dbCom.creationDate
|
||||
this.creationDate = dbCom.creationDate
|
||||
}
|
||||
|
||||
@Field(() => String)
|
||||
@ -20,7 +20,7 @@ export class GetPublicCommunityInfoResult {
|
||||
description: string | null
|
||||
|
||||
@Field(() => Date)
|
||||
createdAt: Date | null
|
||||
creationDate: Date | null
|
||||
|
||||
@Field(() => String)
|
||||
publicKey: string
|
||||
|
||||
@ -30,20 +30,21 @@ describe('PublicCommunityInfoResolver', () => {
|
||||
{
|
||||
name
|
||||
description
|
||||
createdAt
|
||||
creationDate
|
||||
publicKey
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
describe('getPublicCommunityInfo', () => {
|
||||
let homeCom: DbCommunity
|
||||
beforeEach(async () => {
|
||||
const homeCom = new DbCommunity()
|
||||
homeCom = new DbCommunity()
|
||||
homeCom.foreign = false
|
||||
homeCom.url = 'homeCommunity-url'
|
||||
homeCom.name = 'Community-Name'
|
||||
homeCom.description = 'Community-Description'
|
||||
homeCom.createdAt = new Date()
|
||||
homeCom.creationDate = new Date()
|
||||
homeCom.publicKey = Buffer.from('homeCommunity-publicKey')
|
||||
await DbCommunity.insert(homeCom)
|
||||
})
|
||||
@ -54,7 +55,7 @@ describe('PublicCommunityInfoResolver', () => {
|
||||
getPublicCommunityInfo: {
|
||||
name: 'Community-Name',
|
||||
description: 'Community-Description',
|
||||
createdAt: expect.any(Date),
|
||||
creationDate: homeCom.creationDate?.toISOString(),
|
||||
publicKey: expect.stringMatching('homeCommunity-publicKey'),
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user