mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
test: add unit test
This commit is contained in:
@@ -113,11 +113,26 @@ describe('ServerNats', () => {
|
||||
[pattern]: messageHandler,
|
||||
});
|
||||
});
|
||||
it('should subscribe to each acknowledge patterns', () => {
|
||||
|
||||
it('should subscribe to every pattern', () => {
|
||||
server.bindEvents(natsClient);
|
||||
expect(subscribeSpy.calledWith(pattern)).to.be.true;
|
||||
});
|
||||
|
||||
it('should use a per pattern queue if provided', () => {
|
||||
const queue = 'test';
|
||||
untypedServer.messageHandlers = objectToMap({
|
||||
[pattern]: Object.assign(messageHandler, {
|
||||
extras: {
|
||||
queue,
|
||||
},
|
||||
}),
|
||||
});
|
||||
server.bindEvents(natsClient);
|
||||
const lastCall = subscribeSpy.lastCall;
|
||||
expect(lastCall.args[1].queue).to.be.eql(queue);
|
||||
});
|
||||
|
||||
it('should fill the subscriptions array properly', () => {
|
||||
server.bindEvents(natsClient);
|
||||
expect(server['subscriptions'].length).to.be.equals(1);
|
||||
|
||||
Reference in New Issue
Block a user