Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add process function and add some tests
- Loading branch information
1 parent
309757e
commit 8fcda1d
Showing
3 changed files
with
66 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import { parseFile2 } from "./process"; | ||
import Path from 'path'; | ||
import Path from "path"; | ||
|
||
describe("Can parse a file and get file info", () => { | ||
const pathToContentFixture = "__mocks__/content"; | ||
|
||
test("can parse a file", async () => { | ||
const filePath = 'index.mdx'; | ||
const filePath = "index.mdx"; | ||
const fullPath = Path.join(pathToContentFixture, filePath); | ||
const fileInfo = await parseFile2(fullPath) | ||
const fileInfo = await parseFile2(fullPath); | ||
|
||
expect(fileInfo.file_path).toBe(fullPath); | ||
// expect(fileInfo.metadata?.title).toBe('Homepage') | ||
expect(fileInfo.extension).toBe("mdx"); | ||
expect(fileInfo.tags).toEqual(["tag1", "tag2", "tag3"]); | ||
expect(fileInfo.metadata).toEqual({ | ||
title: "Homepage", | ||
tags: ["tag1", "tag2", "tag3"], | ||
}); | ||
expect(fileInfo.links).toEqual([ | ||
{ linkSrc: "blog0.mdx", linkType: "normal" }, | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters