Skip to content

Commit

Permalink
testing stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Neel Mazumdar committed May 29, 2020
1 parent 74fb305 commit fd39580
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
23 changes: 23 additions & 0 deletions __test__/product.test.js
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");
});
})
6 changes: 3 additions & 3 deletions __test__/user.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
})
Expand All @@ -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]'
})
Expand All @@ -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]'
})
Expand Down
Binary file modified data/auth.db3
Binary file not shown.

0 comments on commit fd39580

Please sign in to comment.