Skip to content

Commit fd39580

Browse files
author
Neel Mazumdar
committed
testing stuff
1 parent 74fb305 commit fd39580

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

__test__/product.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const supertest = require('supertest')
2+
const server = require('../api/server')
3+
const db = require('../data/db-Config')
4+
describe('Products test', () => {
5+
it('Products add sucessfully', async () => {
6+
const res = await supertest(server).post('/api/products')
7+
.send({
8+
name: 'orange',
9+
description: 'Its orange',
10+
market_location: 'trees',
11+
quantity: '10',
12+
price: '25',
13+
user_id: 1
14+
})
15+
expect(res.status).toBe(200)
16+
})
17+
it("should return json", async () => {
18+
const res = await supertest(server)
19+
.post("/api/products")
20+
.send({ name: "grapes", description: "theyre sweet", quantity: "35", price:"10", user_id: 1 });
21+
expect(res.type).toBe("application/json");
22+
});
23+
})

__test__/user.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('register', () => {
1414
it("register success", async () => {
1515
const res = await supertest(server).post('/api/auth/register')
1616
.send({
17-
username: 'john1',
17+
username: 'john2',
1818
password: 'test',
1919
2020
})
@@ -34,7 +34,7 @@ describe('login', () => {
3434
it('login success', async () => {
3535
const res = await supertest(server).post('/api/auth/login')
3636
.send({
37-
username: 'john1',
37+
username: 'john2',
3838
password: 'test',
3939
4040
})
@@ -44,7 +44,7 @@ describe('login', () => {
4444
it('login fail', async () => {
4545
const res = await supertest(server).post('/api/auth/login')
4646
.send({
47-
username: 'john1',
47+
username: 'john2',
4848
password: 't3st',
4949
5050
})

data/auth.db3

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)