diff --git a/tests/build-post-list.test.js b/tests/build-post-list.test.js
index 52042388b15..b74c3ab2a19 100644
--- a/tests/build-post-list.test.js
+++ b/tests/build-post-list.test.js
@@ -49,8 +49,10 @@ describe('buildPostList', () => {
expect(output).toHaveProperty('about');
expect(output).toHaveProperty('docsTree');
- const blogEntry = output.blog.find(item => item.slug === '/blog/release-notes-2.1.0');
+ const expectedSlug = normalize('/blog/release-notes-2.1.0');
+ const blogEntry = output.blog.find(item => normalize(item.slug) === expectedSlug);
console.log(blogEntry);
+
expect(blogEntry).toBeDefined();
expect(blogEntry.title).toBe('Release Notes 2.1.0');
});
@@ -72,8 +74,8 @@ describe('buildPostList', () => {
await buildPostList(postDirectories, tempDir, writeFilePath);
const output = JSON.parse(readFileSync(writeFilePath, 'utf-8'));
- const firstReleaseNote = output.blog.find(item => item.slug === '/blog/release-notes-2.1.0');
- const secondReleaseNote = output.blog.find(item => item.slug === '/blog/release-notes-2.1.1');
+ const firstReleaseNote = output.blog.find(item => normalize(item.slug) === normalize('/blog/release-notes-2.1.0'));
+ const secondReleaseNote = output.blog.find(item => normalize(item.slug) === normalize('/blog/release-notes-2.1.1'));
expect(firstReleaseNote).toBeDefined();
expect(firstReleaseNote.title).toBe('Release Notes 2.1.0');
@@ -89,12 +91,12 @@ describe('buildPostList', () => {
it('handles heading ids like {# myHeadingId}', () => {
const input = '## My Heading {#custom-id}';
- expect(slugifyToC(input)).toBe('custom-id');
+ expect(slugifyToC(input)).toBe(normalize('custom-id'));
});
it('handles heading ids like {}', () => {
const input = '## My Heading {}';
- expect(slugifyToC(input)).toBe('custom-anchor-id');
+ expect(slugifyToC(input)).toBe(normalize('custom-anchor-id'));
});
it('handles empty strings', () => {