Skip to content

Commit

Permalink
fegewg
Browse files Browse the repository at this point in the history
  • Loading branch information
vishvamsinh28 committed Nov 1, 2024
1 parent d77cf7a commit bc76d4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions scripts/build-rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = async function rssFeed(type, title, desc, outputPath) {
});

if (missingDatePosts.length > 0) {
throw new Error('Missing date in post data');
throw new Error(`Missing date in posts: ${missingDatePosts.map(p => p.title || p.slug).join(', ')}`);
}

const base = 'https://www.asyncapi.com'
Expand All @@ -55,10 +55,10 @@ module.exports = async function rssFeed(type, title, desc, outputPath) {
rss.channel.generator = 'next.js'
rss.channel.item = []

const invalidPosts = posts.filter(post =>
const invalidPosts = posts.filter(post =>
!post.title || !post.slug || !post.excerpt || !post.date
);

if (invalidPosts.length > 0) {
throw new Error('Missing required fields in post data');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/build-rss.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('rssFeed', () => {

jest.doMock('../config/posts.json', () => missingDateMockData, { virtual: true });

await expect(rssFeed(type, title, desc, outputPath)).rejects.toThrow('Missing date in post data');
await expect(rssFeed(type, title, desc, outputPath)).rejects.toThrow('Failed to generate RSS feed: Missing date in posts: Post without Date');

});
});

0 comments on commit bc76d4b

Please sign in to comment.