fix: phase 8 refactoring
This commit is contained in:
@@ -372,6 +372,21 @@ describe('MetaEngine', () => {
|
||||
const categories = await metaEngine.collectCategoriesFromPosts();
|
||||
expect(categories).toEqual(['valid-cat']);
|
||||
});
|
||||
|
||||
it('should ignore empty and whitespace-only taxonomy entries from posts', async () => {
|
||||
mockPosts = [
|
||||
{
|
||||
tags: JSON.stringify([' valid-tag ', '', ' ']),
|
||||
categories: JSON.stringify([' valid-cat ', '', ' ']),
|
||||
},
|
||||
];
|
||||
|
||||
const tags = await metaEngine.collectTagsFromPosts();
|
||||
const categories = await metaEngine.collectCategoriesFromPosts();
|
||||
|
||||
expect(tags).toEqual(['valid-tag']);
|
||||
expect(categories).toEqual(['valid-cat']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Event Emission', () => {
|
||||
|
||||
@@ -634,6 +634,18 @@ describe('TagEngine', () => {
|
||||
|
||||
expect(result.discovered).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
|
||||
it('should ignore empty and whitespace-only tags discovered from posts', async () => {
|
||||
mockSelectDataQueue = [
|
||||
[{ tags: '[" valid-tag ", "", " "]' }],
|
||||
[],
|
||||
];
|
||||
|
||||
const result = await tagEngine.syncTagsFromPosts();
|
||||
|
||||
expect(result.discovered).toBe(1);
|
||||
expect(result.added).toEqual(['valid-tag']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('loadTagsFromFile', () => {
|
||||
|
||||
Reference in New Issue
Block a user