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:59:19 +0200
committerGitHub <noreply@github.com>2020-08-07 21:59:19 +0200
commitb994a4475855f98c1bc89997c581e6685abf94dd (patch)
tree21b2a6b575039c6c8274929e9e191d8723c44e12 /test
parentc941b9a7066f6fe5cfebf159feb7d00cd316f64d (diff)
parenta29d97d7f7c8c26896ea9e7e0b52bf6aa1ea71d0 (diff)
downloadkronikarz-b994a4475855f98c1bc89997c581e6685abf94dd.tar.gz
kronikarz-b994a4475855f98c1bc89997c581e6685abf94dd.zip
Merge pull request #17 from pniedzwiedzinski/rss-feed v2.1.0
Rss feed
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>`);
+  });
+});