Skip to content

Commit

Permalink
style(json-crdt): 💄 run Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Sep 24, 2024
1 parent f867ee5 commit bbb955d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/json-crdt/model/__tests__/Model.applyLocalPatch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,40 @@ describe('.applyLocalPatch()', () => {
const doc1 = Model.create(schema);
const doc2 = doc1.clone();
const time1 = doc1.clock.time;
doc1.s.toApi().set({'a': 1});
doc1.s.toApi().set({a: 1});
const time2 = doc1.clock.time;
doc2.s.toApi().set({'b': 2});
doc2.s.toApi().set({b: 2});
const time3 = doc1.clock.time;
expect(time2 > time1).toBe(true);
expect(time2).toBe(time3);
const patch = doc2.api.flush()!;
const time4 = patch.getId()!.time;
expect(time4).toBe(time1);
expect(doc1.view()).toEqual({'a': 1});
expect(doc1.view()).toEqual({a: 1});
doc1.applyLocalPatch(patch);
const time5 = doc1.clock.time;
expect(time5 > time3).toBe(true);
expect(doc1.view()).toEqual({'a': 1, 'b': 2});
expect(doc1.view()).toEqual({a: 1, b: 2});
});

test('does not advance clock of a patch of a fork', () => {
const schema = s.obj({});
const doc1 = Model.create(schema);
const doc2 = doc1.fork();
const time1 = doc1.clock.time;
doc1.s.toApi().set({'a': 1});
doc1.s.toApi().set({a: 1});
const time2 = doc1.clock.time;
doc2.s.toApi().set({'b': 2});
doc2.s.toApi().set({b: 2});
const time3 = doc1.clock.time;
expect(time2 > time1).toBe(true);
expect(time2).toBe(time3);
const patch = doc2.api.flush()!;
const time4 = patch.getId()!.time;
expect(time4).toBe(time1);
expect(doc1.view()).toEqual({'a': 1});
expect(doc1.view()).toEqual({a: 1});
doc1.applyLocalPatch(patch);
const time5 = doc1.clock.time;
expect(time5).toBe(time3);
expect(doc1.view()).toEqual({'a': 1, 'b': 2});
expect(doc1.view()).toEqual({a: 1, b: 2});
});
});

0 comments on commit bbb955d

Please sign in to comment.