import { MwUrlService } from './url.service'; import { of } from 'rxjs'; import { MwHttpConfigService } from './config.service'; describe('url.service.ts', () => { let service: MwUrlService; beforeEach(() => { const httpConfig: MwHttpConfigService = { getConfig: () => { return of({ urlPlaceholders: [ { name: 'companyId', value: of('1'), }, ], }); }, } as any; service = new MwUrlService(httpConfig); }); it('handleUrl - should replace all placeholders in the URL', () => { const url = 'api/{companyId}/?$filter=CompanyId eq {companyId}'; let result = ''; service.replacePlaceholders(url).subscribe((t) => (result = t)); expect(result).toBe('api/1/?$filter=CompanyId eq 1'); }); });