Skip to content

Commit

Permalink
solve issue #8 : Added test for contact routes
Browse files Browse the repository at this point in the history
  • Loading branch information
mathanraj0601 committed Jan 20, 2024
1 parent 8226234 commit e978a28
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions server/tests/integration/contact.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const request = require("supertest");
let server;
describe("contact-us", () => {
beforeEach(() => {
server = require("../../app");
});
afterEach(async () => {
await server.close();
});
describe("/", () => {
it("should return a statuscode of 200 if body have object", async () => {
const result = await request(server).post("/contact-us/").send({
name: "b",
email: "b",
subject: "b",
});
expect(result.statusCode).toBe(200);
});

it("should return a statuscode of 400 if no body is send", async () => {
const result = await request(server).post("/contact-us/").send({});
expect(result.statusCode).toBe(400);
});
});
});
Empty file.

0 comments on commit e978a28

Please sign in to comment.