summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-08-07 21:55:16 +0200
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-08-07 21:55:16 +0200
commit6116769757ddd88781129e7339fc7ff60a259337 (patch)
tree362f6512b72b38d1d7a796783b60fe5f24fadb4a /test
parentc941b9a7066f6fe5cfebf159feb7d00cd316f64d (diff)
downloadkronikarz-6116769757ddd88781129e7339fc7ff60a259337.tar.gz
kronikarz-6116769757ddd88781129e7339fc7ff60a259337.zip
Add rss feed generation
Diffstat (limited to 'test')
-rw-r--r--test/generateRss.spec.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/generateRss.spec.ts b/test/generateRss.spec.ts
new file mode 100644
index 0000000..5b3af66
--- /dev/null
+++ b/test/generateRss.spec.ts
@@ -0,0 +1,18 @@
+import * as fs from "fs";
+import Kronikarz from "../dist";
+
+const k = new Kronikarz(__dirname + "/samples");
+const dir = "./tmp/rss.xml";
+
+test("generate RSS feed", () => {
+  k.generateRss(dir, { title: "Test", feed_url: "https://site.com/rss.xml", site_url: "https://site.com" });
+  fs.readFile("./tmp/rss.xml", "utf-8", (err, data) => {
+    expect(data).toBe(`<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Test]]></title><description><![CDATA[Test]]></description><link>https://site.com</link><generator>RSS for Node</generator><lastBuildDate>Fri, 07 Aug 2020 19:53:08 GMT</lastBuildDate><atom:link href="https://site.com/rss.xml" rel="self" type="application/rss+xml"/><item><title><![CDATA[Test]]></title><description><![CDATA[<div><h1>Test</h1>
+<p>12-12-2019 | Tester</p>
+<p>test test test</p>
+</div>]]></description><link>https://site.com/kronika/2019/12/12/test</link><guid isPermaLink="false">/kronika/2019/12/12/test</guid><dc:creator><![CDATA[Tester]]></dc:creator><pubDate>Thu, 12 Dec 2019 00:00:00 GMT</pubDate></item><item><title><![CDATA[Category]]></title><description><![CDATA[<div><h1>Category</h1>
+<p>01-01-2020 | Tester</p>
+<p>This file is for testing categories</p>
+</div>]]></description><link>https://site.com/kronika/2019/12/12/category</link><guid isPermaLink="false">/kronika/2019/12/12/category</guid><dc:creator><![CDATA[Tester]]></dc:creator><pubDate>Thu, 12 Dec 2019 00:00:00 GMT</pubDate></item></channel></rss>`);
+  });
+});