From d64804dcd3d8d858030a3545270ac47059b081bc Mon Sep 17 00:00:00 2001 From: Gus Narea Date: Thu, 12 Oct 2023 16:44:35 +0100 Subject: [PATCH] fix(queue): Use correct id of default Awala Internet Endpoint (#238) --- .../sinks/memberBundleRequest.sink.spec.ts | 15 +-------------- src/events/outgoingServiceMessage.event.spec.ts | 5 +++-- src/events/outgoingServiceMessage.event.ts | 4 ++-- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/backgroundQueue/sinks/memberBundleRequest.sink.spec.ts b/src/backgroundQueue/sinks/memberBundleRequest.sink.spec.ts index 369f655..21cd5b7 100644 --- a/src/backgroundQueue/sinks/memberBundleRequest.sink.spec.ts +++ b/src/backgroundQueue/sinks/memberBundleRequest.sink.spec.ts @@ -24,10 +24,7 @@ import { MemberBundleRequestModelSchema } from '../../models/MemberBundleRequest import { partialPinoLog } from '../../testUtils/logging.js'; import { stringToArrayBuffer } from '../../testUtils/buffer.js'; import { mockEmitters } from '../../testUtils/eventing/mockEmitters.js'; -import { - OUTGOING_MESSAGE_SOURCE, - OUTGOING_SERVICE_MESSAGE_TYPE, -} from '../../events/outgoingServiceMessage.event.js'; +import { OUTGOING_SERVICE_MESSAGE_TYPE } from '../../events/outgoingServiceMessage.event.js'; import { VeraidContentType } from '../../utilities/veraid.js'; import { EmitterChannel } from '../../utilities/eventing/EmitterChannel.js'; import type { BundleCreationFailure } from '../../memberBundle.js'; @@ -127,16 +124,6 @@ describe('memberBundleIssuance', () => { ); }); - test('Source should be URL identifying Awala Internet Endpoint', async () => { - await postEvent(triggerEvent, server); - - expect(getEvents(EmitterChannel.AWALA_OUTGOING_MESSAGES)).toContainEqual( - expect.objectContaining({ - source: OUTGOING_MESSAGE_SOURCE, - }), - ); - }); - test('Subject should be peer id', async () => { await postEvent(triggerEvent, server); diff --git a/src/events/outgoingServiceMessage.event.spec.ts b/src/events/outgoingServiceMessage.event.spec.ts index 7af66b8..7b50f87 100644 --- a/src/events/outgoingServiceMessage.event.spec.ts +++ b/src/events/outgoingServiceMessage.event.spec.ts @@ -9,6 +9,7 @@ import { import { type OutgoingServiceMessageOptions, makeOutgoingServiceMessageEvent, + DEFAULT_ENDPOINT_ID, } from './outgoingServiceMessage.event.js'; describe('makeIncomingServiceMessageEvent', () => { @@ -38,10 +39,10 @@ describe('makeIncomingServiceMessageEvent', () => { expect(type).toBe('tech.relaycorp.awala.endpoint-internet.outgoing-service-message'); }); - test('Event source should be awala-endpoint-internet', () => { + test('Event source should be the default endpoint', () => { const { source } = makeOutgoingServiceMessageEvent(options); - expect(source).toBe('https://relaycorp.tech/awala-endpoint-internet'); + expect(source).toBe(DEFAULT_ENDPOINT_ID); }); test('Event subject should be the peer id', () => { diff --git a/src/events/outgoingServiceMessage.event.ts b/src/events/outgoingServiceMessage.event.ts index 640f10c..d49033a 100644 --- a/src/events/outgoingServiceMessage.event.ts +++ b/src/events/outgoingServiceMessage.event.ts @@ -3,7 +3,7 @@ import { CloudEvent } from 'cloudevents'; export const OUTGOING_SERVICE_MESSAGE_TYPE = 'tech.relaycorp.awala.endpoint-internet.outgoing-service-message'; -export const OUTGOING_MESSAGE_SOURCE = 'https://relaycorp.tech/awala-endpoint-internet'; +export const DEFAULT_ENDPOINT_ID = 'default'; export interface OutgoingServiceMessageOptions { readonly creationDate: Date; @@ -19,7 +19,7 @@ export function makeOutgoingServiceMessageEvent( return new CloudEvent({ specversion: '1.0', type: OUTGOING_SERVICE_MESSAGE_TYPE, - source: OUTGOING_MESSAGE_SOURCE, + source: DEFAULT_ENDPOINT_ID, subject: options.peerId, datacontenttype: options.contentType, data: options.content,