Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
feat: update ioc version
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossantos74 committed Mar 8, 2024
1 parent 8de4d71 commit cb02420
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"yargs": "^17.7.2"
},
"dependencies": {
"@superviz/socket-client": "1.2.0",
"@superviz/socket-client": "1.2.1",
"ably": "^1.2.45",
"bowser": "^2.11.0",
"bowser-jr": "^1.0.6",
Expand Down
28 changes: 10 additions & 18 deletions src/services/slot/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ describe('slot service', () => {
presence: {
on: jest.fn(),
get: jest.fn((callback) => {
callback({
presences: [],
});
callback([]);
}),
update: jest.fn(),
},
Expand Down Expand Up @@ -39,9 +37,7 @@ describe('slot service', () => {
presence: {
on: jest.fn(),
get: jest.fn((callback) => {
callback({
presences: [],
});
callback([]);
}),
update: jest.fn(),
},
Expand Down Expand Up @@ -74,9 +70,7 @@ describe('slot service', () => {
presence: {
on: jest.fn(),
get: jest.fn((callback) => {
callback({
presences: new Array(16).fill({}),
});
callback(new Array(16).fill({}));
}),
update: jest.fn(),
},
Expand All @@ -98,17 +92,15 @@ describe('slot service', () => {
presence: {
on: jest.fn(),
get: jest.fn((callback) => {
callback({
presences: [
{
data: {
slot: {
index: 0,
},
callback([
{
data: {
slot: {
index: 0,
},
},
],
});
},
]);
}),
update: jest.fn(),
},
Expand Down
8 changes: 4 additions & 4 deletions src/services/slot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ export class SlotService {
const slot = Math.floor(Math.random() * 16);

new Promise((resolve, reject) => {
this.room.presence.get((event: any) => {
if (!event.presences || !event.presences.length) resolve(false);
this.room.presence.get((presences) => {
if (!presences || !presences.length) resolve(false);

if (event.presences.length >= 16) {
if (presences.length >= 16) {
reject(new Error('[SuperViz] - No more slots available'));
return;
}

event.presences.forEach((presence: Socket.PresenceEvent<Participant>) => {
presences.forEach((presence: Socket.PresenceEvent<Participant>) => {
if (presence.id === this.participant.id) return;

if (presence.data?.slot?.index === slot) resolve(true);
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2481,10 +2481,10 @@
resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553"
integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==

"@superviz/socket-client@1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@superviz/socket-client/-/socket-client-1.2.0.tgz#091adb3aac2dfd9bc8c7d5bd6ec39fdb0929d7e6"
integrity sha512-1FyJC4wl7nSgHGlC/AduaxTosoM2v/CI5vy9Q5JlBpN3DA5rq1tNwmRB50OrXN/DHKQ0UPimcz1+wIL92Gc5vA==
"@superviz/socket-client@1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@superviz/socket-client/-/socket-client-1.2.1.tgz#9a4ceb9bc2c07361210756e66eb866991e8ceaed"
integrity sha512-8H9APdKPxyPncJmwTshu+VxzBxHCiLP/5TwAkWLnr/f5cPPsRxrm/7Ws51y1yiObz9bNkniwphER6qV4dUdCOw==
dependencies:
"@reactivex/rxjs" "^6.6.7"
debug "^4.3.4"
Expand Down

0 comments on commit cb02420

Please sign in to comment.