Skip to content

Commit d39c109

Browse files
committed
chore: Add basic test for parseRssItems function
Introduces an initial test for the parseRssItems function, verifying its ability to parse a simple RSS feed and extract title, description, and link fields.
1 parent 30f6e98 commit d39c109

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

lib/__tests__/app.test.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
// TODO: Add tests
1+
// TODO: add better and more comprehensive tests for parseRssItems
2+
import { parseRssItems } from "../index";
3+
4+
describe("parseRssItems", () => {
5+
it("should parse a simple RSS feed", () => {
6+
const xml = `
7+
<rss>
8+
<channel>
9+
<item>
10+
<title>Test Title</title>
11+
<description>Test Description</description>
12+
<link>https://example.com</link>
13+
</item>
14+
</channel>
15+
</rss>
16+
`;
17+
18+
const result = parseRssItems(xml, {
19+
itemSelector: "channel > item",
20+
selectors: {
21+
title: "title",
22+
description: "description",
23+
link: "link",
24+
},
25+
});
26+
27+
expect(result).toEqual([
28+
{
29+
title: "Test Title",
30+
description: "Test Description",
31+
link: "https://example.com",
32+
},
33+
]);
34+
});
35+
});

0 commit comments

Comments
 (0)