From da38fdaf7214aeed0fa69178bccb2b3558cd5fe3 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 15 Nov 2020 15:15:21 +0100 Subject: [PATCH] tests: get rid of useless csrf.njk template --- test/CsrfProtectionComponent.test.ts | 3 ++- test/views/test/csrf.njk | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 test/views/test/csrf.njk diff --git a/test/CsrfProtectionComponent.test.ts b/test/CsrfProtectionComponent.test.ts index c418f6e..f83a5cb 100644 --- a/test/CsrfProtectionComponent.test.ts +++ b/test/CsrfProtectionComponent.test.ts @@ -2,6 +2,7 @@ import useApp from "./_app"; import Controller from "../src/Controller"; import supertest from "supertest"; import TestApp from "../src/TestApp"; +import CsrfProtectionComponent from "../src/components/CsrfProtectionComponent"; let app: TestApp; useApp(async (addr, port) => { @@ -10,7 +11,7 @@ useApp(async (addr, port) => { this.use(new class extends Controller { public routes(): void { this.get('/', (req, res) => { - res.render('test/csrf.njk'); + res.send(CsrfProtectionComponent.getCsrfToken(req.getSession())); }, 'csrf_test'); this.post('/', (req, res) => { diff --git a/test/views/test/csrf.njk b/test/views/test/csrf.njk deleted file mode 100644 index 7322da1..0000000 --- a/test/views/test/csrf.njk +++ /dev/null @@ -1 +0,0 @@ -{{ getCsrfToken() }} \ No newline at end of file