import { createRestAppClient , givenHttpServerConfig } from '@loopback/testlab' ; import { createRecommendationServer } from '../..' ; import { HttpServer } from '@loopback/http-server' ; const data = require ( '../../../data/recommendations.json' ) ; describe ( 'recommender' , ( ) => { let server ; before ( 'starting server' , async ( ) => { const config = givenHttpServerConfig ( ) ; server = createRecommendationServer ( config . port , config . host ) ; await server . start ( ) ; } ) ; after ( 'stopping server' , async ( ) => { if ( server ) { await server . stop ( ) ; } } ) ; it ( 'returns product recommendations' , async ( ) => { const client = createRestAppClient ( { restServer : server , } ) ; await client . get ( '/user002' ) . expect ( 200 , data [ 'user002' ] ) ; } ) ; } ) ;