mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
32 lines
942 B
TypeScript
32 lines
942 B
TypeScript
import { expect } from 'chai';
|
|
import { ClientsContainer } from '../container';
|
|
|
|
describe('ClientsContainer', () => {
|
|
let instance: ClientsContainer;
|
|
beforeEach(() => {
|
|
instance = new ClientsContainer();
|
|
});
|
|
describe('getAllClients', () => {
|
|
it('should return array of clients', () => {
|
|
const clients = [1, 2, 3];
|
|
(instance as any).clients = clients;
|
|
expect(instance.getAllClients()).to.be.eql(clients);
|
|
});
|
|
});
|
|
describe('addClient', () => {
|
|
it('should push client into clients array', () => {
|
|
const client = 'test';
|
|
instance.addClient(client as any);
|
|
expect(instance.getAllClients()).to.be.deep.equal([client]);
|
|
});
|
|
});
|
|
describe('clear', () => {
|
|
it('should remove all clients', () => {
|
|
const clients = [1, 2, 3];
|
|
(instance as any).clients = clients;
|
|
instance.clear();
|
|
expect(instance.getAllClients()).to.be.deep.equal([]);
|
|
});
|
|
});
|
|
});
|