Skip to content

Commit

Permalink
chore: Rename example-docs to example-docs-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
cmfcmf committed Nov 10, 2024
1 parent 9ccecf3 commit 69bb3c8
Show file tree
Hide file tree
Showing 50 changed files with 22 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ lunr.js
lib
.husky
.vscode
example-docs
example-docs*
pnpm-lock.yaml
69 changes: 21 additions & 48 deletions packages/docusaurus-search-local/src/server/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ beforeEach(() => {
jest.spyOn(console, "warn").mockImplementation(() => {});
});

const BUILD_PATH = path.join(
__dirname,
"..",
"..",
"..",
"example-docs-v2",
"build",
);

describe("parser", () => {
it("parses blog pages", async () => {
const htmlPath = path.join(
__dirname,
"..",
"..",
"..",
"example-docs/build/blog/d-s-l-test/index.html",
);
const htmlPath = path.join(BUILD_PATH, "blog/d-s-l-test/index.html");
const html = await readFileAsync(htmlPath, "utf-8");
expect(html2text(html, "blog")).toEqual({
docSidebarParentCategories: undefined,
Expand Down Expand Up @@ -48,13 +51,7 @@ describe("parser", () => {

describe("docs", () => {
it("parses normal pages", async () => {
const htmlPath = path.join(
__dirname,
"..",
"..",
"..",
"example-docs/build/docs/d-s-l-test/index.html",
);
const htmlPath = path.join(BUILD_PATH, "docs/d-s-l-test/index.html");
const html = await readFileAsync(htmlPath, "utf-8");
expect(html2text(html, "docs")).toEqual({
docSidebarParentCategories: ["Docusaurus"],
Expand Down Expand Up @@ -101,13 +98,7 @@ describe("parser", () => {
});

it("parses empty page", async () => {
const htmlPath = path.join(
__dirname,
"..",
"..",
"..",
"example-docs/build/docs/d-s-l-test2/index.html",
);
const htmlPath = path.join(BUILD_PATH, "docs/d-s-l-test2/index.html");
const html = await readFileAsync(htmlPath, "utf-8");
expect(html2text(html, "docs")).toEqual({
docSidebarParentCategories: ["Docusaurus"],
Expand All @@ -118,11 +109,8 @@ describe("parser", () => {

it("parses page without title in frontmatter and with h1 in Markdown", async () => {
const htmlPath = path.join(
__dirname,
"..",
"..",
"..",
"example-docs/build/docs/next/d-s-l-test-no-title-h1/index.html",
BUILD_PATH,
"docs/next/d-s-l-test-no-title-h1/index.html",
);
const html = await readFileAsync(htmlPath, "utf-8");
expect(html2text(html, "docs")).toEqual({
Expand All @@ -141,11 +129,8 @@ describe("parser", () => {

it("parses page without title in frontmatter and with h2 in Markdown", async () => {
const htmlPath = path.join(
__dirname,
"..",
"..",
"..",
"example-docs/build/docs/next/d-s-l-test-no-title-h2/index.html",
BUILD_PATH,
"docs/next/d-s-l-test-no-title-h2/index.html",
);
const html = await readFileAsync(htmlPath, "utf-8");
expect(html2text(html, "docs")).toEqual({
Expand All @@ -165,11 +150,8 @@ describe("parser", () => {

it("parses page without title in frontmatter and with h1 in Markdown but with pre text", async () => {
const htmlPath = path.join(
__dirname,
"..",
"..",
"..",
"example-docs/build/docs/next/d-s-l-test-no-title-h1-pre-text/index.html",
BUILD_PATH,
"docs/next/d-s-l-test-no-title-h1-pre-text/index.html",
);
const html = await readFileAsync(htmlPath, "utf-8");
expect(html2text(html, "docs")).toEqual({
Expand All @@ -194,11 +176,8 @@ describe("parser", () => {

it("parses nested sidebar categories", async () => {
const htmlPath = path.join(
__dirname,
"..",
"..",
"..",
"example-docs/build/docs/next/nested_sidebar_doc/index.html",
BUILD_PATH,
"docs/next/nested_sidebar_doc/index.html",
);
const html = await readFileAsync(htmlPath, "utf-8");
expect(html2text(html, "docs")).toEqual({
Expand All @@ -216,13 +195,7 @@ describe("parser", () => {
});

it("parses page with first header directly after title", async () => {
const htmlPath = path.join(
__dirname,
"..",
"..",
"..",
"example-docs/build/docs/d-s-l-test3/index.html",
);
const htmlPath = path.join(BUILD_PATH, "docs/d-s-l-test3/index.html");
const html = await readFileAsync(htmlPath, "utf-8");
expect(html2text(html, "docs")).toEqual({
docSidebarParentCategories: ["Docusaurus"],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.

0 comments on commit 69bb3c8

Please sign in to comment.