]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.spec.ts
import ceph pacific 16.2.5
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / pipes / health-color.pipe.spec.ts
index 0039cf90eb7730435ef0097094f0fa7c38eb38e2..f5e937ce377579bd97704ae3d521b70fe0c65e03 100644 (file)
@@ -1,23 +1,44 @@
-import styles from '~/styles.scss';
-import { HealthColorPipe } from './health-color.pipe';
+import { CssHelper } from '~/app/shared/classes/css-helper';
+import { HealthColorPipe } from '~/app/shared/pipes/health-color.pipe';
+
+class CssHelperStub extends CssHelper {
+  propertyValue(propertyName: string) {
+    if (propertyName === 'health-color-healthy') {
+      return 'fakeGreen';
+    }
+    if (propertyName === 'health-color-warning') {
+      return 'fakeOrange';
+    }
+    if (propertyName === 'health-color-error') {
+      return 'fakeRed';
+    }
+    return '';
+  }
+}
 
 describe('HealthColorPipe', () => {
-  const pipe = new HealthColorPipe();
+  const pipe = new HealthColorPipe(new CssHelperStub());
 
   it('create an instance', () => {
     expect(pipe).toBeTruthy();
   });
 
   it('transforms "HEALTH_OK"', () => {
-    expect(pipe.transform('HEALTH_OK')).toEqual({ color: styles.healthColorHealthy });
+    expect(pipe.transform('HEALTH_OK')).toEqual({
+      color: 'fakeGreen'
+    });
   });
 
   it('transforms "HEALTH_WARN"', () => {
-    expect(pipe.transform('HEALTH_WARN')).toEqual({ color: styles.healthColorWarning });
+    expect(pipe.transform('HEALTH_WARN')).toEqual({
+      color: 'fakeOrange'
+    });
   });
 
   it('transforms "HEALTH_ERR"', () => {
-    expect(pipe.transform('HEALTH_ERR')).toEqual({ color: styles.healthColorError });
+    expect(pipe.transform('HEALTH_ERR')).toEqual({
+      color: 'fakeRed'
+    });
   });
 
   it('transforms others', () => {