Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e9ff80828 | |||
| 0e1f99639f |
@@ -200,11 +200,15 @@ async function main() {
|
|||||||
for (const doc of searchIndex as { slug: string; sourceSlug: string }[]) {
|
for (const doc of searchIndex as { slug: string; sourceSlug: string }[]) {
|
||||||
assert.ok(!doc.slug.split("/").some((part) => /^\d+-/.test(part)), doc.slug);
|
assert.ok(!doc.slug.split("/").some((part) => /^\d+-/.test(part)), doc.slug);
|
||||||
const legacy = await request(`/docs/${doc.sourceSlug}?from=legacy`, { headers });
|
const legacy = await request(`/docs/${doc.sourceSlug}?from=legacy`, { headers });
|
||||||
|
assert.ok(legacy.headers.get("cache-control")?.includes("no-store"));
|
||||||
|
if (doc.sourceSlug === doc.slug) {
|
||||||
|
assert.equal(legacy.status, 200, doc.sourceSlug);
|
||||||
|
} else {
|
||||||
assert.equal(legacy.status, 308, doc.sourceSlug);
|
assert.equal(legacy.status, 308, doc.sourceSlug);
|
||||||
const destination = new URL(legacy.headers.get("location")!, base);
|
const destination = new URL(legacy.headers.get("location")!, base);
|
||||||
assert.equal(destination.pathname, `/docs/${doc.slug}`);
|
assert.equal(destination.pathname, `/docs/${doc.slug}`);
|
||||||
assert.equal(destination.searchParams.get("from"), "legacy");
|
assert.equal(destination.searchParams.get("from"), "legacy");
|
||||||
assert.ok(legacy.headers.get("cache-control")?.includes("no-store"));
|
}
|
||||||
}
|
}
|
||||||
const routes = ["/", ...searchIndex.map((doc: { slug: string }) => `/docs/${doc.slug}`)];
|
const routes = ["/", ...searchIndex.map((doc: { slug: string }) => `/docs/${doc.slug}`)];
|
||||||
const raw = await request("/api/documents/source?slug=endor/endor-purpose-draft", { headers });
|
const raw = await request("/api/documents/source?slug=endor/endor-purpose-draft", { headers });
|
||||||
|
|||||||
Reference in New Issue
Block a user