Skip to content

Commit b1b6034

Browse files
authored
Merge pull request #4 from cre8/fix/db-test
test: update deprecated usage of typeorm
2 parents 4e9a609 + 00dc9b5 commit b1b6034

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/agent-plugin/sd-jwt-plugin.spec.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ import {
3434
Resolver,
3535
type VerificationMethod,
3636
} from 'did-resolver';
37-
import { createConnection } from 'typeorm';
37+
import { DataSource } from 'typeorm';
3838
import { beforeAll, describe, expect, it } from 'vitest';
3939
import type { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc';
4040
import { decodeSdJwt } from '@sd-jwt/decode';
4141
import type { KBJwt } from '@sd-jwt/core';
4242
import { type ISDJwtPlugin, SDJwtPlugin } from '../index';
4343

44-
async function verifySignature<T>(
44+
async function verifySignature(
4545
data: string,
4646
signature: string,
4747
key: JsonWebKey,
@@ -76,7 +76,6 @@ describe('Agent plugin', () => {
7676

7777
// Issuer define the claims object with the user's information
7878
const claims = {
79-
sub: '',
8079
given_name: 'John',
8180
family_name: 'Deo',
8281
@@ -104,14 +103,14 @@ describe('Agent plugin', () => {
104103

105104
beforeAll(async () => {
106105
const KMS_SECRET_KEY = '000102030405060708090a0b0c0d0e0f';
107-
const dbConnection = await createConnection({
106+
const dbConnection = await new DataSource({
108107
type: 'sqlite',
109108
database: ':memory:',
110109
entities: Entities,
111110
migrations,
112111
synchronize: true,
113112
logging: false,
114-
});
113+
}).initialize();
115114
agent = createAgent<AgentType>({
116115
plugins: [
117116
new SDJwtPlugin({
@@ -164,7 +163,7 @@ describe('Agent plugin', () => {
164163
options: { keyType: 'Secp256r1' } as JwkCreateIdentifierOptions,
165164
})
166165
.then((did) => `${did.did}#0`);
167-
claims.sub = holder;
166+
// claims.sub = holder;
168167
});
169168

170169
it('create a sd-jwt', async () => {
@@ -229,6 +228,7 @@ describe('Agent plugin', () => {
229228
it('create a presentation', async () => {
230229
const credentialPayload: SdJwtVcPayload = {
231230
...claims,
231+
sub: holder,
232232
iss: issuer,
233233
iat: new Date().getTime() / 1000,
234234
vct: '',
@@ -385,6 +385,7 @@ describe('Agent plugin', () => {
385385
const credentialPayload: SdJwtVcPayload = {
386386
...claims,
387387
iss: issuer,
388+
sub: holder,
388389
iat: new Date().getTime() / 1000,
389390
vct: '',
390391
};

0 commit comments

Comments
 (0)