Files
authentik/website/test/sidebarIntegrations.mjs
Teffen Ellis a4f92f5e30 Prep for monorepo use.
web: Update config.

Flesh out build.

Fix issue surrounding build.

Fix paths.

Update workspaces.

Fix build steps.

Apply linter. Temporarily remove problem rules.

Add ignorefile. Prep for formatting.

Lint website.

Lint web, repo packages.

Refine Prettier usage. Fix imports.

Tidy build.

Move node ignore files.

Remove unused.

Update job. Fix lint step.

Build before compiling.

Use root for paths.

Fix issues surrounding import references, types, package names.

Fix build paths.

Tidy.

Enforce prefix.

Apply prefixes to imports.

Enable linter, compiler, etc.

Fix references. Update names.

Mark optional.

Revise mounts. Fix build order.

Update package.json.

Ignore all docusaurus.

Fix paths, types.

Clean up build steps, names.

Fix paths.

website: Fix nested paragraphs build warning.

web: Enforce module resolution.

Use consistent LTS version.

Track Node version.

Use default resolution.

Test main entrypoint.

Fix Node v20 compatibility.

Add task names.

WIP: Fix styles.
2025-04-17 02:46:10 +02:00

79 lines
2.3 KiB
JavaScript

/**
* @file Test suite for the sidebar configuration of the authentik integrations.
*
* @todo Enforce types.
*/
import FastGlob from "fast-glob";
import assert from "node:assert";
import test from "node:test";
import sidebar from "../sidebarsIntegrations.mjs";
const getSidebarItems = () => {
/**
* @type {any[]}
*/
const allItems = [];
/**
*
* @param {any} category
*/
const mapper = (category) => {
if (!category.items) {
return;
}
category.items.forEach(
/**
*
* @param {any} item
*/
(item) => {
if (typeof item === "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 = FastGlob.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 = FastGlob.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]);
});
});