Skip to content

Commit

Permalink
fix: update docs link for IP ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
ndv99 committed Feb 10, 2025
1 parent e58af1e commit 17303ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/base/docsUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const docsUrls = {
dhcp: "https://maas.io/docs/about-dhcp-in-maas",
ipmi: "https://maas.io/docs/reference-power-drivers#p-17434-ipmi",
ipRanges:
"https://maas.io/docs/how-to-customise-dhcp#p-9038-edit-delete-or-extend-ip-range",
"https://maas.io/docs/how-to-customise-maas-networks#p-9070-create-ips-and-ranges",
kvmIntroduction: "https://maas.io/docs/how-to-use-lxd-vms",
networkDiscovery:
"https://maas.io/docs/how-to-customise-maas-networks#p-9070-manage-network-discovery",
Expand Down
19 changes: 17 additions & 2 deletions tests/docs-links.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ import docsUrls from "../src/app/base/docsUrls";

const urls = Object.values(docsUrls);

const redirectErrorMessage = (url: string, location: string | null) => `
URL NEEDS TO BE UPDATED
-----------------------------
FROM:
${url}
TO:
https://maas.io${location}
`;

test.describe("loads the page", () => {
urls.forEach((url) => {
test(`${url}`, async () => {
Expand All @@ -16,9 +27,13 @@ test.describe("loads the page", () => {
test.describe("is a direct link", () => {
urls.forEach((url) => {
test(`${url}`, async () => {
// prevent auto redirect so we can get the HTTP 302 if present
const docsPage = fetch(url, { redirect: "manual" });
const resCode = await docsPage.then((res) => res.status);
expect(resCode).toBe(200);
const { status, headers } = await docsPage.then((res) => res);

expect(status, redirectErrorMessage(url, headers.get("location"))).toBe(
200
);
});
});
});

0 comments on commit 17303ef

Please sign in to comment.