-
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.
- Loading branch information
Neel Mazumdar
committed
May 29, 2020
1 parent
74fb305
commit fd39580
Showing
3 changed files
with
26 additions
and
3 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,23 @@ | ||
const supertest = require('supertest') | ||
const server = require('../api/server') | ||
const db = require('../data/db-Config') | ||
describe('Products test', () => { | ||
it('Products add sucessfully', async () => { | ||
const res = await supertest(server).post('/api/products') | ||
.send({ | ||
name: 'orange', | ||
description: 'Its orange', | ||
market_location: 'trees', | ||
quantity: '10', | ||
price: '25', | ||
user_id: 1 | ||
}) | ||
expect(res.status).toBe(200) | ||
}) | ||
it("should return json", async () => { | ||
const res = await supertest(server) | ||
.post("/api/products") | ||
.send({ name: "grapes", description: "theyre sweet", quantity: "35", price:"10", user_id: 1 }); | ||
expect(res.type).toBe("application/json"); | ||
}); | ||
}) |
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ describe('register', () => { | |
it("register success", async () => { | ||
const res = await supertest(server).post('/api/auth/register') | ||
.send({ | ||
username: 'john1', | ||
username: 'john2', | ||
password: 'test', | ||
email: '[email protected]' | ||
}) | ||
|
@@ -34,7 +34,7 @@ describe('login', () => { | |
it('login success', async () => { | ||
const res = await supertest(server).post('/api/auth/login') | ||
.send({ | ||
username: 'john1', | ||
username: 'john2', | ||
password: 'test', | ||
email: '[email protected]' | ||
}) | ||
|
@@ -44,7 +44,7 @@ describe('login', () => { | |
it('login fail', async () => { | ||
const res = await supertest(server).post('/api/auth/login') | ||
.send({ | ||
username: 'john1', | ||
username: 'john2', | ||
password: 't3st', | ||
email: '[email protected]' | ||
}) | ||
|
Binary file not shown.