@@ -21,6 +21,10 @@ const phpFeedItemWithContent = {
2121 ...phpFeedItem ,
2222 content : `<h1>${ phpFeedItem . title } </h1><p>${ phpFeedItem . description } </p>` ,
2323} ;
24+ const phpFeedItemWithCustomData = {
25+ ...phpFeedItem ,
26+ customData : '<dc:creator><![CDATA[Buster Bluth]]></dc:creator>'
27+ } ;
2428
2529const web1FeedItem = {
2630 // Should support empty string as a URL (possible for homepage route)
@@ -41,6 +45,8 @@ const web1FeedItemWithContent = {
4145const validXmlResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title><![CDATA[${ title } ]]></title><description><![CDATA[${ description } ]]></description><link>${ site } /</link><item><title><![CDATA[${ phpFeedItem . title } ]]></title><link>${ site } ${ phpFeedItem . link } /</link><guid>${ site } ${ phpFeedItem . link } /</guid><description><![CDATA[${ phpFeedItem . description } ]]></description><pubDate>${ new Date ( phpFeedItem . pubDate ) . toUTCString ( ) } </pubDate></item><item><title><![CDATA[${ web1FeedItem . title } ]]></title><link>${ site } ${ web1FeedItem . link } /</link><guid>${ site } ${ web1FeedItem . link } /</guid><description><![CDATA[${ web1FeedItem . description } ]]></description><pubDate>${ new Date ( web1FeedItem . pubDate ) . toUTCString ( ) } </pubDate></item></channel></rss>` ;
4246// prettier-ignore
4347const validXmlWithContentResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title><![CDATA[${ title } ]]></title><description><![CDATA[${ description } ]]></description><link>${ site } /</link><item><title><![CDATA[${ phpFeedItemWithContent . title } ]]></title><link>${ site } ${ phpFeedItemWithContent . link } /</link><guid>${ site } ${ phpFeedItemWithContent . link } /</guid><description><![CDATA[${ phpFeedItemWithContent . description } ]]></description><pubDate>${ new Date ( phpFeedItemWithContent . pubDate ) . toUTCString ( ) } </pubDate><content:encoded><![CDATA[${ phpFeedItemWithContent . content } ]]></content:encoded></item><item><title><![CDATA[${ web1FeedItemWithContent . title } ]]></title><link>${ site } ${ web1FeedItemWithContent . link } /</link><guid>${ site } ${ web1FeedItemWithContent . link } /</guid><description><![CDATA[${ web1FeedItemWithContent . description } ]]></description><pubDate>${ new Date ( web1FeedItemWithContent . pubDate ) . toUTCString ( ) } </pubDate><content:encoded><![CDATA[${ web1FeedItemWithContent . content } ]]></content:encoded></item></channel></rss>` ;
48+ // prettier-ignore
49+ const validXmlWithCustomDataResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title><![CDATA[${ title } ]]></title><description><![CDATA[${ description } ]]></description><link>${ site } /</link><item><title><![CDATA[${ phpFeedItemWithCustomData . title } ]]></title><link>${ site } ${ phpFeedItemWithCustomData . link } /</link><guid>${ site } ${ phpFeedItemWithCustomData . link } /</guid><description><![CDATA[${ phpFeedItemWithCustomData . description } ]]></description><pubDate>${ new Date ( phpFeedItemWithCustomData . pubDate ) . toUTCString ( ) } </pubDate>${ phpFeedItemWithCustomData . customData } </item><item><title><![CDATA[${ web1FeedItemWithContent . title } ]]></title><link>${ site } ${ web1FeedItemWithContent . link } /</link><guid>${ site } ${ web1FeedItemWithContent . link } /</guid><description><![CDATA[${ web1FeedItemWithContent . description } ]]></description><pubDate>${ new Date ( web1FeedItemWithContent . pubDate ) . toUTCString ( ) } </pubDate><content:encoded><![CDATA[${ web1FeedItemWithContent . content } ]]></content:encoded></item></channel></rss>` ;
4450
4551describe ( 'rss' , ( ) => {
4652 it ( 'should generate on valid RSSFeedItem array' , async ( ) => {
@@ -65,6 +71,20 @@ describe('rss', () => {
6571 chai . expect ( body ) . xml . to . equal ( validXmlWithContentResult ) ;
6672 } ) ;
6773
74+ it ( 'should generate on valid RSSFeedItem array with custom data included' , async ( ) => {
75+ const { body } = await rss ( {
76+ xmlns : {
77+ dc : 'http://purl.org/dc/elements/1.1/' ,
78+ } ,
79+ title,
80+ description,
81+ items : [ phpFeedItemWithCustomData , web1FeedItemWithContent ] ,
82+ site,
83+ } ) ;
84+
85+ chai . expect ( body ) . xml . to . equal ( validXmlWithCustomDataResult ) ;
86+ } ) ;
87+
6888 describe ( 'glob result' , ( ) => {
6989 it ( 'should generate on valid result' , async ( ) => {
7090 const globResult = {
0 commit comments