d9f13e89c6
* move 2023.7 to 2023.8 Signed-off-by: Jens Langhammer <jens@goauthentik.io> * move version dropdown from navbar to sidebar, and only have it on applicable sites Signed-off-by: Jens Langhammer <jens@goauthentik.io> * remove title instead of just hiding it Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix some styling for the mobile navbar sidebar Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add social image Signed-off-by: Jens Langhammer <jens@goauthentik.io> * Optimised images with calibre/image-actions * fix website tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: authentik-automation[bot] <135050075+authentik-automation[bot]@users.noreply.github.com>
59 lines
2 KiB
JavaScript
59 lines
2 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert";
|
|
import sidebar from "../sidebarsIntegrations.js";
|
|
import glob from "glob";
|
|
|
|
const getSidebarItems = () => {
|
|
const allItems = [];
|
|
const mapper = (category) => {
|
|
if (!category.items) {
|
|
return;
|
|
}
|
|
category.items.forEach((item) => {
|
|
if (item.constructor === String) {
|
|
allItems.push(item);
|
|
} else {
|
|
mapper(item);
|
|
}
|
|
});
|
|
};
|
|
sidebar.integrations.forEach(mapper);
|
|
return allItems.sort();
|
|
};
|
|
|
|
test("ensure all services have a sidebar entry", (t) => {
|
|
// All services in the sidebar
|
|
const services = getSidebarItems()
|
|
.filter((entry) => entry.startsWith("services/"))
|
|
.map((entry) => entry.replace("/index", ""))
|
|
.map((entry) => entry.replace("services/", ""));
|
|
const servicesFiles = glob
|
|
.sync("integrations/**/*.+(md|mdx)")
|
|
.filter((entry) => entry.startsWith("integrations/services/"))
|
|
.map((entry) => entry.replace("integrations/services/", ""))
|
|
.map((entry) => entry.replace(/\/index\.mdx?/, ""))
|
|
.filter((entry) => entry !== "index.mdx")
|
|
.sort();
|
|
servicesFiles.forEach((file, idx) => {
|
|
assert.strictEqual(file, services[idx]);
|
|
});
|
|
});
|
|
|
|
test("ensure all sources have a sidebar entry", (t) => {
|
|
// All sources in the sidebar
|
|
const sources = getSidebarItems()
|
|
.filter((entry) => entry.startsWith("sources/"))
|
|
.map((entry) => entry.replace("/index", ""))
|
|
.map((entry) => entry.replace("sources/", ""));
|
|
const sourceFiles = glob
|
|
.sync("integrations/**/*.+(md|mdx)")
|
|
.filter((entry) => entry.startsWith("integrations/sources/"))
|
|
.map((entry) => entry.replace("integrations/sources/", ""))
|
|
.map((entry) => entry.replace(/\/index\.mdx?/, ""))
|
|
.map((entry) => entry.replace(".md", ""))
|
|
.sort();
|
|
sourceFiles.forEach((file, idx) => {
|
|
assert.strictEqual(file, sources[idx]);
|
|
});
|
|
});
|