-
Notifications
You must be signed in to change notification settings - Fork 64
/
test00006.test.ts
44 lines (39 loc) · 1.05 KB
/
test00006.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
37
38
39
40
41
42
43
44
/*
* Copyright (c)
* Weyoss <weyoss@protonmail.com>
* https://github.com/weyoss
*
* This source code is licensed under the MIT license found in the LICENSE file
* in the root directory of this source tree.
*/
import { expect, test } from '@jest/globals';
import bluebird from 'bluebird';
import {
Consumer,
ConsumerGroupIdNotSupportedError,
EQueueDeliveryModel,
EQueueType,
IQueueParams,
} from '../../../src/lib/index.js';
import { getQueue } from '../../common/queue.js';
test('ConsumerGroupIdNotSupportedError', async () => {
const queue1: IQueueParams = {
name: 'test-queue',
ns: 'ns1',
};
const queue = await getQueue();
await queue.saveAsync(
queue1,
EQueueType.PRIORITY_QUEUE,
EQueueDeliveryModel.POINT_TO_POINT,
);
const consumer1 = bluebird.promisifyAll(new Consumer());
await consumer1.consumeAsync(
{ queue: queue1, groupId: 'my-group-1' },
(msg, cb) => cb(),
);
await expect(consumer1.runAsync()).rejects.toThrow(
ConsumerGroupIdNotSupportedError,
);
await consumer1.shutdownAsync();
});