Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('POST : /run', function () {
- it('should respond with 200 and successful result object', function (done) {
- request(app)
- .post('/run')
- .send({
- lang: 'python3',
- version: '3.6.5',
- program: 'a = 7\nb = 3\nsum = a + b\nprint(sum)'
- })
- .set('Accept', 'application/json')
- .expect('Content-Type', /json/)
- .expect(200)
- .end((err, res) => {
- expect(res.body).to.have.property('runResult');
- expect(res.body.runResult).to.have.all.keys([
- 'output', 'statusCode', 'memory', 'cpuTime'
- ]);
- done(err);
- });
- });
- it('should respond with 400 for unsupported lang', function (done) {
- request(app)
- .post('/run')
- .send({
- lang: 'pyn3',
- version: '3.6.5',
- program: 'a = 7\nb = 3\nsum = a + b\nprint(sum)'
- })
- .set('Accept', 'application/json')
- .expect(400, done);
- });
- it('should respond with 400 for empty program', function (done) {
- request(app)
- .post('/run')
- .send({
- lang: 'python3',
- version: '3.6.5',
- program: ''
- })
- .set('Accept', 'application/json')
- .expect(400, done);
- });
- it('should respond with 400 for undefined version', function (done) {
- request(app)
- .post('/run')
- .send({
- lang: 'python3',
- program: 'a = 7\nb = 3\nsum = a + b\nprint(sum)'
- })
- .set('Accept', 'application/json')
- .expect(400, done);
- });
- });
Add Comment
Please, Sign In to add comment