kill-the-newsletter/src/test.ts

15 lines
399 B
TypeScript
Raw Normal View History

2020-03-18 20:21:44 +01:00
import { app } from "./server";
2020-03-18 20:33:10 +01:00
import { feedPath } from "./components";
2020-03-18 20:21:44 +01:00
import request from "supertest";
2020-03-18 20:33:10 +01:00
import fs from "fs";
2020-03-18 20:21:44 +01:00
test("create feed", async () => {
const response = await request(app)
.post("/")
2020-03-18 20:33:10 +01:00
.send("name=My Feed");
const token = response.text.match(/(\w{20}).xml/)![1];
const feed = fs.readFileSync(feedPath(token)).toString();
expect(feed).toMatch("My Feed");
2020-03-18 20:21:44 +01:00
});