Skip to content

Commit

Permalink
fix: constructor fix and logs removed from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanLewDev committed Aug 3, 2024
1 parent 46c9cf6 commit 26ccf49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/crdt/src/builtins/IPSet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class IPSet<T> {
// - an element exists in the IPSet if _counter[element] exists and is an odd number
// - otherwise the element doesn't exist in the IPSet

constructor(counters: Map<T, GCounter>) {
constructor(counters: Map<T, GCounter> = new Map()) {
this._counters = counters;
}

Expand Down
13 changes: 3 additions & 10 deletions packages/crdt/tests/IPSet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ describe("Infinite-phase set Tests", () => {
let set3: IPSet<number>;

beforeEach(() => {
set1 = new IPSet<string>(new Map());
set2 = new IPSet<number>(new Map());
set3 = new IPSet<number>(new Map());
set1 = new IPSet<string>();
set2 = new IPSet<number>();
set3 = new IPSet<number>();
});

test("Test Add Elements", () => {
Expand Down Expand Up @@ -70,10 +70,6 @@ describe("Infinite-phase set Tests", () => {
set3.remove(peerId, 1);
set3.add(peerId, 3);

console.log(
"Merging {1:1, 3:2, 5:3} and {1:2, 3:1} should yield {1:2, 3:2, 5:3}"
);

set2.merge(set3);
expect(set2).toStrictEqual(
new IPSet<number>(
Expand All @@ -92,9 +88,6 @@ describe("Infinite-phase set Tests", () => {
set3.add(peerId, 5);
set3.add(peerId, 7);

console.log(
"Merging {1:1, 3:1} and {5:1, 7:1} should yield {1:1, 3:1, 5:1, 7:1}"
);
set3.merge(set2);
expect(set3).toStrictEqual(
new IPSet<number>(
Expand Down

0 comments on commit 26ccf49

Please sign in to comment.