Advertisement
Guest User

Untitled

a guest
May 24th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. Here is the code:
  2.  
  3. var assert = require("assert");
  4. var superagent = require("superagent");
  5. var should = require("should");
  6. var expect = require('expect');
  7. var chai = require('chai');
  8. var chaiHttp = require('chai-http');
  9. var request=require('request');
  10.  
  11. describe('creating an Incident', function() {
  12.  
  13. it('should pass the parameters needed for creating an Incident', function(done) {
  14.  
  15. superagent
  16. .post('http://localhost:9001/incident/create' )
  17. .send({user: 'user123',password: 'pass123'}) //authorization details
  18.  
  19. .set('Accept', 'application/json') //headers
  20. .set('Content-Type', 'application/json') //headers
  21.  
  22. .send({ Name:'MyIncident', orderId:'12340508'}) //JSON parameters to be passed for creating an incident.
  23.  
  24. .end(function(err, res) {
  25.  
  26. expect(200,done); //Status code
  27. if (err) {
  28. throw err;
  29. }
  30. else {
  31. res.should.have.status(400);
  32. done();
  33. }
  34. });
  35. });
  36.  
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement