Skip to content

Commit 39344c8

Browse files
committed
test(websockets): fix expect that does not execute
1 parent 36d5a81 commit 39344c8

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

packages/websockets/test/web-sockets-controller.spec.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('WebSocketsController', () => {
8989
gateway,
9090
handlers,
9191
server,
92-
hookServerToProperties: sinon.SinonSpy,
92+
assignServerToProperties: sinon.SinonSpy,
9393
subscribeEvents: sinon.SinonSpy;
9494

9595
beforeEach(() => {
@@ -104,14 +104,15 @@ describe('WebSocketsController', () => {
104104
mockExplorer.expects('explore').returns(handlers);
105105
mockProvider.expects('scanForSocketServer').returns(server);
106106

107-
hookServerToProperties = sinon.spy();
107+
assignServerToProperties = sinon.spy();
108108
subscribeEvents = sinon.spy();
109-
(instance as any).hookServerToProperties = hookServerToProperties;
109+
(instance as any).assignServerToProperties = assignServerToProperties;
110110
(instance as any).subscribeEvents = subscribeEvents;
111111
});
112-
it('should call "hookServerToProperties" with expected arguments', () => {
112+
it('should call "assignServerToProperties" with expected arguments', () => {
113113
instance.subscribeToServerEvents(gateway, namespace, port, '');
114-
expect(hookServerToProperties.calledWith(gateway, server.server));
114+
expect(assignServerToProperties.calledWith(gateway, server.server)).to.be
115+
.true;
115116
});
116117
it('should call "subscribeEvents" with expected arguments', () => {
117118
instance.subscribeToServerEvents(gateway, namespace, port, '');
@@ -321,9 +322,9 @@ describe('WebSocketsController', () => {
321322
it('should returns Promise<Observable>', async () => {
322323
const value = 100;
323324
expect(
324-
await (await instance.pickResult(
325-
Promise.resolve(Promise.resolve(value)),
326-
)).toPromise(),
325+
await (
326+
await instance.pickResult(Promise.resolve(Promise.resolve(value)))
327+
).toPromise(),
327328
).to.be.eq(100);
328329
});
329330
});
@@ -332,9 +333,9 @@ describe('WebSocketsController', () => {
332333
it('should returns Promise<Observable>', async () => {
333334
const value = 100;
334335
expect(
335-
await (await instance.pickResult(
336-
Promise.resolve(of(value)),
337-
)).toPromise(),
336+
await (
337+
await instance.pickResult(Promise.resolve(of(value)))
338+
).toPromise(),
338339
).to.be.eq(100);
339340
});
340341
});
@@ -343,9 +344,9 @@ describe('WebSocketsController', () => {
343344
it('should returns Promise<Observable>', async () => {
344345
const value = 100;
345346
expect(
346-
await (await instance.pickResult(
347-
Promise.resolve(value),
348-
)).toPromise(),
347+
await (
348+
await instance.pickResult(Promise.resolve(value))
349+
).toPromise(),
349350
).to.be.eq(100);
350351
});
351352
});

0 commit comments

Comments
 (0)