summaryrefslogtreecommitdiff
path: root/packages/astro-rss/test/pagesGlobToRssItems.test.js
diff options
context:
space:
mode:
authorGravatar Florian Lefebvre <contact@florian-lefebvre.dev> 2024-01-06 08:47:29 +0100
committerGravatar GitHub <noreply@github.com> 2024-01-06 07:47:29 +0000
commit24663c9695385fed9ece57bf4aecdca3a8581e70 (patch)
treedee0e5f50670a2f897b483fc181cc98461294f6f /packages/astro-rss/test/pagesGlobToRssItems.test.js
parentedc87abd476a5b32cdc9ad772f3706cbba3b0eea (diff)
downloadastro-24663c9695385fed9ece57bf4aecdca3a8581e70.tar.gz
astro-24663c9695385fed9ece57bf4aecdca3a8581e70.tar.zst
astro-24663c9695385fed9ece57bf4aecdca3a8581e70.zip
fix(rss): make title optional if description is provided (#9610)
* fix(rss): make title optional if description is provided * feat(rss): simplify schema * fix(rss): update tests to match new behavior * Update packages/astro-rss/test/pagesGlobToRssItems.test.js Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> * Update packages/astro-rss/test/pagesGlobToRssItems.test.js Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> * feat: make link and pubDate optional * feat: improve item normalization * Update shy-spoons-sort.md * Fix test fail * Update .changeset/shy-spoons-sort.md Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> --------- Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> Co-authored-by: bluwy <bjornlu.dev@gmail.com> Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
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;
+ });
});