فهرست منبع

add test for prometheus table column title

Mitsuhiro Tanda 7 سال پیش
والد
کامیت
253b2cc081
1فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 12 0
      public/app/plugins/datasource/prometheus/specs/result_transformer.jest.ts

+ 12 - 0
public/app/plugins/datasource/prometheus/specs/result_transformer.jest.ts

@@ -47,6 +47,18 @@ describe('Prometheus Result Transformer', () => {
         { text: 'Value' },
         { text: 'Value' },
       ]);
       ]);
     });
     });
+
+    it('should column title include refId if response count is more than 2', () => {
+      var table = ctx.resultTransformer.transformMetricDataToTable(response.data.result, 2, "B");
+      expect(table.type).toBe('table');
+      expect(table.columns).toEqual([
+        { text: 'Time', type: 'time' },
+        { text: '__name__' },
+        { text: 'instance' },
+        { text: 'job' },
+        { text: 'Value #B' },
+      ]);
+    });
   });
   });
 
 
   describe('When resultFormat is table and instant = true', () => {
   describe('When resultFormat is table and instant = true', () => {