How to use the angular-in-memory-web-api.STATUS.OK function in angular-in-memory-web-api

To help you get started, we’ve selected a few angular-in-memory-web-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graycoreio / daffodil / libs / checkout / testing / src / inmemory-backend / checkout.service.ts View on Github external
return reqInfo.utils.createResponse$(() => {
      if (reqInfo.id === 'placeOrder') {
        //should make a service call to clear cart here.
        // this.driver.cartService.clear(reqInfo.req.body.orderId).subscribe();
        this.populateOrder();
      }

      return {
        body: this.order,
        status: STATUS.OK
      };
    });
  }
github graycoreio / daffodil / libs / driver / in-memory / src / cart / in-mem / cart.testing.service.spec.ts View on Github external
it('should return the returned value from createResponse$', () => {
      expect(result).toEqual({
        body: stubCart,
        status: STATUS.OK
      });
    });
github graycoreio / daffodil / libs / cart / testing / src / in-memory-backend / cart.service.spec.ts View on Github external
it('should return the returned value from createResponse$', () => {
      expect(result).toEqual({
        body: stubCart,
        status: STATUS.OK
      });
    });
github graycoreio / daffodil / libs / cart / testing / src / in-memory-backend / cart.service.ts View on Github external
if (reqInfo.id === 'addToCart') {
        const matchedProductIndex = this.getMatchedProductIndex(
          reqInfo.req.body.productId
        );
        if (matchedProductIndex > -1) {
          this.addQtyToCartProduct(reqInfo.req.body.qty, matchedProductIndex);
        } else {
          this.addProductToCart(reqInfo.req.body);
        }
      } else if (reqInfo.id === 'clear') {
        this.clearCart();
      }

      return {
        body: this.cart,
        status: STATUS.OK
      };
    });
  }
github graycoreio / daffodil / libs / state / src / cart / testing / services / cart.testing.service.ts View on Github external
return reqInfo.utils.createResponse$(() => {

      if(reqInfo.id === "addToCart") {
        let matchedProductIndex = this.getMatchedProductIndex(reqInfo.req.body.productId);  
        if(matchedProductIndex > -1) {
          this.addQtyToCartProduct(reqInfo.req.body.qty, matchedProductIndex);
        } else {
          this.addProductToCart(reqInfo.req.body);
        }
      }
      
      return {
        body: this.cart,
        status: STATUS.OK
      }
    })
  }
github graycoreio / daffodil / libs / driver / in-memory / src / product / in-mem / product.testing.service.ts View on Github external
return reqInfo.utils.createResponse$(() => {
          return {
            body: this.products.slice(0,4),
            status: STATUS.OK
          };
      });
    }
github graycoreio / daffodil / libs / category / testing / src / inmemory-backend / category.service.ts View on Github external
return reqInfo.utils.createResponse$(() => {
      return {
        body: {
          category: this.category,
          categoryPageConfigurationState: this.categoryPageConfigurationState,
          products: this.productInMemoryBackendService.products
        },
        status: STATUS.OK
      };
    });
  }
github graycoreio / daffodil / libs / driver / in-memory / src / cart / in-mem / cart.testing.service.ts View on Github external
if (reqInfo.id === 'addToCart') {
        const matchedProductIndex = this.getMatchedProductIndex(
          reqInfo.req.body.productId
        );
        if (matchedProductIndex > -1) {
          this.addQtyToCartProduct(reqInfo.req.body.qty, matchedProductIndex);
        } else {
          this.addProductToCart(reqInfo.req.body);
        }
      } else if (reqInfo.id === 'clear') {
        this.clearCart();
      }

      return {
        body: this.cart,
        status: STATUS.OK
      };
    });
  }
github graycoreio / daffodil / libs / state / src / product / testing / services / product.testing.service.ts View on Github external
return reqInfo.utils.createResponse$(() => {
          return {
            body: this.products.splice(1,4),
            status: STATUS.OK
          };
      });
    }
github graycoreio / daffodil / libs / product / testing / src / inmemory-backend / product.service.ts View on Github external
return reqInfo.utils.createResponse$(() => {
          return {
            body: this.products.slice(0,4),
            status: STATUS.OK
          };
      });
    }