From 9158cbe9da011901a6c01f823fa40e1a93dc84a5 Mon Sep 17 00:00:00 2001 From: Laura Flores Date: Wed, 22 Sep 2021 21:36:33 +0000 Subject: [PATCH] mgr/dashboard: fix linting in unittest Signed-off-by: Laura Flores --- .../telemetry/telemetry.component.spec.ts | 55 +++++++++++++------ 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts index 2d809cca817..525a1ed38c9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts @@ -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