Skip to content

Commit

Permalink
fix test in bun
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeistrich committed Jul 1, 2024
1 parent 70e6e08 commit edb4516
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/persist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ describe('isSyncEnabled', () => {
const obs$ = observable<Record<string, { id: string; test: string }>>();
const ev$ = event();
let gets = 0;
let sets = 0;
const sets$ = observable(0);
const state$ = syncObservable(obs$, {
get: () => {
gets++;
Expand All @@ -1227,7 +1227,7 @@ describe('isSyncEnabled', () => {
};
},
set: () => {
sets++;
sets$.set((v) => v + 1);
},
} as SyncedOptions);

Expand All @@ -1238,20 +1238,20 @@ describe('isSyncEnabled', () => {
},
});
expect(gets).toEqual(1);
expect(sets).toEqual(0);
expect(sets$.get()).toEqual(0);

obs$.id1.test.set('hello');

await promiseTimeout(0);
await when(() => sets$.get() === 1);

expect(gets).toEqual(1);
expect(sets).toEqual(1);
expect(sets$.get()).toEqual(1);

ev$.fire();
obs$.get();

expect(gets).toEqual(2);
expect(sets).toEqual(1);
expect(sets$.get()).toEqual(1);

state$.isSyncEnabled.set(false);

Expand All @@ -1260,12 +1260,12 @@ describe('isSyncEnabled', () => {
await promiseTimeout(0);

expect(gets).toEqual(2);
expect(sets).toEqual(1);
expect(sets$.get()).toEqual(1);

ev$.fire();

expect(gets).toEqual(2);
expect(sets).toEqual(1);
expect(sets$.get()).toEqual(1);
});
});
describe('synced is observer', () => {
Expand Down

0 comments on commit edb4516

Please sign in to comment.