test-utils.js — astro Source File
Architecture documentation for test-utils.js, a javascript file in the astro codebase. 1 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR a937f291_aca0_972e_b1ce_ba5bbe7ea3d3["test-utils.js"] 9912c6b7_6937_4418_a7cc_cd9eb70574c0["xml2js"] a937f291_aca0_972e_b1ce_ba5bbe7ea3d3 --> 9912c6b7_6937_4418_a7cc_cd9eb70574c0 8907484f_9222_fa07_2c48_64f2268467d0["pagesGlobToRssItems.test.js"] 8907484f_9222_fa07_2c48_64f2268467d0 --> a937f291_aca0_972e_b1ce_ba5bbe7ea3d3 842c65e0_b337_ca68_3828_f68d9c124978["rss.test.js"] 842c65e0_b337_ca68_3828_f68d9c124978 --> a937f291_aca0_972e_b1ce_ba5bbe7ea3d3 style a937f291_aca0_972e_b1ce_ba5bbe7ea3d3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import xml2js from 'xml2js';
export const title = 'My RSS feed';
export const description = 'This sure is a nice RSS feed';
export const site = 'https://example.com';
export const phpFeedItemWithoutDate = {
link: '/php',
title: 'Remember PHP?',
description:
'PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994.',
};
export const phpFeedItem = {
...phpFeedItemWithoutDate,
pubDate: '1994-05-03',
};
export const phpFeedItemWithContent = {
...phpFeedItem,
content: `<h1>${phpFeedItem.title}</h1><p>${phpFeedItem.description}</p>`,
};
export const phpFeedItemWithCustomData = {
...phpFeedItem,
customData: '<dc:creator><![CDATA[Buster Bluth]]></dc:creator>',
};
export const web1FeedItem = {
// Should support empty string as a URL (possible for homepage route)
link: '',
title: 'Web 1.0',
pubDate: '1997-05-03',
description:
'Web 1.0 is the term used for the earliest version of the Internet as it emerged from its origins with Defense Advanced Research Projects Agency (DARPA) and became, for the first time, a global network representing the future of digital communications.',
};
export const web1FeedItemWithContent = {
...web1FeedItem,
content: `<h1>${web1FeedItem.title}</h1><p>${web1FeedItem.description}</p>`,
};
export const web1FeedItemWithAllData = {
...web1FeedItem,
categories: ['web1', 'history'],
author: 'test@example.com',
commentsUrl: 'http://example.com/comments',
source: {
url: 'http://example.com/source',
title: 'The Web 1.0 blog',
},
enclosure: {
url: '/podcast.mp3',
length: 256,
type: 'audio/mpeg',
},
};
const parser = new xml2js.Parser({ trim: true });
/**
*
* Utility function to parse an XML string into an object using `xml2js`.
*
* @param {string} xmlString - Stringified XML to parse.
* @return {{ err: Error, result: any }} Represents an option containing the parsed XML string or an Error.
*/
export function parseXmlString(xmlString) {
let res;
parser.parseString(xmlString, (err, result) => {
res = { err, result };
});
return res;
}
Domain
Subdomains
Functions
Dependencies
- xml2js
Source
Frequently Asked Questions
What does test-utils.js do?
test-utils.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 test-utils.js?
test-utils.js defines 1 function(s): parseXmlString.
What does test-utils.js depend on?
test-utils.js imports 1 module(s): xml2js.
What files import test-utils.js?
test-utils.js is imported by 2 file(s): pagesGlobToRssItems.test.js, rss.test.js.
Where is test-utils.js in the architecture?
test-utils.js is located at packages/astro-rss/test/test-utils.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