|
|
@@ -2,10 +2,9 @@ import _ from 'lodash';
|
|
|
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
|
|
|
import ResponseParser from '../response_parser';
|
|
|
|
|
|
-describe.only("influxdb response parser", () => {
|
|
|
+describe("influxdb response parser", () => {
|
|
|
+ this.parser = new ResponseParser();
|
|
|
describe("SHOW_TAGS response", () => {
|
|
|
- this.parser = new ResponseParser();
|
|
|
-
|
|
|
describe("response from 0.10.0", () => {
|
|
|
var response = {
|
|
|
"results": [
|
|
|
@@ -29,6 +28,30 @@ describe.only("influxdb response parser", () => {
|
|
|
expect(result[1].text).to.be("server2");
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ describe("response from 0.11.0", () => {
|
|
|
+ var response = {
|
|
|
+ "results": [
|
|
|
+ {
|
|
|
+ "series": [
|
|
|
+ {
|
|
|
+ "name": "cpu",
|
|
|
+ "columns": [ "key", "value"],
|
|
|
+ "values": [ [ "source", "site" ], [ "source", "api" ] ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+
|
|
|
+ var result = this.parser.parse('SHOW_TAGS', response);
|
|
|
+
|
|
|
+ it("should get two responses", () => {
|
|
|
+ expect(_.size(result)).to.be(2);
|
|
|
+ expect(result[0].text).to.be('site');
|
|
|
+ expect(result[1].text).to.be('api');
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
describe("SHOW_FIELDS response", () => {
|
|
|
@@ -54,5 +77,27 @@ describe.only("influxdb response parser", () => {
|
|
|
expect(_.size(result)).to.be(6);
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ describe("response from 0.11.0", () => {
|
|
|
+ var response = {
|
|
|
+ "results": [
|
|
|
+ {
|
|
|
+ "series": [
|
|
|
+ {
|
|
|
+ "name": "cpu",
|
|
|
+ "columns": ["fieldKey"],
|
|
|
+ "values": [ [ "value"] ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+
|
|
|
+ var result = this.parser.parse('SHOW_FIELDS', response);
|
|
|
+
|
|
|
+ it("should get two responses", () => {
|
|
|
+ expect(_.size(result)).to.be(1);
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
});
|