summaryrefslogtreecommitdiff
path: root/packages/astro-rss/test/pagesGlobToRssItems.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro-rss/test/pagesGlobToRssItems.test.js')
-rw-r--r--packages/astro-rss/test/pagesGlobToRssItems.test.js38
1 files changed, 36 insertions, 2 deletions
diff --git a/packages/astro-rss/test/pagesGlobToRssItems.test.js b/packages/astro-rss/test/pagesGlobToRssItems.test.js
index 82af5ba12..e72f6d3b3 100644
--- a/packages/astro-rss/test/pagesGlobToRssItems.test.js
+++ b/packages/astro-rss/test/pagesGlobToRssItems.test.js
@@ -66,7 +66,7 @@ describe('pagesGlobToRssItems', () => {
return chai.expect(pagesGlobToRssItems(globResult)).to.be.rejected;
});
- it('should fail on missing "title" key', () => {
+ it('should fail on missing "title" key and "description"', () => {
const globResult = {
'./posts/php.md': () =>
new Promise((resolve) =>
@@ -75,11 +75,45 @@ describe('pagesGlobToRssItems', () => {
frontmatter: {
title: undefined,
pubDate: phpFeedItem.pubDate,
- description: phpFeedItem.description,
+ description: undefined,
},
})
),
};
return chai.expect(pagesGlobToRssItems(globResult)).to.be.rejected;
});
+
+ it('should not fail on missing "title" key if "description" is present', () => {
+ const globResult = {
+ './posts/php.md': () =>
+ new Promise((resolve) =>
+ resolve({
+ url: phpFeedItem.link,
+ frontmatter: {
+ title: undefined,
+ pubDate: phpFeedItem.pubDate,
+ description: phpFeedItem.description,
+ },
+ })
+ ),
+ };
+ return chai.expect(pagesGlobToRssItems(globResult)).to.not.be.rejected;
+ });
+
+ it('should fail on missing "description" key if "title" is present', () => {
+ const globResult = {
+ './posts/php.md': () =>
+ new Promise((resolve) =>
+ resolve({
+ url: phpFeedItem.link,
+ frontmatter: {
+ title: phpFeedItem.title,
+ pubDate: phpFeedItem.pubDate,
+ description: undefined,
+ },
+ })
+ ),
+ };
+ return chai.expect(pagesGlobToRssItems(globResult)).to.not.be.rejected;
+ });
});