Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
techfg authored and vernak2539 committed May 16, 2024
1 parent c94dab4 commit 1dbebae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,14 @@ describe("astroRehypeRelativeMarkdownLinks", () => {
await runValidationTest(context, { contentPath: "src" }));
});

describe("config option - basePath", () => {
describe("config option - base", () => {
test("should prefix base to output on file paths that exist", async () => {
const input = '<a href="./fixtures/test.md">foo</a>';
const { value: actual } = await rehype()
.use(testSetupRehype)
.use(astroRehypeRelativeMarkdownLinks, {
contentPath: "src",
basePath: "/testBase",
base: "/testBase",
})
.process(input);

Expand Down
14 changes: 7 additions & 7 deletions src/options.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@ describe("validateOptions", () => {
});
});

describe("basePath", () => {
test("should have expected basePath default", () => {
expectsValidOption({}, "basePath", defaultOptions.basePath);
describe("base", () => {
test("should have expected base default", () => {
expectsValidOption({}, "base", defaultOptions.base);
});

test("should be basePath value specified when provided", () => {
expectsValidOption({ basePath: "foobar" }, "basePath", "foobar");
test("should be base value specified when provided", () => {
expectsValidOption({ base: "foobar" }, "base", "foobar");
});

test("should fail when baesPath not a string", () => {
expectsZodError({ basePath: {} }, "invalid_type");
test("should fail when base not a string", () => {
expectsZodError({ base: {} }, "invalid_type");
});
});

Expand Down
8 changes: 4 additions & 4 deletions src/utils.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -206,31 +206,31 @@ describe("normaliseAstroOutputPath", () => {
describe("prefix base to path", () => {
test("base with no slashes", () => {
const actual = normaliseAstroOutputPath("/foo-testing-test", {
basePath: "base",
base: "base",
});

assert.equal(actual, "/base/foo-testing-test");
});

test("base with slash at start", () => {
const actual = normaliseAstroOutputPath("/foo-testing-test", {
basePath: "/base",
base: "/base",
});

assert.equal(actual, "/base/foo-testing-test");
});

test("base with slash at end", () => {
const actual = normaliseAstroOutputPath("/foo-testing-test", {
basePath: "base/",
base: "base/",
});

assert.equal(actual, "/base/foo-testing-test");
});

test("base with slash at start and end", () => {
const actual = normaliseAstroOutputPath("/foo-testing-test", {
basePath: "/base/",
base: "/base/",
});

assert.equal(actual, "/base/foo-testing-test");
Expand Down

0 comments on commit 1dbebae

Please sign in to comment.