]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: fix linting in unittest
authorLaura Flores <lflores@redhat.com>
Wed, 22 Sep 2021 21:36:33 +0000 (21:36 +0000)
committerLaura Flores <lflores@redhat.com>
Wed, 22 Sep 2021 21:36:58 +0000 (21:36 +0000)
Signed-off-by: Laura Flores <lflores@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts

index 2d809cca817df3bfe041d0cdf9c06bd897007e93..525a1ed38c93d5e89375d3ab7b09685da46f51d2 100644 (file)
@@ -170,33 +170,54 @@ describe('TelemetryComponent', () => {
       expect(component).toBeTruthy();
     });
 
-    it ('should only replace the ranges and values of a JSON object', () => {
-      var report = component.replacerTest({'ranges': [[null, -1], [0, 511], [512, 1023]],
-                                           'values': [[0,0,0], [0,0,0], [0,0,0]],
-                                          'other': [[0,0,0], [0,0,0], [0,0,0]]});
+    it('should only replace the ranges and values of a JSON object', () => {
+      let report = component.replacerTest({
+        ranges: [
+          [null, -1],
+          [0, 511],
+          [512, 1023]
+        ],
+        values: [
+          [0, 0, 0],
+          [0, 0, 0],
+          [0, 0, 0]
+        ],
+        other: [
+          [0, 0, 0],
+          [0, 0, 0],
+          [0, 0, 0]
+        ]
+      });
       report = JSON.parse(report);
 
       // Ensure that the outer arrays have remained untouched by replacer
-      expect(Array.isArray(report['ranges']) && Array.isArray(report['values']) && Array.isArray(report['other'])).toBeTruthy()
-
-      if (Array.isArray(report['ranges']) && Array.isArray(report['values']) && Array.isArray(report['other'])) {
-        var idx;
+      expect(
+        Array.isArray(report['ranges']) &&
+          Array.isArray(report['values']) &&
+          Array.isArray(report['other'])
+      ).toBeTruthy();
+
+      if (
+        Array.isArray(report['ranges']) &&
+        Array.isArray(report['values']) &&
+        Array.isArray(report['other'])
+      ) {
+        let idx;
 
         // Check that each range in 'ranges' was replaced by a string
-       for (idx=0; idx<report['ranges'].length; idx++) {
-               expect(typeof report['ranges'][idx] === 'string').toBeTruthy();
+        for (idx = 0; idx < report['ranges'].length; idx++) {
+          expect(typeof report['ranges'][idx] === 'string').toBeTruthy();
         }
 
-       // Check that each value in 'values' was replaced by a string
-       for (idx=0; idx<report['values'].length; idx++) {
-                expect(typeof report['values'][idx] === 'string').toBeTruthy();
+        // Check that each value in 'values' was replaced by a string
+        for (idx = 0; idx < report['values'].length; idx++) {
+          expect(typeof report['values'][idx] === 'string').toBeTruthy();
         }
 
-       // Check that each value in 'other' has remained untouched, as it is not a value or range
-       for (idx=0; idx<report['other'].length; idx++) {
-                expect(Array.isArray(report['other'][idx])).toBeTruthy();
+        // Check that each value in 'other' has remained untouched, as it is not a value or range
+        for (idx = 0; idx < report['other'].length; idx++) {
+          expect(Array.isArray(report['other'][idx])).toBeTruthy();
         }
-
       }
     });