Skip to content

Commit

Permalink
🌼 Test [POST] Join Us API (#742)
Browse files Browse the repository at this point in the history
* Remove 2 duplicated fields from join us validation schema

* Test post join us api
  • Loading branch information
hazemessam authored Mar 5, 2022
1 parent 225439b commit d6829c9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
2 changes: 0 additions & 2 deletions backend/app/routes/joinUs/@validationSchema/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const JoinUsValidationSchema = Joi.object().keys({
email: Joi.string().required(),
linkdin: Joi.string().required(),
description: Joi.string().required(),
domain: Joi.array().required(),
department: Joi.string().required(),
year: Joi.string().required(),
college: Joi.string().required(),
contact: Joi.string().required(),
Expand Down
31 changes: 31 additions & 0 deletions backend/tests/routes/joinUs/postJoinUs.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const chai = require('chai');
const { expect } = require('chai');
const chaiHttp = require('chai-http');
const server = require('../../../index');

chai.use(chaiHttp);

describe('Test for post join us requests:', () => {
it('post join us requests to /joinus', (done) => {
const joinUsData = {
name: 'hazem',
email: '[email protected]',
linkdin: 'https://www.linkedin.com/in/test',
description: 'This is just for test',
year: '4th',
college: 'Test University',
contact: '0123456789',
interestedDomain: ['Backend'],
department: 'CS',
};
chai
.request(server)
.post('/joinUs')
.send(joinUsData)
.then((res) => {
expect(res.status).to.equal(200);
done();
})
.catch(done);
});
});

0 comments on commit d6829c9

Please sign in to comment.