Skip to content

Commit 23d1280

Browse files
committed
add failing test for making sure assets are substituted
1 parent b293bfb commit 23d1280

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/staticalize.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,36 @@ describe("staticalize", () => {
187187

188188
await expect(exists("test/dist/assets/styles.css")).resolves.toEqual(true);
189189
});
190+
191+
it.skip("replaces references to absolute assets that have the sae host that we're scraping", async () => {
192+
const html = `
193+
<html>
194+
<head>
195+
<link rel="canonical" href="${host}"/>
196+
<link rel="alternate" href="${host}alt"/>
197+
</head>
198+
</html>
199+
`
200+
app.get("/", (c) =>
201+
c.html(html))
202+
.get("/alt", (c) => c.html(html))
203+
.get(...sitemap(["/"]));
204+
205+
await staticalize({
206+
base: new URL("https://fs.com"),
207+
host,
208+
dir: "test/dist",
209+
});
210+
211+
await expect(content("test/dist/index.html")).resolves.toEqual(`
212+
<html>
213+
<head>
214+
<link rel="canonical" href="https://fs.com/"/>
215+
<link rel="alternate" href="https://fs.com/alt"/>
216+
</head>
217+
</html>
218+
`);
219+
});
190220
});
191221

192222
async function content(path: string): Promise<string> {

0 commit comments

Comments
 (0)