Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
grgbkr committed Dec 5, 2023
1 parent bf3caf0 commit 255f16d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/reflect-yjs/src/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,15 @@ suite('Provider', () => {
test('subscribes at construction time', () => {
const reflect = fakeReflect();
new Provider(reflect, 'test', new Doc());
expect(reflect.subscribe).toHaveBeenCalledTimes(2);
expect(reflect.subscribe).toHaveBeenCalledTimes(1);
});
});

test('destroy unsubscribes', () => {
const reflect = new FakeReflect();
reflect.subscribe.mockClear();
const unsubscribe1 = vi.fn();
const unsubscribe2 = vi.fn();
reflect.subscribe
.mockImplementationOnce(() => unsubscribe1)
.mockImplementationOnce(() => unsubscribe2);
const unsubscribe = vi.fn();
reflect.subscribe.mockImplementationOnce(() => unsubscribe);

const p = new Provider(
reflect as unknown as Reflect<Mutators>,
Expand All @@ -73,7 +70,6 @@ suite('Provider', () => {
);

p.destroy();
expect(unsubscribe1).toHaveBeenCalledTimes(1);
expect(unsubscribe2).toHaveBeenCalledTimes(1);
expect(unsubscribe).toHaveBeenCalledTimes(1);
});
});

0 comments on commit 255f16d

Please sign in to comment.