From fd395805d18a3a37c2cc1c93251880ce1beb56ff Mon Sep 17 00:00:00 2001 From: Neel Mazumdar Date: Thu, 28 May 2020 21:24:25 -0400 Subject: [PATCH] testing stuff --- __test__/product.test.js | 23 +++++++++++++++++++++++ __test__/user.test.js | 6 +++--- data/auth.db3 | Bin 28672 -> 28672 bytes 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 __test__/product.test.js diff --git a/__test__/product.test.js b/__test__/product.test.js new file mode 100644 index 0000000..5429e72 --- /dev/null +++ b/__test__/product.test.js @@ -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"); + }); +}) \ No newline at end of file diff --git a/__test__/user.test.js b/__test__/user.test.js index 2b79e35..b1249c4 100644 --- a/__test__/user.test.js +++ b/__test__/user.test.js @@ -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: 'lambda4@testing.com' }) @@ -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: 'lambda4@testing.com' }) @@ -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: 'lambda4@testing.com' }) diff --git a/data/auth.db3 b/data/auth.db3 index 1723447afa6dd86bfab8f699da0261baf83069f7..4699f7c5172a1d3a8475812158b949b9d1c9074a 100644 GIT binary patch delta 470 zcmZp8z}WDBae_2s$NeY5F`|oXpJPjHSh?Ma68JFX7MBQ0_>bJ9E$ z^;2^kEe#Ak48#4>L%hQ)N{kEwB1}pW3;goDf_?QPgL4vdlTs2*97Hi;$SyU{iSkKG2{boK@=VPM3r#IF@rW#m z$n*+NbkWPnbjD)%QU*bQ(|Bn9-{}Z5}w(yH^0(}nl4;zeS$U6B> zyoMMj-#!NZhx`Zlr}O9Yd-1FDv+zCS+XvLNgs)zai-SQ@QCv`vGruS?FFn<>q*wvM iDk(}$EjBbTGF9Xxtb~KG5_W7#ctLi;ZJO+rzYPF>BaYhu delta 102 zcmV-s0Ga=Q-~oW(0gxL3bCDcF0duinW-kl|2?GNc0d;d_a&rW;(l0U)3w*UYD