Skip to content

Commit

Permalink
wip: loadcontent test
Browse files Browse the repository at this point in the history
  • Loading branch information
OzakIOne committed Feb 26, 2024
1 parent 64e5f47 commit 0d8777c
Show file tree
Hide file tree
Showing 14 changed files with 160 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`blog plugin process blog posts load content 1`] = `
[
{
"content": "2031",
"id": "/date/2031",
"metadata": {
"authors": [],
"date": 2031-01-01T00:00:00.000Z,
"description": "2031",
"editUrl": "https://baseEditUrl.com/edit/blog/date-2031-unlisted.md",
"formattedDate": "January 1, 2031",
"frontMatter": {
"date": 2031-01-01T00:00:00.000Z,
"slug": "/date/2031",
"title": "2031",
"unlisted": true,
},
"hasTruncateMarker": false,
"nextItem": {
"permalink": "/blog/date/2030",
"title": "2030",
},
"permalink": "/blog/date/2031",
"readingTime": 0.005,
"source": "@site/blog/date-2031-unlisted.md",
"tags": [],
"title": "2031",
"unlisted": false,
},
},
{
"content": "2030",
"id": "/date/2030",
"metadata": {
"authors": [],
"date": 2030-01-01T00:00:00.000Z,
"description": "2030",
"editUrl": "https://baseEditUrl.com/edit/blog/date-2030.md",
"formattedDate": "January 1, 2030",
"frontMatter": {
"date": 2030-01-01T00:00:00.000Z,
"slug": "/date/2030",
"title": "2030",
},
"hasTruncateMarker": false,
"permalink": "/blog/date/2030",
"prevItem": {
"permalink": "/blog/date/2031",
"title": "2031",
},
"readingTime": 0.005,
"source": "@site/blog/date-2030.md",
"tags": [],
"title": "2030",
"unlisted": false,
},
},
]
`;

exports[`blog plugin works on blog tags without pagination 1`] = `
{
"/blog/tags/tag-1": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,19 @@ describe('blog plugin', () => {

expect(blogTags).toMatchSnapshot();
});

it('process blog posts load content', async () => {
const siteDir = path.join(
__dirname,
'__fixtures__',
'website-blog-with-dates',
);
const processedBlogPosts = await getBlogPosts(siteDir, {
postsPerPage: 2,
processBlogPosts: async ({blogPosts}) =>
blogPosts.filter((blog) => blog.metadata.date.getFullYear() > 2029),
});

expect(processedBlogPosts).toMatchSnapshot();
});
});

0 comments on commit 0d8777c

Please sign in to comment.