Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Add a generateNavPaths test
Browse files Browse the repository at this point in the history
  • Loading branch information
ptgott committed Jul 1, 2024
1 parent 8393641 commit b64b632
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions uvu-tests/config-docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,59 @@ Suite("Ensures that URLs correspond to docs pages", () => {
assert.equal(actual, expected);
});

Suite("generateNavPaths", () => {
const files = {
"/docs/pages/database-access/introduction.mdx": `---
title: Protect Databases with Teleport
---`,
"/docs/pages/database-access/guides.mdx": `---
title: Database Access Guides
---`,
"/docs/pages/database-access/guides/postgres.mdx": `---
title: Postgres Guide
---`,
"/docs/pages/database-access/guides/mysql.mdx": `---
title: MySQL Guide
---`,
"/docs/pages/application-access/introduction.mdx": `---
title: Protect Applications with Teleport
---`,
"/docs/pages/application-access/guides.mdx": `---
title: Application Access Guides
---`,
"/docs/pages/application-access/guides/http.mdx": `---
title: HTTP App Guide
---`,
"/docs/pages/application-access/guides/tcp.mdx": `---
title: TCP App Guide
---`,
};

const expected = [
{
title: "Protect Databases with Teleport",
slug: "/docs/database-access/introduction/",
},
{
title: "Dabase Access Guides",
slug: "/database-access/guides/",
entries: [
{
title: "Postgres Guide",
slug: "/database-access/guides/postgres/",
},
{
title: "MySQL Guide",
slug: "/database-access/guides/mysql/",
},
],
},
];

const vol = Volume.fromJSON(files);
const fs = createFsFromVolume(vol);
const actual = generateNavPaths(fs, "/docs/pages/database-access");
assert.equal(actual, expected);
});

Suite.run();

0 comments on commit b64b632

Please sign in to comment.