Skip to content

Commit

Permalink
fix 1 test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalmi committed Sep 6, 2023
1 parent d7f6d66 commit 23074bd
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/js/state/Node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 78,24 @@ describe('Node', () => {
it('should return if the data was pre-existing in an adapter', async () => {
const adapter = new MemoryAdapter();
const node = new Node({ id: 'user', adapters: [adapter] });

let val = await new Promise((resolve) => {
adapter.get('user', resolve);
});
expect(val).toBe(undefined);

await node.put({ name: 'Snowden', age: 30 });

val = await new Promise((resolve) => {
adapter.get('user', resolve);
});
expect(val).toBe(DIR_VALUE);

const node2 = new Node({ id: 'user', adapters: [adapter] });
const result = await node2.once();
expect(result).toEqual({ name: 'Snowden', age: 30 });
const name = await node2.get('name').once();
expect(name).toEqual('Snowden');
const age = await node2.get('age').once();
expect(age).toEqual(30);
});
});

Expand Down

0 comments on commit 23074bd

Please sign in to comment.