Skip to content

Commit

Permalink
updated jest tests
Browse files Browse the repository at this point in the history
Signed-off-by: wadeking98 <[email protected]>
  • Loading branch information
wadeking98 committed Apr 24, 2024
1 parent 8e29985 commit 48b18b6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ describe('AnonCredsRsServices', () => {
revocationRegistryId: null,
credentialRevocationId: null,
methodName: 'inMemory',
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
})

const proofRequest: AnonCredsProofRequest = {
Expand Down Expand Up @@ -410,6 +412,8 @@ describe('AnonCredsRsServices', () => {
revocationRegistryId: null,
credentialRevocationId: null,
methodName: 'inMemory',
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
})

const proofRequest: AnonCredsProofRequest = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ describe('Legacy indy format services', () => {
revocationRegistryId: null,
credentialRevocationId: null,
methodName: 'inMemory',
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
})

expect(holderCredentialRecord.metadata.data).toEqual({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@ import type { AnonCredsCredentialInfo, AnonCredsRequestedAttributeMatch } from '

import { sortRequestedCredentialsMatches } from '../sortRequestedCredentialsMatches'

const credentialInfo = {} as unknown as AnonCredsCredentialInfo
const credentialInfo = {
updatedAt: new Date('2024-01-01T00:00:00Z'),
createdAt: new Date('2024-01-01T00:00:00Z'),
} as unknown as AnonCredsCredentialInfo

const credentials: AnonCredsRequestedAttributeMatch[] = [
{
credentialId: '1',
revealed: true,
revoked: true,
credentialInfo,
credentialInfo: { ...credentialInfo, updatedAt: new Date('2024-01-01T00:00:01Z') },
},
{
credentialId: '2',
revealed: true,
revoked: undefined,
credentialInfo,
credentialInfo: { ...credentialInfo, updatedAt: new Date('2024-01-01T00:00:01Z') },
},
{
credentialId: '3',
revealed: true,
revoked: false,
credentialInfo,
credentialInfo: { ...credentialInfo, updatedAt: new Date('2024-01-01T00:00:01Z') },
},
{
credentialId: '4',
Expand Down
2 changes: 2 additions & 0 deletions packages/anoncreds/tests/anoncreds-flow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ async function anonCredsFlowTest(options: { issuerId: string; revocable: boolean
revocationRegistryId: revocable ? revocationRegistryDefinitionId : null,
credentialRevocationId: revocable ? '1' : null,
methodName: 'inMemory',
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
})

const expectedCredentialMetadata = revocable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ async function anonCredsFlowTest(options: { issuerId: string; revocable: boolean
revocationRegistryId: revocable ? revocationRegistryDefinitionId : null,
credentialRevocationId: revocable ? '1' : null,
methodName: 'inMemory',
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
})

const expectedCredentialMetadata = revocable
Expand Down
2 changes: 2 additions & 0 deletions packages/anoncreds/tests/indy-flow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ describe('Legacy indy format services using anoncreds-rs', () => {
credentialRevocationId: null,
methodName: 'inMemory',
linkSecretId: 'linkSecretId',
createdAt: expect.any(Date),
updatedAt: expect.any(Date),
})

expect(holderCredentialRecord.metadata.data).toEqual({
Expand Down

0 comments on commit 48b18b6

Please sign in to comment.