Skip to content

Commit 0301b03

Browse files
committed
chore: add test for edge case
1 parent 8024876 commit 0301b03

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

__tests__/plugins/rabbitmq_plugin.test.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('RabbitMQ plugin settings', () => {
5555
process.argv = oldArgs;
5656
});
5757

58-
it('should return the settings if everything is correct', () => {
58+
it('should return the settings if everything is correct with queue configuration', () => {
5959
const oldArgs = process.argv;
6060
process.argv = [
6161
'node', // not used but a value is required at this index
@@ -88,6 +88,24 @@ describe('RabbitMQ plugin settings', () => {
8888
});
8989
process.argv = oldArgs;
9090
});
91+
92+
it('should return the settings if everything is correct with exchange and a blank routing key', () => {
93+
const oldArgs = process.argv;
94+
process.argv = [
95+
'node', // not used but a value is required at this index
96+
'a_script_file.js', // not used but a value is required at this index
97+
'--plugin_rabbitmq_url', 'test-url',
98+
'--plugin_rabbitmq_exchange', 'test-exchange',
99+
'--plugin_rabbitmq_routing_key', '',
100+
];
101+
const settings = getSettings();
102+
expect(settings).toMatchObject({
103+
url: 'test-url',
104+
exchange: 'test-exchange',
105+
routingKey: '',
106+
});
107+
process.argv = oldArgs;
108+
});
91109
});
92110

93111
describe('RabbitMQ plugin event handler', () => {

0 commit comments

Comments
 (0)