Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. it('allows me to place an order', function() {
  2. order.create(this.retailToken, this.order).then(response => expect(response.status).to.eq(200));
  3. });
  4.  
  5. it("doesn't allow delivery distance above maximum", function() {
  6. const overMaxDistance = _.cloneDeep(this.order);
  7. overMaxDistance.order_details.locations[1].formatted_address =
  8. '1600 Amphitheatre Pkwy, Mountain View, CA 94043';
  9. order
  10. .create(this.retailToken, overMaxDistance, false)
  11. .then(response => expect(response.status).to.eq(400));
  12. });
  13.  
  14. it("doesn't allow unknown locations", function() {
  15. const invalidAddress = _.cloneDeep(this.order);
  16. invalidAddress.order_details.locations[1].formatted_address = '123 INVALID St, Mars';
  17. order
  18. .create(this.retailToken, invalidAddress, false)
  19. .then(response => expect(response.status).to.eq(400));
  20. });
  21.  
  22. it("doesn't allow invalid items", function() {
  23. const invalidItems = _.cloneDeep(this.order);
  24. invalidItems.order_details.items[0].category = 'INVALID';
  25. order
  26. .create(this.retailToken, invalidItems, false)
  27. .then(response => expect(response.status).to.eq(400));
  28. });
  29.  
  30. it("doesn't allow empty partnerConfigId", function() {
  31. const emptyPartnerConfigId = 'APIKey-v1';
  32. order
  33. .create(emptyPartnerConfigId, this.order, false)
  34. .then(response => expect(response.status).to.eq(401));
  35. });
  36.  
  37. it("doesn't allow invalid partnerConfigId", function() {
  38. const invalidPartnerConfigId = 'APIKey-v1 INVALID';
  39. order
  40. .create(invalidPartnerConfigId, this.order, false)
  41. .then(response => expect(response.status).to.eq(401));
  42. });
  43.  
  44. it("doesn't allow missing required fields", function() {
  45. const missingRequiredFields = _.cloneDeep(this.order);
  46. delete missingRequiredFields.order_details.locations;
  47. order
  48. .create(this.retailToken, missingRequiredFields, false)
  49. .then(response => expect(response.status).to.eq(400));
  50. });
  51.  
  52. it("doesn't allow missing consumer details", function() {
  53. const missingConsumerDetails = _.cloneDeep(this.order);
  54. delete missingConsumerDetails.consumer_details;
  55. order.create(this.retailToken, missingConsumerDetails, false).then(response => {
  56. expect(response.status).to.eq(400);
  57. });
  58. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement