mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 04:53:26 +00:00
WSConnection is not a singleton anymore
This commit is contained in:
@@ -17,7 +17,7 @@ define([
|
||||
this.session.subscribe = sinon.spy();
|
||||
this.session.unsubscribe = sinon.spy();
|
||||
|
||||
this.wsConnection = connection.getInstance();
|
||||
this.wsConnection = connection;
|
||||
var $this = this;
|
||||
var cbSuccess = function (session) {
|
||||
$this.wsConnection.setSession($this.session);
|
||||
@@ -29,6 +29,10 @@ define([
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
this.wsConnection.close();
|
||||
});
|
||||
|
||||
it("should have a session", function () {
|
||||
this.wsConnection.connect();
|
||||
assert.ok(this.wsConnection.hasSession());
|
||||
@@ -48,12 +52,15 @@ define([
|
||||
});
|
||||
|
||||
it("should not connect anymore after first connect", function () {
|
||||
var throws = false;
|
||||
this.wsConnection.connect();
|
||||
ab.connect = sinon.spy();
|
||||
this.wsConnection.connect();
|
||||
this.wsConnection.connect();
|
||||
this.wsConnection.connect();
|
||||
expect(ab.connect.should.have.callCount(0)).to.be.ok;
|
||||
try {
|
||||
this.wsConnection.connect();
|
||||
} catch (e) {
|
||||
throws = true;
|
||||
}
|
||||
|
||||
assert.ok(throws);
|
||||
});
|
||||
|
||||
it("should call session subscribe once", function () {
|
||||
|
Reference in New Issue
Block a user