diff options
Diffstat (limited to '')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts new file mode 100644 index 000000000..b119f5d63 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts @@ -0,0 +1,45 @@ +import { TestBed } from '@angular/core/testing'; + +import { configureTestBed } from '~/testing/unit-test-helper'; +import { RbdConfigurationType } from '../models/configuration'; +import { RbdConfigurationService } from './rbd-configuration.service'; + +describe('RbdConfigurationService', () => { + let service: RbdConfigurationService; + + configureTestBed({ + providers: [RbdConfigurationService] + }); + + beforeEach(() => { + service = TestBed.inject(RbdConfigurationService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); + + it('should filter config options', () => { + const result = service.getOptionByName('rbd_qos_write_iops_burst'); + expect(result).toEqual({ + name: 'rbd_qos_write_iops_burst', + displayName: 'Write IOPS Burst', + description: 'The desired burst limit of write operations.', + type: RbdConfigurationType.iops + }); + }); + + it('should return the display name', () => { + const displayName = service.getDisplayName('rbd_qos_write_iops_burst'); + expect(displayName).toBe('Write IOPS Burst'); + }); + + it('should return the description', () => { + const description = service.getDescription('rbd_qos_write_iops_burst'); + expect(description).toBe('The desired burst limit of write operations.'); + }); + + it('should have a class for each section', () => { + service.sections.forEach((section) => expect(section.class).toBeTruthy()); + }); +}); |