| ... | @@ -1,11 +1,6 @@ | ... | @@ -1,11 +1,6 @@ |
| 1 | import { describe, expect, it } from "@effect/vitest"; | 1 | import { describe, expect, it } from "@effect/vitest"; |
| 2 | | 2 | |
| 3 | import { | 3 | import { faviconUrlForOrigin, toolActivityFaviconUrl } from "./favicon.ts"; |
| 4 | explicitFaviconUrl, | | |
| 5 | faviconUrlForOrigin, | | |
| 6 | faviconUrlForPage, | | |
| 7 | toolActivityFaviconUrl, | | |
| 8 | } from "./favicon.ts"; | | |
| 9 | | 4 | |
| 10 | describe("faviconUrlForOrigin", () => { | 5 | describe("faviconUrlForOrigin", () => { |
| 11 | it.each([ | 6 | it.each([ |
| ... | @@ -46,12 +41,12 @@ describe("faviconUrlForOrigin", () => { | ... | @@ -46,12 +41,12 @@ describe("faviconUrlForOrigin", () => { |
| 46 | ); | 41 | ); |
| 47 | }); | 42 | }); |
| 48 | | 43 | |
| 49 | describe("faviconUrlForPage", () => { | 44 | describe("toolActivityFaviconUrl", () => { |
| 50 | it("uses the page origin instead of a third-party favicon service", () => { | 45 | it("uses the page origin instead of a third-party favicon service", () => { |
| 51 | expect(faviconUrlForPage("https://example.com/docs/page?q=1")).toBe( | 46 | expect(toolActivityFaviconUrl({ pageUrl: "https://example.com/docs/page?q=1" }, "light")).toBe( |
| 52 | "https://example.com/favicon.ico", | 47 | "https://example.com/favicon.ico", |
| 53 | ); | 48 | ); |
| 54 | expect(faviconUrlForPage("http://localhost:5173/app")).toBe( | 49 | expect(toolActivityFaviconUrl({ pageUrl: "http://localhost:5173/app" }, "light")).toBe( |
| 55 | "http://localhost:5173/favicon.ico", | 50 | "http://localhost:5173/favicon.ico", |
| 56 | ); | 51 | ); |
| 57 | }); | 52 | }); |
| ... | @@ -86,7 +81,17 @@ describe("faviconUrlForPage", () => { | ... | @@ -86,7 +81,17 @@ describe("faviconUrlForPage", () => { |
| 86 | }); | 81 | }); |
| 87 | | 82 | |
| 88 | it("accepts provider-supplied image URLs but rejects extension URLs", () => { | 83 | it("accepts provider-supplied image URLs but rejects extension URLs", () => { |
| 89 | expect(explicitFaviconUrl("https://example.com/icon.png")).toBe("https://example.com/icon.png"); | 84 | expect( |
| 90 | expect(explicitFaviconUrl("chrome-extension://example/_favicon/")).toBeNull(); | 85 | toolActivityFaviconUrl( |
| | 86 | { pageUrl: "https://example.com/docs", faviconUrl: "https://example.com/icon.png" }, |
| | 87 | "light", |
| | 88 | ), |
| | 89 | ).toBe("https://example.com/icon.png"); |
| | 90 | expect( |
| | 91 | toolActivityFaviconUrl( |
| | 92 | { pageUrl: "https://example.com/docs", faviconUrl: "chrome-extension://example/_favicon/" }, |
| | 93 | "light", |
| | 94 | ), |
| | 95 | ).toBe("https://example.com/favicon.ico"); |
| 91 | }); | 96 | }); |
| 92 | }); | 97 | }); |