-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor(test): monogDB * refactor(test): mysql * refactor(test): redis * refactor(test):psql * refactor(test): kafkajs * refactor(test): amqp * refactor(test): basic tests * test: adding unit test for isKnownServiceType
- Loading branch information
Showing
23 changed files
with
334 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
const assert = require('assert'); | ||
const path = require('path'); | ||
const { after, before, describe, it } = require('mocha'); | ||
const bindings = require('../../index.js'); | ||
|
||
const amqBindingData = { | ||
host: 'test.domain.com', | ||
password: 'pass1', | ||
port: '1234', | ||
provider: 'amqp', | ||
type: 'amqp', | ||
username: 'user1' | ||
}; | ||
|
||
const rabbitmqBindingsMappedForRhea = { | ||
host: 'test.domain.com', | ||
password: 'pass1', | ||
port: 1234, | ||
provider: 'rabbitmq', | ||
type: 'rabbitmq', | ||
username: 'user1' | ||
}; | ||
|
||
const amqBindingsMappedForRhea = { | ||
host: 'test.domain.com', | ||
password: 'pass1', | ||
port: '1234', | ||
provider: 'amqp', | ||
type: 'amqp', | ||
username: 'user1' | ||
}; | ||
|
||
describe('AMQ', () => { | ||
let env; | ||
before(() => { | ||
env = process.env; | ||
process.env = { SERVICE_BINDING_ROOT: path.join(__dirname, 'bindings') }; | ||
}); | ||
|
||
describe('rhea on amqp-bindings', () => { | ||
const id = 'amqp-bindings'; | ||
it('Default behaviour', () => { | ||
const binding = bindings.getBinding('AMQP', 'rhea', { id }); | ||
assert(binding); | ||
assert.deepEqual(binding, amqBindingsMappedForRhea); | ||
}); | ||
it('Does NOT Remove Unmapped Values', () => { | ||
const binding = bindings.getBinding('AMQP', 'rhea', { | ||
removeUnmapped: false, | ||
id | ||
}); | ||
assert(binding); | ||
assert.deepEqual(binding, amqBindingsMappedForRhea); | ||
}); | ||
it('Remove Unmapped Values', () => { | ||
const binding = bindings.getBinding('AMQP', 'rhea', { | ||
removeUnmapped: true, | ||
id | ||
}); | ||
assert(binding); | ||
assert.deepEqual(binding, amqBindingsMappedForRhea); | ||
}); | ||
}); | ||
describe('rhea on rabbitmq-bindings', () => { | ||
const id = 'rabbitmq-bindings'; | ||
it('Default behaviour', () => { | ||
const binding = bindings.getBinding('AMQP', 'rhea', { id }); | ||
assert(binding); | ||
assert.deepEqual(binding, rabbitmqBindingsMappedForRhea); | ||
}); | ||
it('Does NOT Remove Unmapped Values', () => { | ||
const binding = bindings.getBinding('AMQP', 'rhea', { | ||
removeUnmapped: false, | ||
id | ||
}); | ||
assert(binding); | ||
assert.deepEqual(binding, rabbitmqBindingsMappedForRhea); | ||
}); | ||
it('Remove Unmapped Values', () => { | ||
const binding = bindings.getBinding('AMQP', 'rhea', { | ||
removeUnmapped: true, | ||
id | ||
}); | ||
assert(binding); | ||
assert.deepEqual(binding, rabbitmqBindingsMappedForRhea); | ||
}); | ||
}); | ||
describe('rhea passing amq bindng data as parameter.', () => { | ||
it('Default behaviour', () => { | ||
const binding = bindings.getBinding('AMQP', 'rhea', { bindingData: amqBindingData }); | ||
assert(binding); | ||
assert.deepEqual(binding, amqBindingsMappedForRhea); | ||
}); | ||
it('Do NOT Remove Unmapped Values', () => { | ||
const binding = bindings.getBinding('AMQP', 'rhea', { | ||
bindingData: amqBindingData, | ||
removeUnmapped: false | ||
}); | ||
assert(binding); | ||
assert.deepEqual(binding, amqBindingsMappedForRhea); | ||
}); | ||
it('Remove Unmapped Values', () => { | ||
const binding = bindings.getBinding('AMQP', 'rhea', { | ||
bindingData: amqBindingData, | ||
removeUnmapped: true | ||
}); | ||
assert(binding); | ||
assert.deepEqual(binding, amqBindingsMappedForRhea); | ||
}); | ||
}); | ||
after(() => { | ||
process.env = env; | ||
}); | ||
}); |
Oops, something went wrong.