rss.test.js — astro Source File
Architecture documentation for rss.test.js, a javascript file in the astro codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 842c65e0_b337_ca68_3828_f68d9c124978["rss.test.js"] 410470b6_1217_c12f_a63f_fe972fcaa82d["../dist/index.js"] 842c65e0_b337_ca68_3828_f68d9c124978 --> 410470b6_1217_c12f_a63f_fe972fcaa82d 65d9245e_87b4_4b96_2d87_a39e6d04681f["../dist/schema.js"] 842c65e0_b337_ca68_3828_f68d9c124978 --> 65d9245e_87b4_4b96_2d87_a39e6d04681f a937f291_aca0_972e_b1ce_ba5bbe7ea3d3["test-utils.js"] 842c65e0_b337_ca68_3828_f68d9c124978 --> a937f291_aca0_972e_b1ce_ba5bbe7ea3d3 bb9083b9_c653_4ab7_b907_44654ad91d57["parseXmlString"] 842c65e0_b337_ca68_3828_f68d9c124978 --> bb9083b9_c653_4ab7_b907_44654ad91d57 e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 842c65e0_b337_ca68_3828_f68d9c124978 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 842c65e0_b337_ca68_3828_f68d9c124978 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 f8c9251e_f535_6281_2118_9e79a4155212["v4"] 842c65e0_b337_ca68_3828_f68d9c124978 --> f8c9251e_f535_6281_2118_9e79a4155212 style 842c65e0_b337_ca68_3828_f68d9c124978 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import * as z from 'zod/v4';
import rss, { getRssString } from '../dist/index.js';
import { rssSchema } from '../dist/schema.js';
import {
description,
parseXmlString,
phpFeedItem,
phpFeedItemWithContent,
phpFeedItemWithCustomData,
phpFeedItemWithoutDate,
site,
title,
web1FeedItem,
web1FeedItemWithAllData,
web1FeedItemWithContent,
} from './test-utils.js';
// note: I spent 30 minutes looking for a nice node-based snapshot tool
// ...and I gave up. Enjoy big strings!
// biome-ignore format: keep in one line
const 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 isPermaLink="true">${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 isPermaLink="true">${site}${web1FeedItem.link}/</guid><description><![CDATA[${web1FeedItem.description}]]></description><pubDate>${new Date(web1FeedItem.pubDate).toUTCString()}</pubDate></item></channel></rss>`;
// biome-ignore format: keep in one line
const 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 isPermaLink="true">${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 isPermaLink="true">${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>`;
// biome-ignore format: keep in one line
const validXmlResultWithMissingDate = `<?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[${phpFeedItemWithoutDate.title}]]></title><link>${site}${phpFeedItemWithoutDate.link}/</link><guid isPermaLink="true">${site}${phpFeedItemWithoutDate.link}/</guid><description><![CDATA[${phpFeedItemWithoutDate.description}]]></description></item><item><title><![CDATA[${phpFeedItem.title}]]></title><link>${site}${phpFeedItem.link}/</link><guid isPermaLink="true">${site}${phpFeedItem.link}/</guid><description><![CDATA[${phpFeedItem.description}]]></description><pubDate>${new Date(phpFeedItem.pubDate).toUTCString()}</pubDate></item></channel></rss>`;
// biome-ignore format: keep in one line
const validXmlResultWithAllData = `<?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 isPermaLink="true">${site}${phpFeedItem.link}/</guid><description><![CDATA[${phpFeedItem.description}]]></description><pubDate>${new Date(phpFeedItem.pubDate).toUTCString()}</pubDate></item><item><title><![CDATA[${web1FeedItemWithAllData.title}]]></title><link>${site}${web1FeedItemWithAllData.link}/</link><guid isPermaLink="true">${site}${web1FeedItemWithAllData.link}/</guid><description><![CDATA[${web1FeedItemWithAllData.description}]]></description><pubDate>${new Date(web1FeedItemWithAllData.pubDate).toUTCString()}</pubDate><category>${web1FeedItemWithAllData.categories[0]}</category><category>${web1FeedItemWithAllData.categories[1]}</category><author>${web1FeedItemWithAllData.author}</author><comments>${web1FeedItemWithAllData.commentsUrl}</comments><source url="${web1FeedItemWithAllData.source.url}">${web1FeedItemWithAllData.source.title}</source><enclosure url="${site}${web1FeedItemWithAllData.enclosure.url}" length="${web1FeedItemWithAllData.enclosure.length}" type="${web1FeedItemWithAllData.enclosure.type}"/></item></channel></rss>`;
// biome-ignore format: keep in one line
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 isPermaLink="true">${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 isPermaLink="true">${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>`;
// biome-ignore format: keep in one line
const validXmlWithStylesheet = `<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/feedstylesheet.css"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link></channel></rss>`;
// biome-ignore format: keep in one line
const validXmlWithXSLStylesheet = `<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/feedstylesheet.xsl" type="text/xsl"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link></channel></rss>`;
// biome-ignore format: keep in one line
const validXmlWithXSLTStylesheet = `<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/feedstylesheet.xslt" type="text/xsl"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link></channel></rss>`;
function assertXmlDeepEqual(a, b) {
const parsedA = parseXmlString(a);
const parsedB = parseXmlString(b);
assert.equal(parsedA.err, null);
assert.equal(parsedB.err, null);
assert.deepEqual(parsedA.result, parsedB.result);
}
describe('rss', () => {
it('should return a response', async () => {
const response = await rss({
title,
description,
items: [phpFeedItem, web1FeedItem],
site,
});
const str = await response.text();
// NOTE: Chai used the below parser to perform the tests, but I have omitted it for now.
// ... (242 more lines)
Domain
Subdomains
Functions
Dependencies
- ../dist/index.js
- ../dist/schema.js
- node:test
- parseXmlString
- strict
- test-utils.js
- v4
Source
Frequently Asked Questions
What does rss.test.js do?
rss.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in rss.test.js?
rss.test.js defines 1 function(s): assertXmlDeepEqual.
What does rss.test.js depend on?
rss.test.js imports 7 module(s): ../dist/index.js, ../dist/schema.js, node:test, parseXmlString, strict, test-utils.js, v4.
Where is rss.test.js in the architecture?
rss.test.js is located at packages/astro-rss/test/rss.test.js (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro-rss/test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free