Skip to content

Commit

Permalink
object: improve flattenObject test
Browse files Browse the repository at this point in the history
  • Loading branch information
hbbio committed May 13, 2024
1 parent 96e64d1 commit 62cdf9c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ test("flattenObject", async () => {
const debug = new Debugger(sheet);
const proxy = new SheetProxy(sheet);

const l = cellify(proxy, { a: 1, b: 2, c: 3 });
const f = flattenObject(proxy, l);
await expect(f.get()).resolves.toEqual({ a: 1, b: 2, c: 3 });
expect(sheet.stats).toEqual({ count: 6, size: 6 }); // 3+1 array +1 sum +1 pointer
const obj = cellify(proxy, { a: 1, b: 2, c: 3 });
const f = flattenObject(proxy, obj);
await expect(f.consolidatedValue).resolves.toEqual({ a: 1, b: 2, c: 3 });
expect(sheet.stats).toEqual({ count: 6, size: 6 }); // 3+1 obj +1 flatten +1 pointer

await (await obj.consolidatedValue).a.set(4);
await expect(f.get()).resolves.toEqual({ a: 4, b: 2, c: 3 });
expect(sheet.stats).toEqual({ count: 6, size: 6 }); // unchanged
});

0 comments on commit 62cdf9c

Please sign in to comment.