From a7179a0484594781d3d9205c682ad49936decdc1 Mon Sep 17 00:00:00 2001 From: dark0angel Date: Thu, 18 Jun 2020 16:11:51 +0530 Subject: [PATCH] User profile update test I have written the test for user profile please check it and tell me my mistakes. I did not know how to run it as I havent understood how the person in the codebase is sending which response on updating user profile --- test/user-profile-test.ts | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 test/user-profile-test.ts diff --git a/test/user-profile-test.ts b/test/user-profile-test.ts new file mode 100644 index 0000000..4f567d3 --- /dev/null +++ b/test/user-profile-test.ts @@ -0,0 +1,52 @@ +import chai from 'chai' +import chaiHttp from 'chai-http' +import { describe, it } from 'mocha' + +var should = chai.should(); + +import app from '../src/app' + + +chai.use(chaiHttp) +const { expect } = chai + + + + +describe('profile update',()=> { + + it('should update the profile pge and return a message',(hi)=>{ + let update={ + firstname:'harshil', + lastname:'shah', + password:'123', + teams:['2','3'] + } + chai.request('http://localhost:3000') + .post('/user/profile') + .send(update) + .end((err,res)=>{ + res.should.have.status(200); + res.body.should.be.json; + hi() + }).catch((e)=>hi(e)) + }) + +}) + + +/* + +describe('Test Suite', () => { + it('Should Just Pass', (done) => { + chai + .request(app) + .get('/') + .then((res) => { + expect(res.status).to.be.equal(200) + done() + }) + .catch((e) => done(e)) + }) +}) +*/ \ No newline at end of file