@onify/fake-amqplib 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -7
- package/index.js +1 -1
- package/main.cjs +1 -1
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ You might want to override `amqplib` with `@onify/fake-amqplib` in tests. This c
|
|
|
42
42
|
|
|
43
43
|
Example on how to mock amqplib when working with commonjs.
|
|
44
44
|
|
|
45
|
-
```
|
|
45
|
+
```js
|
|
46
46
|
const amqplib = require('amqplib');
|
|
47
47
|
const fakeAmqp = require('@onify/fake-amqplib');
|
|
48
48
|
|
|
@@ -51,7 +51,7 @@ amqplib.connect = fakeAmqp.connect;
|
|
|
51
51
|
|
|
52
52
|
or:
|
|
53
53
|
|
|
54
|
-
```
|
|
54
|
+
```js
|
|
55
55
|
const mock = require('mock-require');
|
|
56
56
|
const fakeAmqp = require('@onify/fake-amqplib');
|
|
57
57
|
|
|
@@ -60,7 +60,7 @@ mock('amqplib/callback_api', fakeAmqp);
|
|
|
60
60
|
|
|
61
61
|
or just mock the entire amqplib with:
|
|
62
62
|
|
|
63
|
-
```
|
|
63
|
+
```js
|
|
64
64
|
const mock = require('mock-require');
|
|
65
65
|
const fakeAmqp = require('@onify/fake-amqplib');
|
|
66
66
|
|
|
@@ -77,14 +77,13 @@ Both amqplib and fake-amqplib have to be quibbled if reset mock is used during t
|
|
|
77
77
|
|
|
78
78
|
_test/setup.js_
|
|
79
79
|
|
|
80
|
-
```
|
|
80
|
+
```javascript
|
|
81
81
|
import * as fakeAmqpLib from '@onify/fake-amqplib';
|
|
82
82
|
import { connect as fakeConnect } from '@onify/fake-amqplib';
|
|
83
83
|
import quibble from 'quibble';
|
|
84
84
|
|
|
85
85
|
(async () => {
|
|
86
86
|
await quibble.esm('amqplib', { connect: fakeConnect });
|
|
87
|
-
await quibble.esm('amqplib/callback_api', { connect: fakeConnect });
|
|
88
87
|
await quibble.esm('@onify/fake-amqplib', { ...fakeAmqpLib });
|
|
89
88
|
})();
|
|
90
89
|
```
|
|
@@ -101,10 +100,10 @@ _.mocharc.json_ (true for node version < 20)
|
|
|
101
100
|
|
|
102
101
|
_test/amqplib-connection-test.js_
|
|
103
102
|
|
|
104
|
-
```
|
|
103
|
+
```javascript
|
|
105
104
|
import assert from 'node:assert';
|
|
106
105
|
import { connect } from 'amqplib';
|
|
107
|
-
import { connect as connectCb } from 'amqplib
|
|
106
|
+
import { connect as connectCb } from 'amqplib';
|
|
108
107
|
|
|
109
108
|
import { resetMock } from '@onify/fake-amqplib';
|
|
110
109
|
|
package/index.js
CHANGED
|
@@ -717,7 +717,7 @@ function addConfirmCallback(broker, options, callback) {
|
|
|
717
717
|
}
|
|
718
718
|
|
|
719
719
|
function confirmCallback() {
|
|
720
|
-
broker.off('message.*', consumerTag);
|
|
720
|
+
broker.off('message.*', { consumerTag });
|
|
721
721
|
switch (undelivered) {
|
|
722
722
|
case 'message.nack':
|
|
723
723
|
return callback(new Error('message nacked'));
|
package/main.cjs
CHANGED
|
@@ -719,7 +719,7 @@ function addConfirmCallback(broker, options, callback) {
|
|
|
719
719
|
}
|
|
720
720
|
|
|
721
721
|
function confirmCallback() {
|
|
722
|
-
broker.off('message.*', consumerTag);
|
|
722
|
+
broker.off('message.*', { consumerTag });
|
|
723
723
|
switch (undelivered) {
|
|
724
724
|
case 'message.nack':
|
|
725
725
|
return callback(new Error('message nacked'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onify/fake-amqplib",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Fake amqplib",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -33,18 +33,21 @@
|
|
|
33
33
|
},
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"smqp": "^
|
|
36
|
+
"smqp": "^9.0.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@rollup/plugin-commonjs": "^
|
|
39
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
40
40
|
"@types/amqplib": "^0.10.2",
|
|
41
|
-
"
|
|
41
|
+
"amqplib": "^0.10.4",
|
|
42
|
+
"c8": "^10.1.2",
|
|
42
43
|
"chai": "^5.1.0",
|
|
43
44
|
"eslint": "^9.0.0",
|
|
44
45
|
"globals": "^15.0.0",
|
|
45
46
|
"mocha": "^10.2.0",
|
|
46
47
|
"prettier": "^3.2.5",
|
|
47
|
-
"
|
|
48
|
+
"quibble": "^0.9.2",
|
|
49
|
+
"rollup": "^4.0.2",
|
|
50
|
+
"texample": "^0.0.6"
|
|
48
51
|
},
|
|
49
52
|
"keywords": [
|
|
50
53
|
"fake",
|