Skip to content

Commit

Permalink
feat(iprod-416): added int test for hub jws-certs
Browse files Browse the repository at this point in the history
  • Loading branch information
geka-evk committed Feb 27, 2024
1 parent e0d4f55 commit e28360b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/int/JWSCertsService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ const ValidationCodes = require('../../src/pki_engine/ValidationCodes');
const forge = require('node-forge');
const { createContext, destroyContext } = require('./context');

describe('JWSCertsService', () => {
const SWITCH_ID = 'switch';

describe('JWSCertsService Tests', () => {
let ctx;

before(async () => {
await setupTestDB();
ctx = await createContext();
Expand Down Expand Up @@ -60,6 +63,21 @@ describe('JWSCertsService', () => {
console.log(certs2);
}).timeout(30000);

it('should set a hub JWSCerts', async () => {
const body = { publicKey };
const result = await JWSCertsService.setHubJWSCerts(ctx, body);
assert.equal(publicKey, result.publicKey);
const hubKeyData = await JWSCertsService.getHubJWSCerts(ctx);
console.log(hubKeyData);
assert.equal(hubKeyData.dfspId, SWITCH_ID);
assert.equal(hubKeyData.validationState, 'VALID');

const allKeysData = await JWSCertsService.getAllDfspJWSCerts(ctx);
console.log(allKeysData);
const hubKey = allKeysData.find(k => k.dfspId === SWITCH_ID);
assert.exists(hubKey);
}).timeout(30000);

it('should create and delete a DfspJWSCerts entry', async () => {
const body = { publicKey };
const dfsp = {
Expand Down

0 comments on commit e28360b

Please sign in to comment.