Skip to content

Commit

Permalink
fix(queue): Use correct id of default Awala Internet Endpoint (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea authored Oct 12, 2023
1 parent bab911f commit d64804d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
15 changes: 1 addition & 14 deletions src/backgroundQueue/sinks/memberBundleRequest.sink.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);

Expand Down
5 changes: 3 additions & 2 deletions src/events/outgoingServiceMessage.event.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import {
type OutgoingServiceMessageOptions,
makeOutgoingServiceMessageEvent,
DEFAULT_ENDPOINT_ID,
} from './outgoingServiceMessage.event.js';

describe('makeIncomingServiceMessageEvent', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/events/outgoingServiceMessage.event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit d64804d

Please sign in to comment.