import { describe, expect, it, inject, beforeEachProviders, beforeEach } from '@angular/core/testing'; import {mockProductionResponse} from '../../dist/app/mocks/search/response/elastic-search-production.mock'; import {mockProductionResult} from '../../dist/app/mocks/search/result/elastic-search-production.mock'; import {EsSearchRecordTransformService} from '../../dist/app/records/transformers/es-search-record-transformer.service'; describe('es-search record transformer service', () => { let transformer: EsSearchRecordTransformService; beforeEachProviders(() => { return [ EsSearchRecordTransformService ]; }); beforeEach(inject([EsSearchRecordTransformService], t => { transformer = t; })); it('should map flat attributes to a record collection', () => { const responseData = mockProductionResponse.hits.hits; const result = transformer.transform(responseData, {name: 'production'}); expect(result.fields).toEqual(mockProductionResult.fields); expect(result.records).toEqual(mockProductionResult.records); }); });