Skip to content

Commit

Permalink
non-zero size estimate (#5139)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpkane authored Nov 18, 2024
1 parent cb08bcc commit 9a5eb8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/packages/utilities/src/size-bytes-estimate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("sizeBytesEstimate tests", () => {
expect(sizeBytesEstimate("chars")).toBe(10);
});

test("non-objects return 0", () => {
expect(sizeBytesEstimate(() => null)).toBe(0);
test("non-objects return non-zero", () => {
expect(sizeBytesEstimate(() => null)).toBe(1);
});
});
3 changes: 2 additions & 1 deletion app/packages/utilities/src/size-bytes-estimate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ const sizer = (object: SizerTypes) => {
};

export default function sizeBytesEstimate(object: SizeTypes) {
return sizer(object);
// return value > 0;
return Math.max(sizer(object), 1);
}

0 comments on commit 9a5eb8e

Please sign in to comment.