Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- it('allows me to place an order', function() {
- order.create(this.retailToken, this.order).then(response => expect(response.status).to.eq(200));
- });
- it("doesn't allow delivery distance above maximum", function() {
- const overMaxDistance = _.cloneDeep(this.order);
- overMaxDistance.order_details.locations[1].formatted_address =
- '1600 Amphitheatre Pkwy, Mountain View, CA 94043';
- order
- .create(this.retailToken, overMaxDistance, false)
- .then(response => expect(response.status).to.eq(400));
- });
- it("doesn't allow unknown locations", function() {
- const invalidAddress = _.cloneDeep(this.order);
- invalidAddress.order_details.locations[1].formatted_address = '123 INVALID St, Mars';
- order
- .create(this.retailToken, invalidAddress, false)
- .then(response => expect(response.status).to.eq(400));
- });
- it("doesn't allow invalid items", function() {
- const invalidItems = _.cloneDeep(this.order);
- invalidItems.order_details.items[0].category = 'INVALID';
- order
- .create(this.retailToken, invalidItems, false)
- .then(response => expect(response.status).to.eq(400));
- });
- it("doesn't allow empty partnerConfigId", function() {
- const emptyPartnerConfigId = 'APIKey-v1';
- order
- .create(emptyPartnerConfigId, this.order, false)
- .then(response => expect(response.status).to.eq(401));
- });
- it("doesn't allow invalid partnerConfigId", function() {
- const invalidPartnerConfigId = 'APIKey-v1 INVALID';
- order
- .create(invalidPartnerConfigId, this.order, false)
- .then(response => expect(response.status).to.eq(401));
- });
- it("doesn't allow missing required fields", function() {
- const missingRequiredFields = _.cloneDeep(this.order);
- delete missingRequiredFields.order_details.locations;
- order
- .create(this.retailToken, missingRequiredFields, false)
- .then(response => expect(response.status).to.eq(400));
- });
- it("doesn't allow missing consumer details", function() {
- const missingConsumerDetails = _.cloneDeep(this.order);
- delete missingConsumerDetails.consumer_details;
- order.create(this.retailToken, missingConsumerDetails, false).then(response => {
- expect(response.status).to.eq(400);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement