Skip to content

Commit 717a848

Browse files
test(utils): add edge case tests for format()
1 parent 895b769 commit 717a848

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

js/utils/__tests__/utils.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,5 +292,13 @@ describe("Utility Functions (logic-only)", () => {
292292
const result = format("Static text", {});
293293
expect(result).toBe("Static text");
294294
});
295+
it("should return empty string for missing nested property", () => {
296+
const result = format("User: {user.age}", { user: { name: "Alice" } });
297+
expect(result).toBe("User: ");
298+
});
299+
it("should return original string if no placeholders exist", () => {
300+
const result = format("Hello world", { name: "User" });
301+
expect(result).toBe("Hello world");
302+
});
295303
});
296304
});

0 commit comments

Comments
 (0)