Skip to content

Commit

Permalink
test(websockets): add ood input on pickResult method
Browse files Browse the repository at this point in the history
  • Loading branch information
micalevisk committed Apr 23, 2022
1 parent 63b19d3 commit 98406df
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions packages/websockets/test/web-sockets-controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ describe('WebSocketsController', () => {
Promise.resolve(Promise.resolve(value)),
),
),
).to.be.eq(100);
).to.be.eq(value);
});
});

Expand All @@ -356,18 +356,29 @@ describe('WebSocketsController', () => {
await lastValueFrom(
await instance.pickResult(Promise.resolve(of(value))),
),
).to.be.eq(100);
).to.be.eq(value);
});
});

describe('is a value', () => {
describe('is an object that has the method `subscribe`', () => {
it('should return Promise<Observable>', async () => {
const value = { subscribe() {} };
expect(
await lastValueFrom(
await instance.pickResult(Promise.resolve(value)),
),
).to.equal(value);
});
});

describe('is an ordinary value', () => {
it('should return Promise<Observable>', async () => {
const value = 100;
expect(
await lastValueFrom(
await instance.pickResult(Promise.resolve(value)),
),
).to.be.eq(100);
).to.be.eq(value);
});
});
});
Expand Down

0 comments on commit 98406df

Please sign in to comment.