Guest User

Untitled

a guest
Oct 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. describe('POST : /run', function () {
  2. it('should respond with 200 and successful result object', function (done) {
  3. request(app)
  4. .post('/run')
  5. .send({
  6. lang: 'python3',
  7. version: '3.6.5',
  8. program: 'a = 7\nb = 3\nsum = a + b\nprint(sum)'
  9. })
  10. .set('Accept', 'application/json')
  11. .expect('Content-Type', /json/)
  12. .expect(200)
  13. .end((err, res) => {
  14. expect(res.body).to.have.property('runResult');
  15. expect(res.body.runResult).to.have.all.keys([
  16. 'output', 'statusCode', 'memory', 'cpuTime'
  17. ]);
  18. done(err);
  19. });
  20. });
  21.  
  22. it('should respond with 400 for unsupported lang', function (done) {
  23. request(app)
  24. .post('/run')
  25. .send({
  26. lang: 'pyn3',
  27. version: '3.6.5',
  28. program: 'a = 7\nb = 3\nsum = a + b\nprint(sum)'
  29. })
  30. .set('Accept', 'application/json')
  31. .expect(400, done);
  32. });
  33.  
  34. it('should respond with 400 for empty program', function (done) {
  35. request(app)
  36. .post('/run')
  37. .send({
  38. lang: 'python3',
  39. version: '3.6.5',
  40. program: ''
  41. })
  42. .set('Accept', 'application/json')
  43. .expect(400, done);
  44. });
  45.  
  46. it('should respond with 400 for undefined version', function (done) {
  47. request(app)
  48. .post('/run')
  49. .send({
  50. lang: 'python3',
  51. program: 'a = 7\nb = 3\nsum = a + b\nprint(sum)'
  52. })
  53. .set('Accept', 'application/json')
  54. .expect(400, done);
  55. });
  56. });
Add Comment
Please, Sign In to add comment