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