import { Injectable } from '@angular/core' ; import { Observable , of , } from 'rxjs' ; import { randomSubset } from '@daffodil/core' ; import { DaffModelFactory } from '@daffodil/core/testing' ; import { DaffProduct } from '@daffodil/product' ; import { DaffProductDriverResponse , DaffProductServiceInterface , } from '@daffodil/product/driver' ; import { DaffProductImageFactory , DaffProductExtensionFactory , } from '@daffodil/product/testing' ; inheritdoc param productFactory param productImageFactory @ Injectable ( { providedIn : 'root' , } ) export class DaffTestingProductService implements DaffProductServiceInterface { constructor ( private productFactory , private productImageFactory ) { } getAll ( ) { return of ( [ this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , ] ) ; } getBestSellers ( ) { return of ( [ this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , ] ) ; } get ( productId ) { return of ( { id : productId , products : [ this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) } ) , ] , } ) ; } getByUrl ( url ) { const product = this . productFactory . create ( { images : this . productImageFactory . createMany ( 5 ) , url } ) ; return of ( { id : product . id , products : [ product ] , } ) ; } }