Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 1x 2x 2x 2x 2x 2x 2x 2x 1x 2x 2x 2x 2x 2x | import {
provideHttpClient,
withInterceptorsFromDi,
withXhr
} from '@angular/common/http';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import {
MockOptionCheckboxComponent,
MockSettingsGroupComponent,
MockValueSelectionComponent,
MockValueSliderComponent,
OptionCheckboxComponent,
SettingsGroupComponent,
ValueSelectionComponent,
ValueSliderComponent
} from '@reflex/angular-components/dist';
import {
DEFAULT_SETTINGS
} from '@reflex/shared-types';
import { of } from 'rxjs';
import { PerformanceService } from 'src/shared/services/performance.service';
import { SettingsService } from 'src/shared/services/settingsService';
import { TrackingService } from 'src/shared/services/tracking.service';
import { BASE_URL } from 'src/shared/tokens/base-url.token';
import { LogService } from '../log/log.service';
import { SettingsComponent } from './settings.component';
import { logService, perfData, performanceService, settingsService, state, trackingService } from './settings.component.test-data';
export let component: SettingsComponent;
export let fixture: ComponentFixture<SettingsComponent>;
export function setupTests(): void {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [FormsModule, SettingsComponent],
providers: [
{
provide: TrackingService,
useValue: trackingService
},
{
provide: PerformanceService,
useValue: performanceService
},
{
provide: SettingsService,
useValue: settingsService
},
{
provide: LogService,
useValue: logService
},
{
provide: BASE_URL,
useValue: 'http://localhost'
},
provideHttpClient(withXhr(), withInterceptorsFromDi()),
provideHttpClientTesting()
]
})
.overrideComponent(SettingsComponent, {
remove: {
imports: [
ValueSliderComponent,
OptionCheckboxComponent,
SettingsGroupComponent,
ValueSelectionComponent
]
},
add: {
imports: [
MockValueSliderComponent,
MockOptionCheckboxComponent,
MockSettingsGroupComponent,
MockValueSelectionComponent
]
}
})
.compileComponents();
});
beforeEach(() => {
logService.sendErrorLog.mockReturnValue(undefined);
settingsService.getSettings.mockReturnValue(of(DEFAULT_SETTINGS));
settingsService.getCanRestore.mockReturnValue(
of({ name: 'canRestore', value: true })
);
trackingService.getStatus.mockReturnValue(of(state));
performanceService.getData.mockReturnValue(of(perfData));
fixture = TestBed.createComponent(SettingsComponent);
component = fixture.componentInstance;
});
afterEach(() => {
logService.sendErrorLog.mockClear();
settingsService.getSettings.mockClear();
settingsService.getCanRestore.mockClear();
trackingService.getStatus.mockClear();
performanceService.getData.mockClear();
});
}
|