diff --git a/server/tests/integration/contact.test.js b/server/tests/integration/contact.test.js new file mode 100644 index 0000000..b8347d6 --- /dev/null +++ b/server/tests/integration/contact.test.js @@ -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); + }); + }); +}); diff --git a/server/tests/integration/product.test.js b/server/tests/integration/product.test.js new file mode 100644 index 0000000..e69de29