GitHub

MockDaffProductFacade

import { MockDaffProductFacade } from '@daffodil/product/state/testing'

@Injectable()
class MockDaffProductFacade implements DaffProductFacadeInterface {
  getProduct(id: string): BehaviorSubject<DaffProduct>
  getPrice(id: string): BehaviorSubject<number>
  hasDiscount(id: string): BehaviorSubject<boolean>
  getDiscountAmount(id: string): BehaviorSubject<number>
  getDiscountedPrice(id: string): BehaviorSubject<number>
  getDiscountPercent(id: string): BehaviorSubject<number>
  isOutOfStock(id: string): BehaviorSubject<boolean>
  dispatch(action): void
}

() Methods

getProduct
BehaviorSubject<DaffProduct>

Get a product.

Parameters
Parameterid: string
Description
getPrice
BehaviorSubject<number>

Get the original price for a product.

Parameters
Parameterid: string
Description
hasDiscount
BehaviorSubject<boolean>

Whether a particular product has a discount.

Parameters
Parameterid: string
Description
getDiscountAmount
BehaviorSubject<number>

Get the discount amount of a product.

Parameters
Parameterid: string
Description
getDiscountedPrice
BehaviorSubject<number>

Get the discounted price for a product.

Parameters
Parameterid: string
Description
getDiscountPercent
BehaviorSubject<number>

Get the discount percent of a product.

Parameters
Parameterid: string
Description
isOutOfStock
BehaviorSubject<boolean>

Whether a product is out of stock.

Parameters
Parameterid: string
Description
dispatch
void
Parameters
Parameteraction: undefined
Description