describe('DevicesComponent', () => {
let comp: DevicesComponent;
let fixture: ComponentFixture<DevicesComponent>;
let service: DevicesService;
const testDeviceApis: AppApi[] = plainToClass(AppApi, [
{
name: 'app_name',
device_apis: [
{
name: 'type',
description: 'description',
fields: [
{
name: 'text field',
description: 'text field',
schema: {
type: 'string',
},
},
{
name: 'number field',
schema: {
type: 'integer',
},
},
{
name: 'boolean field',
schema: {
type: 'integer',
},
},
],
},
],
},
]);
const testDevices: Device[] = plainToClass(Device, [
{
id: 1,
name: 'name',
description: 'description',
type: 'type',
app_name: 'app_name',
fields: [
{
name: 'text field',
value: 'hello',
},
{
name: 'number field',
value: 5,
},
{
name: 'boolean field',
value: true,
},
],
},
]);
/**
* async beforeEach
*/
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
HttpModule,
NgbModule.forRoot(),
NgxDatatableModule,
JwtModule.forRoot({
config: {
tokenGetter: jwtTokenGetter,
blacklistedRoutes: ['/login', '/api/auth', '/api/auth/logout', '/api/auth/refresh']
}
}),
ToastrModule.forRoot({ positionClass: 'toast-bottom-right' })
// FormsModule,
// ReactiveFormsModule,
],
declarations: [DevicesComponent],
schemas: [NO_ERRORS_SCHEMA],
providers: [DevicesService, JwtInterceptor,
// Providing JwtInterceptor allow to inject JwtInterceptor manually into RefreshTokenInterceptor
{
provide: HTTP_INTERCEPTORS,
useExisting: JwtInterceptor,
multi: true
},
{
provide: HTTP_INTERCEPTORS,
useClass: RefreshTokenInterceptor,
multi: true
}],
})
.compileComponents();
}));
/**
//.........这里部分代码省略.........
请发表评论