Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. describe('POST /api/products/add', () => {
  2. it(`Should create ${addProductCount} products with 0...1000 price`, (done) => {
  3. let operationCount = addProductCount;
  4. for (let i = 0; i < addProductCount; i++) {
  5. chai
  6. .request(server)
  7. .post('api/products/add')
  8. .set('token', constants.merchantToken)
  9. .field('product_name', 'test')
  10. .field('product_description', 'description description')
  11. .field('original_price', '20')
  12. .field('sale_price', '10')
  13. .field('starting_date', '2019-04-19T17:03:00+00:00')
  14. .field('end_date', '2019-04-19T20:03:00+00:00')
  15. .field('quantity_available', '20')
  16. .field('quantity_available', 'HOME APPLIANCES')
  17. .attach('product_photos', fs.readFileSync(images1), 'test1.jpeg')
  18. .attach('product_photos', fs.readFileSync(images2), 'test2.jpg')
  19. .attach('product_photos', fs.readFileSync(images3), 'test3.png')
  20. .end((err, res) => {
  21. operationCount--;
  22. expect(res).have.status(200);
  23. expect(res.body).have.property('message');
  24. expect(res.body.message).to.be.equal('Product added');
  25. if (operationCount == 0) {
  26. done();
  27. }
  28. });
  29. }
  30. });
  31. });
  32.  
  33. Uncaught TypeError: Cannot use 'in' operator to search for 'status' in undefined
  34. at Proxy.<anonymous> (node_moduleschai-httplibhttp.js:80:38)
  35. at Proxy.methodWrapper >(node_moduleschailibchaiutilsaddMethod.js:57:25)
  36. at status (test/productsTest.js:73:42)
  37. at Test.Request.callback (node_modulessuperagentlibnodeindex.js:728:3)
  38. at ClientRequest.req.once.err (node_modulessuperagentlibnodeindex.js:647:10)
  39. at ClientRequest.EventEmitter.emit (domain.js:441:20)
  40. at Socket.socketErrorListener (_http_client.js:392:9)
  41. at Socket.EventEmitter.emit (domain.js:441:20)
  42. at emitErrorNT (internal/streams/destroy.js:82:8)
  43. at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
  44. at process._tickCallback (internal/process/next_tick.js:63:19)
  45.  
  46. { Error: connect ECONNREFUSED 127.0.0.1:80
  47. at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
  48. errno: 'ECONNREFUSED',
  49. code: 'ECONNREFUSED',
  50. syscall: 'connect',
  51. address: '127.0.0.1',
  52. port: 80,
  53. response: undefined }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement