You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
919 B
JavaScript

describe('Running `resetChannel`', function() {
var
ch,
v1Stub, v2Stub, cStub, rStub,
v, c, r,
ret;
beforeEach(function() {
ch = new Wreqr.Channel( 'test' );
v = ch.vent;
c = ch.commands;
r = ch.reqres;
v1Stub = sinon.spy( v, "off");
v2Stub = sinon.spy( v, "stopListening");
cStub = sinon.spy( c, "removeAllHandlers");
rStub = sinon.spy( r, "removeAllHandlers");
ret = ch.reset();
});
afterEach(function() {
v1Stub.restore();
v2Stub.restore();
cStub.restore();
rStub.restore();
});
it( 'should call the reset functions for each messaging system', function() {
expect( v1Stub ).toHaveBeenCalledOnce();
expect( v2Stub ).toHaveBeenCalledOnce();
expect( cStub ).toHaveBeenCalledOnce();
expect( rStub ).toHaveBeenCalledOnce();
});
it( 'should return the Channel', function() {
expect( ret ).toBe( ch );
});
});