forked from 13somesh/MealMatters
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
solve issue #8 : Added test for contact routes
- Loading branch information
1 parent
8226234
commit e978a28
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.