Skip to content

Commit bd88f01

Browse files
authored
fix: update docs link for IP ranges (#5608)
- Updated docs link for IP ranges - Added verbose error message for redirects
1 parent e58af1e commit bd88f01

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/app/base/docsUrls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const docsUrls = {
1414
dhcp: "https://maas.io/docs/about-dhcp-in-maas",
1515
ipmi: "https://maas.io/docs/reference-power-drivers#p-17434-ipmi",
1616
ipRanges:
17-
"https://maas.io/docs/how-to-customise-dhcp#p-9038-edit-delete-or-extend-ip-range",
17+
"https://maas.io/docs/how-to-customise-maas-networks#p-9070-create-ips-and-ranges",
1818
kvmIntroduction: "https://maas.io/docs/how-to-use-lxd-vms",
1919
networkDiscovery:
2020
"https://maas.io/docs/how-to-customise-maas-networks#p-9070-manage-network-discovery",

tests/docs-links.spec.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ import docsUrls from "../src/app/base/docsUrls";
33

44
const urls = Object.values(docsUrls);
55

6+
const redirectErrorMessage = (url: string, location: string | null) => `
7+
URL NEEDS TO BE UPDATED
8+
-----------------------------
9+
FROM:
10+
${url}
11+
12+
TO:
13+
https://maas.io${location}
14+
15+
`;
16+
617
test.describe("loads the page", () => {
718
urls.forEach((url) => {
819
test(`${url}`, async () => {
@@ -16,9 +27,13 @@ test.describe("loads the page", () => {
1627
test.describe("is a direct link", () => {
1728
urls.forEach((url) => {
1829
test(`${url}`, async () => {
30+
// prevent auto redirect so we can get the HTTP 302 if present
1931
const docsPage = fetch(url, { redirect: "manual" });
20-
const resCode = await docsPage.then((res) => res.status);
21-
expect(resCode).toBe(200);
32+
const { status, headers } = await docsPage.then((res) => res);
33+
34+
expect(status, redirectErrorMessage(url, headers.get("location"))).toBe(
35+
200
36+
);
2237
});
2338
});
2439
});

0 commit comments

Comments
 (0)