Skip to content
Snippets Groups Projects
Commit b72698cc authored by Berend Sliedrecht's avatar Berend Sliedrecht
Browse files

feat(ssi): use the new event structure in the ssi-abstraction


Signed-off-by: default avatarBerend Sliedrecht <berend@animo.id>
parent 723712bb
No related branches found
No related tags found
1 merge request!5feat(shared): base event setup
......@@ -29,7 +29,9 @@ describe('ConnectionsController', () => {
.spyOn(connectionsService, 'getAll')
.mockImplementation(() => Promise.resolve(result));
expect(await connectionsController.getAll()).toBe(result);
const connectionsEvent = await connectionsController.getAll();
expect(connectionsEvent.data).toStrictEqual({ connections: result });
});
});
});
import { Controller } from '@nestjs/common';
import { MessagePattern } from '@nestjs/microservices';
import { EventDidcommConnectionsGetAll } from '@ocm/shared';
import { ConnectionsService } from './connections.service.js';
......@@ -8,7 +9,9 @@ export class ConnectionsController {
public constructor(private connectionsService: ConnectionsService) {}
@MessagePattern('didcomm.connections.getAll')
public async getAll() {
return await this.connectionsService.getAll();
public async getAll(): Promise<EventDidcommConnectionsGetAll> {
return new EventDidcommConnectionsGetAll({
connections: await this.connectionsService.getAll(),
});
}
}
import type { INestApplication } from '@nestjs/common';
import type { ClientProxy } from '@nestjs/microservices';
import type { EventDidcommConnectionsGetAll } from '@ocm/shared';
import { ClientsModule, Transport } from '@nestjs/microservices';
import { Test } from '@nestjs/testing';
......@@ -36,12 +37,12 @@ describe('Connections', () => {
});
it('didcomm.connections.getAll', async () => {
const response$: Observable<unknown> = client.send(
const response$: Observable<EventDidcommConnectionsGetAll> = client.send(
'didcomm.connections.getAll',
{},
);
const response = await firstValueFrom(response$);
expect(response).toMatchObject([]);
expect(response.data).toMatchObject({ connections: [] });
});
afterAll(async () => {
......
......@@ -36,8 +36,8 @@ importers:
specifier: ^5.0.1
version: 5.0.1(eslint-config-prettier@9.0.0)(eslint@8.54.0)(prettier@3.1.0)
eslint-plugin-workspaces:
specifier: ^0.9.0
version: 0.9.0
specifier: ^0.10.0
version: 0.10.0
husky:
specifier: ^8.0.0
version: 8.0.3
......@@ -7869,10 +7869,10 @@ packages:
synckit: 0.8.5
dev: true
 
/eslint-plugin-workspaces@0.9.0:
resolution: {integrity: sha512-krMuZ+yZgzwv1oTBfz50oamNVPDIm7CDyot3i1GRKBqMD2oXAwnXHLQWH7ctpV8k6YVrkhcaZhuV9IJxD8OPAQ==}
/eslint-plugin-workspaces@0.10.0:
resolution: {integrity: sha512-H692yRZFczzzyde0Sq3nmRDlyywv6foYJnmsxO3slWImJdCf4g5D+gzdWeRpmfitgUsFZxXVJdvW4OS6yY4M9g==}
dependencies:
find-workspaces: 0.2.0
find-workspaces: 0.3.0
dev: true
 
/eslint-scope@5.1.1:
......@@ -8608,8 +8608,8 @@ packages:
semver-regex: 4.0.5
dev: true
 
/find-workspaces@0.2.0:
resolution: {integrity: sha512-OTHryv88yjzwvbXHGi0+XRFu7Jqe5pFuIR2mhqdatDJQOBJd7MFJOPFJv4EbNo8n1BNM/13Y2KcyDpFQYf0ETw==}
/find-workspaces@0.3.0:
resolution: {integrity: sha512-sHdt3vbddcDuN0CYnKoG/b77jrOkSYPlxoM7ve7/vEvAd29XC7u/qE2zavRzJv4eD1sbTvDnRNZskdy/e0v83A==}
dependencies:
fast-glob: 3.3.2
pkg-types: 1.0.3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment