-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackgroundQueue.test.ts
36 lines (27 loc) · 1.05 KB
/
backgroundQueue.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { CloudEvent } from 'cloudevents';
import { HTTP_STATUS_CODES } from '../utilities/http.js';
import { BUNDLE_REQUEST_TRIGGER_TYPE } from '../events/bundleRequestTrigger.event.js';
import { CE_ID, CE_SOURCE } from '../testUtils/eventing/stubs.js';
import { getServiceUrl } from './utils/knative.js';
import { postEvent } from './utils/events.js';
const QUEUE_URL = await getServiceUrl('veraid-authority-queue');
describe('Background queue', () => {
test('Supported event should be accepted', async () => {
const event = new CloudEvent({
id: CE_ID,
type: BUNDLE_REQUEST_TRIGGER_TYPE,
source: CE_SOURCE,
});
const response = await postEvent(event, QUEUE_URL);
expect(response.status).toBe(HTTP_STATUS_CODES.NO_CONTENT);
});
test('Unsupported event should be refused', async () => {
const event = new CloudEvent({
id: CE_ID,
type: 'invalid',
source: CE_SOURCE,
});
const response = await postEvent(event, QUEUE_URL);
expect(response.status).toBe(HTTP_STATUS_CODES.BAD_REQUEST);
});
});