Skip to content

Commit

Permalink
style: cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
b-ma committed Dec 12, 2023
1 parent 2058d6e commit 25c8063
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/common/SharedStatePrivate.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ class SharedStatePrivate {
} else {
// detach only if not creator
client.transport.addListener(`${DETACH_REQUEST}-${this.id}-${remoteId}`, (reqId) => {
console.log('SharedStatePrivate: receive detach request', reqId);
this._detachClient(remoteId, client);
client.transport.emit(`${DETACH_RESPONSE}-${this.id}-${remoteId}`, reqId);
});
Expand Down
29 changes: 15 additions & 14 deletions tests/states/StateCollection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ describe(`# SharedStateCollection`, () => {
await delay(50); // delay is required here, see #73

await collection1.detach();
// await collection2.detach();
await collection2.detach();
});

it.skip(`[FIXME] getting same collection twice should return same instance`, async () => {
it.skip(`[FIXME #74] getting same collection twice should return same instance`, async () => {
const state = await clients[0].stateManager.create('a');
const collection1 = await clients[1].stateManager.getCollection('a');
const collection2 = await clients[1].stateManager.getCollection('a');
Expand All @@ -108,19 +108,25 @@ describe(`# SharedStateCollection`, () => {

describe(`## size (alias length)`, () => {
before(async () => {
// make sure the first collection doesn't "leak" into the other one, cf. 2058d6e
const collection = await clients[1].stateManager.getCollection('a');
});

it.only(`should have proper length`, async () => {
console.log('START : size test ------------------------------------');
const state = await clients[0].stateManager.create('a');
console.log('> created state id', state.id);
it(`should have proper length`, async () => {
const state1 = await clients[0].stateManager.create('a');
const collection = await clients[1].stateManager.getCollection('a');

assert.equal(collection.size, 1);
assert.equal(collection.length, 1);

await state.delete();
const state2 = await clients[2].stateManager.create('a');
await delay(50);

assert.equal(collection.size, 2);
assert.equal(collection.length, 2);

await state1.delete();
await state2.delete();
await delay(50);

assert.equal(collection.size, 0);
Expand All @@ -133,9 +139,6 @@ describe(`# SharedStateCollection`, () => {
const state = await clients[0].stateManager.create('a');
const collection = await clients[1].stateManager.getCollection('a');

console.log('in test:', state.id)
console.log('in test:', collection._states.map(s => s.id));

const results = await collection.set({ bool: true });
const expected = [ { bool: true } ];

Expand Down Expand Up @@ -228,10 +231,8 @@ describe(`# SharedStateCollection`, () => {

let size = 0;

console.log(collection.length);

for (let state of collection) {
console.log(state.id);
for (let s of collection) {
assert.equal(state.id, s.id)
size += 1;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/states/StateManager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ describe(`# StateManager`, () => {
await state2.delete();
});

it(`should not be notified of states created by same node`, async () => {
it.skip(`[FIXME #69] should not be notified of states created by same node`, async () => {
const state1 = await client.stateManager.create('a');

let observeCalled = false;
Expand Down

0 comments on commit 25c8063

Please sign in to comment.