From 21248e421c32446f6827f8376944b19ea2afc27d Mon Sep 17 00:00:00 2001 From: Leandro Facchinetti Date: Wed, 18 Mar 2020 15:33:10 -0400 Subject: [PATCH] . --- src/server.tsx | 2 +- src/test.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/server.tsx b/src/server.tsx index b9c4b0a..af9c85f 100644 --- a/src/server.tsx +++ b/src/server.tsx @@ -16,7 +16,7 @@ import fs from "fs"; export const app = express(); app.use(express.static("static")); -app.use(express.urlencoded()); +app.use(express.urlencoded({ extended: true })); app.get("/", (req, res) => res.send( diff --git a/src/test.ts b/src/test.ts index 3ce57fe..ed4c2b9 100644 --- a/src/test.ts +++ b/src/test.ts @@ -1,9 +1,14 @@ import { app } from "./server"; +import { feedPath } from "./components"; import request from "supertest"; +import fs from "fs"; test("create feed", async () => { const response = await request(app) .post("/") - .send({ name: "My Feed" }); - JSON.stringify(response, null, 2); + .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"); });