GitHub

MockDaffCategoryFacade

Can be used to mock out the DaffCategoryFacade in testing environments.

import { MockDaffCategoryFacade } from '@daffodil/category/state/testing'
@Injectable()
class MockDaffCategoryFacade implements DaffCategoryFacadeInterface {
  category$: BehaviorSubject<DaffCategory>
  loadingState$: BehaviorSubject<DaffCategoryReducerState['daffState']>
  loading$: BehaviorSubject<boolean>
  mutating$: BehaviorSubject<boolean>
  resolving$: BehaviorSubject<boolean>
  hasErrors$: BehaviorSubject<boolean>
  products$: BehaviorSubject<DaffProduct[]>
  errors$: BehaviorSubject<DaffStateError[]>
  isCategoryEmpty$: BehaviorSubject<boolean>
  getCategoryById(id: string): BehaviorSubject<DaffCategory>
  getProductsByCategory(categoryId: string): BehaviorSubject<DaffProduct[]>
  getTotalProductsByCategory(categoryId: string): BehaviorSubject<number>
  dispatch(action: Action<string>)
}

Properties

Name Type Description
category$ BehaviorSubject<DaffCategory>

The currently selected category.

loadingState$ BehaviorSubject<DaffCategoryReducerState['daffState']>
loading$ BehaviorSubject<boolean>
mutating$ BehaviorSubject<boolean>
resolving$ BehaviorSubject<boolean>
hasErrors$ BehaviorSubject<boolean>
products$ BehaviorSubject<DaffProduct[]>

Products of the current category.

errors$ BehaviorSubject<DaffStateError[]>
isCategoryEmpty$ BehaviorSubject<boolean>

Is the category page empty of products.

getCategoryById BehaviorSubject<DaffCategory>

Get a category by the provided Id.

getProductsByCategory BehaviorSubject<DaffProduct[]>

Get products by a category Id.

getTotalProductsByCategory BehaviorSubject<number>

Get products by a category Id.

dispatch