Started refactoring, added prettier and checks and reformatted project, added cspell and checks and custom project words, beginning of robotic oceanographic surface sampler content
Some checks failed
Build and Test - Staging / test (pull_request) Failing after 2m35s
Build and Test - Staging / build_and_push (pull_request) Has been skipped
Build and Test - Staging / deploy_staging (pull_request) Has been skipped

This commit is contained in:
2025-11-30 15:48:36 -08:00
parent 67eb549ed2
commit 4a59e44716
83 changed files with 3246 additions and 1643 deletions

View File

@@ -1,39 +1,45 @@
import {expect, test} from "vitest";
import { expect, test } from "vitest";
import {siteLayout, getPaths} from "@data/site-layout.ts";
import { siteLayout, getPaths } from "@data/site-layout.ts";
export const setDifference = <T>(a: Set<T>, b: Set<T>) =>
new Set([...a].filter(x => !b.has(x)));
new Set([...a].filter((x) => !b.has(x)));
// Paths that should be known to Astro statically
const astroStaticPaths = new Set(
Object.keys(import.meta.glob("/src/pages/**/*.astro"))
.map((path) =>
path
.replace("/src/pages", "")
.replace(/index\.astro$/, "")
.replace(/\.astro$|\.md$/, "")
.replace(/\/$/, "")
|| "/"
));
Object.keys(import.meta.glob("/src/pages/**/*.astro")).map(
(path) =>
path
.replace("/src/pages", "")
.replace(/index\.astro$/, "")
.replace(/\.astro$|\.md$/, "")
.replace(/\/$/, "") || "/",
),
);
// Paths that exist in the site layout
const siteLayoutPaths = new Set([...getPaths(siteLayout), ...getPaths(siteLayout, [], true)]);
const siteLayoutPaths = new Set([
...getPaths(siteLayout),
...getPaths(siteLayout, [], true),
]);
test('Astro Paths Not Empty', () => {
expect(astroStaticPaths).not.toHaveLength(0);
test("Astro Paths Not Empty", () => {
expect(astroStaticPaths).not.toHaveLength(0);
});
test('Site Layout Paths Not Empty', () => {
expect(siteLayoutPaths).not.toHaveLength(0);
test("Site Layout Paths Not Empty", () => {
expect(siteLayoutPaths).not.toHaveLength(0);
});
test('Pages Missing from Site Layout', () => {
const astroNotLayoutPaths = setDifference(astroStaticPaths, siteLayoutPaths);
expect(astroNotLayoutPaths).toHaveLength(0);
test("Pages Missing from Site Layout", () => {
const astroNotLayoutPaths = setDifference(astroStaticPaths, siteLayoutPaths);
expect(astroNotLayoutPaths).toHaveLength(0);
});
test('Pages Missing from Astro Paths', () => {
const siteLayoutNotAstroPaths = setDifference(siteLayoutPaths, astroStaticPaths);
expect(siteLayoutNotAstroPaths).toHaveLength(0);
test("Pages Missing from Astro Paths", () => {
const siteLayoutNotAstroPaths = setDifference(
siteLayoutPaths,
astroStaticPaths,
);
expect(siteLayoutNotAstroPaths).toHaveLength(0);
});