2025-02-16 11:42:14 +02:00
|
|
|
import { describe, expect, it } from "vitest";
|
2025-05-08 18:51:37 +03:00
|
|
|
import { readThemesFromFileSystem } from "./code_block_theme.js";
|
2025-02-16 11:42:14 +02:00
|
|
|
|
|
|
|
import themeNames from "./code_block_theme_names.json" with { type: "json" };
|
2025-05-08 18:51:37 +03:00
|
|
|
import path = require("path");
|
2025-02-16 11:42:14 +02:00
|
|
|
|
|
|
|
describe("Code block theme", () => {
|
|
|
|
it("all themes are mapped", () => {
|
2025-05-08 18:51:37 +03:00
|
|
|
const themes = readThemesFromFileSystem(path.join(__dirname, "../../node_modules/@highlightjs/cdn-assets/styles"));
|
2025-02-16 11:42:14 +02:00
|
|
|
|
|
|
|
const mappedThemeNames = new Set(Object.values(themeNames));
|
|
|
|
const unmappedThemeNames = new Set<string>();
|
|
|
|
|
|
|
|
for (const theme of themes) {
|
|
|
|
if (!mappedThemeNames.has(theme.title)) {
|
|
|
|
unmappedThemeNames.add(theme.title);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(unmappedThemeNames.size, `Unmapped themes: ${Array.from(unmappedThemeNames).join(", ")}`).toBe(0);
|
|
|
|
});
|
|
|
|
});
|