From fb5f3cbe83c5c0061035799adb2832360687a863 Mon Sep 17 00:00:00 2001 From: Sonali Singh Date: Thu, 17 Oct 2024 16:41:23 +0100 Subject: [PATCH] test: add tests for default icons --- src/components/atoms/OakIcon/OakIcon.test.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/atoms/OakIcon/OakIcon.test.tsx b/src/components/atoms/OakIcon/OakIcon.test.tsx index 547009a5..c8fc7112 100644 --- a/src/components/atoms/OakIcon/OakIcon.test.tsx +++ b/src/components/atoms/OakIcon/OakIcon.test.tsx @@ -75,6 +75,17 @@ describe("generateOakIconURL", () => { expect(generateOakIconURL("home")).toBe( "https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699887218/icons/gvqxjxcw07ei2kkmwnes.svg", ); - expect(generateOakIconURL("banana-sandwich")).toBe(undefined); + }); + + it("is returns url for question mark when the string is not a valid icon name", () => { + expect(generateOakIconURL("banana-sandwich")).toBe( + "https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1706872277/icons/question-mark.svg", + ); + }); + + it("is returns url for books when the string is not a valid subject icon name", () => { + expect(generateOakIconURL("subject-potions")).toBe( + "https://res.cloudinary.com/mock-cloudinary-cloud/image/upload/v1699953657/icons/hz4l3iq6i68kazvkvorq.svg", + ); }); });