From ff6d059921f942ff3ecf634c52b2d129f32856c9 Mon Sep 17 00:00:00 2001 From: Daniel Temme Date: Wed, 9 Aug 2017 13:27:36 +0200 Subject: [PATCH] change tests to not always pass --- package.json | 2 +- test/api.test.ts | 4 +++- test/app.test.ts | 10 ++++------ test/contact.test.ts | 10 ++++------ test/home.test.ts | 10 ++++------ test/user.test.ts | 4 +--- 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 82c4435..1b65c81 100644 --- a/package.json +++ b/package.json @@ -98,4 +98,4 @@ "tslint": "^5.8.0", "typescript": "^2.4.0" } -} \ No newline at end of file +} diff --git a/test/api.test.ts b/test/api.test.ts index 9c3d0c7..3e514fc 100644 --- a/test/api.test.ts +++ b/test/api.test.ts @@ -1,5 +1,7 @@ +import {} from "jest"; import * as supertest from "supertest"; -import * as app from "../src/server"; + +const request = supertest("http://localhost:3000"); describe("GET /api", () => { const request = supertest(app); diff --git a/test/app.test.ts b/test/app.test.ts index 23cbad7..4fd81d6 100644 --- a/test/app.test.ts +++ b/test/app.test.ts @@ -1,11 +1,9 @@ import * as supertest from "supertest"; -import * as app from "../src/server"; +const request = supertest("http://localhost:3000"); describe("GET /random-url", () => { - const request = supertest(app); - - it("should return 404", (done) => { - request.get("/reset") - .expect(404, done); + it("should return 404", () => { + return request.get("/reset") + .expect(404); }); }); diff --git a/test/contact.test.ts b/test/contact.test.ts index 6eb39a2..0b8eddb 100644 --- a/test/contact.test.ts +++ b/test/contact.test.ts @@ -1,11 +1,9 @@ import * as supertest from "supertest"; -import * as app from "../src/server"; +const request = supertest("http://localhost:3000"); describe("GET /contact", () => { - const request = supertest(app); - - it("should return 200 OK", (done) => { - request.get("/contact") - .expect(200, done); + it("should return 200 OK", () => { + return request.get("/contact") + .expect(200); }); }); diff --git a/test/home.test.ts b/test/home.test.ts index baea33c..1c9c8f5 100644 --- a/test/home.test.ts +++ b/test/home.test.ts @@ -1,11 +1,9 @@ import * as supertest from "supertest"; -import * as app from "../src/server"; +const request = supertest("http://localhost:3000"); describe("GET /", () => { - const request = supertest(app); - - it("should return 200 OK", (done) => { - request.get("/") - .expect(200, done); + it("should return 200 OK", () => { + return request.get("/") + .expect(200); }); }); diff --git a/test/user.test.ts b/test/user.test.ts index 0d26fca..cc97a57 100644 --- a/test/user.test.ts +++ b/test/user.test.ts @@ -1,7 +1,5 @@ import * as supertest from "supertest"; -import * as app from "../src/server"; - -const request = supertest(app); +const request = supertest("http://localhost:3000"); describe("GET /login", () => { it("should return 200 OK", () => {