This commit is contained in:
Leandro Facchinetti 2020-03-18 15:33:10 -04:00
parent c56f59b93f
commit 21248e421c
2 changed files with 8 additions and 3 deletions

View File

@ -16,7 +16,7 @@ import fs from "fs";
export const app = express(); export const app = express();
app.use(express.static("static")); app.use(express.static("static"));
app.use(express.urlencoded()); app.use(express.urlencoded({ extended: true }));
app.get("/", (req, res) => app.get("/", (req, res) =>
res.send( res.send(

View File

@ -1,9 +1,14 @@
import { app } from "./server"; import { app } from "./server";
import { feedPath } from "./components";
import request from "supertest"; import request from "supertest";
import fs from "fs";
test("create feed", async () => { test("create feed", async () => {
const response = await request(app) const response = await request(app)
.post("/") .post("/")
.send({ name: "My Feed" }); .send("name=My Feed");
JSON.stringify(response, null, 2); const token = response.text.match(/(\w{20}).xml/)![1];
const feed = fs.readFileSync(feedPath(token)).toString();
expect(feed).toMatch("My Feed");
}); });