import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '~/testing/unit-test-helper';
import { ImageSpec } from '../models/image-spec';
import { RbdConfigurationService } from '../services/rbd-configuration.service';
import { RbdService } from './rbd.service';
let httpTesting: HttpTestingController;
configureTestBed({
- providers: [RbdService, RbdConfigurationService, i18nProviders],
+ providers: [RbdService, RbdConfigurationService],
imports: [HttpClientTestingModule]
});
beforeEach(() => {
- service = TestBed.get(RbdService);
- httpTesting = TestBed.get(HttpTestingController);
+ service = TestBed.inject(RbdService);
+ httpTesting = TestBed.inject(HttpTestingController);
});
afterEach(() => {
expect(req.request.method).toBe('GET');
});
+ it('should call cloneFormatVersion', () => {
+ service.cloneFormatVersion().subscribe();
+ const req = httpTesting.expectOne('api/block/image/clone_format_version');
+ expect(req.request.method).toBe('GET');
+ });
+
it('should call createSnapshot', () => {
service.createSnapshot(new ImageSpec('poolName', null, 'rbdName'), 'snapshotName').subscribe();
const req = httpTesting.expectOne('api/block/image/poolName%2FrbdName/snap');