]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / configuration.service.spec.ts
index 9add3a5b7745bba789dba199f988a14c67999b9a..2c9da18c7e7bae21edd33589ad9a14dce89890fc 100644 (file)
@@ -77,4 +77,23 @@ describe('ConfigurationService', () => {
     const reg = httpTesting.expectOne('api/cluster_conf/testOption?section=testSection');
     expect(reg.request.method).toBe('DELETE');
   });
+
+  it('should get value', () => {
+    const config = {
+      default: 'a',
+      value: [
+        { section: 'global', value: 'b' },
+        { section: 'mon', value: 'c' },
+        { section: 'mon.1', value: 'd' },
+        { section: 'mds', value: 'e' }
+      ]
+    };
+    expect(service.getValue(config, 'mon.1')).toBe('d');
+    expect(service.getValue(config, 'mon')).toBe('c');
+    expect(service.getValue(config, 'mds.1')).toBe('e');
+    expect(service.getValue(config, 'mds')).toBe('e');
+    expect(service.getValue(config, 'osd')).toBe('b');
+    config.value = [];
+    expect(service.getValue(config, 'osd')).toBe('a');
+  });
 });