mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tslint: changing vars -> const (#13034)
This commit is contained in:
@@ -324,7 +324,7 @@ function accessScenario(name, url, fn) {
|
||||
|
||||
it('tracing headers should be added', () => {
|
||||
ctx.instanceSettings.url = url;
|
||||
var ds = new GraphiteDatasource(ctx.instanceSettings, ctx.$q, ctx.backendSrv, ctx.templateSrv);
|
||||
const ds = new GraphiteDatasource(ctx.instanceSettings, ctx.$q, ctx.backendSrv, ctx.templateSrv);
|
||||
ds.addTracingHeaders(httpOptions, options);
|
||||
fn(httpOptions);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import gfunc from '../gfunc';
|
||||
|
||||
describe('when creating func instance from func names', function() {
|
||||
it('should return func instance', function() {
|
||||
var func = gfunc.createFuncInstance('sumSeries');
|
||||
const func = gfunc.createFuncInstance('sumSeries');
|
||||
expect(func).toBeTruthy();
|
||||
expect(func.def.name).toEqual('sumSeries');
|
||||
expect(func.def.params.length).toEqual(1);
|
||||
@@ -11,18 +11,18 @@ describe('when creating func instance from func names', function() {
|
||||
});
|
||||
|
||||
it('should return func instance with shortName', function() {
|
||||
var func = gfunc.createFuncInstance('sum');
|
||||
const func = gfunc.createFuncInstance('sum');
|
||||
expect(func).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return func instance from funcDef', function() {
|
||||
var func = gfunc.createFuncInstance('sum');
|
||||
var func2 = gfunc.createFuncInstance(func.def);
|
||||
const func = gfunc.createFuncInstance('sum');
|
||||
const func2 = gfunc.createFuncInstance(func.def);
|
||||
expect(func2).toBeTruthy();
|
||||
});
|
||||
|
||||
it('func instance should have text representation', function() {
|
||||
var func = gfunc.createFuncInstance('groupByNode');
|
||||
const func = gfunc.createFuncInstance('groupByNode');
|
||||
func.params[0] = 5;
|
||||
func.params[1] = 'avg';
|
||||
func.updateText();
|
||||
@@ -32,62 +32,62 @@ describe('when creating func instance from func names', function() {
|
||||
|
||||
describe('when rendering func instance', function() {
|
||||
it('should handle single metric param', function() {
|
||||
var func = gfunc.createFuncInstance('sumSeries');
|
||||
const func = gfunc.createFuncInstance('sumSeries');
|
||||
expect(func.render('hello.metric')).toEqual('sumSeries(hello.metric)');
|
||||
});
|
||||
|
||||
it('should include default params if options enable it', function() {
|
||||
var func = gfunc.createFuncInstance('scaleToSeconds', {
|
||||
const func = gfunc.createFuncInstance('scaleToSeconds', {
|
||||
withDefaultParams: true,
|
||||
});
|
||||
expect(func.render('hello')).toEqual('scaleToSeconds(hello, 1)');
|
||||
});
|
||||
|
||||
it('should handle int or interval params with number', function() {
|
||||
var func = gfunc.createFuncInstance('movingMedian');
|
||||
const func = gfunc.createFuncInstance('movingMedian');
|
||||
func.params[0] = '5';
|
||||
expect(func.render('hello')).toEqual('movingMedian(hello, 5)');
|
||||
});
|
||||
|
||||
it('should handle int or interval params with interval string', function() {
|
||||
var func = gfunc.createFuncInstance('movingMedian');
|
||||
const func = gfunc.createFuncInstance('movingMedian');
|
||||
func.params[0] = '5min';
|
||||
expect(func.render('hello')).toEqual("movingMedian(hello, '5min')");
|
||||
});
|
||||
|
||||
it('should never quote boolean paramater', function() {
|
||||
var func = gfunc.createFuncInstance('sortByName');
|
||||
const func = gfunc.createFuncInstance('sortByName');
|
||||
func.params[0] = '$natural';
|
||||
expect(func.render('hello')).toEqual('sortByName(hello, $natural)');
|
||||
});
|
||||
|
||||
it('should never quote int paramater', function() {
|
||||
var func = gfunc.createFuncInstance('maximumAbove');
|
||||
const func = gfunc.createFuncInstance('maximumAbove');
|
||||
func.params[0] = '$value';
|
||||
expect(func.render('hello')).toEqual('maximumAbove(hello, $value)');
|
||||
});
|
||||
|
||||
it('should never quote node paramater', function() {
|
||||
var func = gfunc.createFuncInstance('aliasByNode');
|
||||
const func = gfunc.createFuncInstance('aliasByNode');
|
||||
func.params[0] = '$node';
|
||||
expect(func.render('hello')).toEqual('aliasByNode(hello, $node)');
|
||||
});
|
||||
|
||||
it('should handle metric param and int param and string param', function() {
|
||||
var func = gfunc.createFuncInstance('groupByNode');
|
||||
const func = gfunc.createFuncInstance('groupByNode');
|
||||
func.params[0] = 5;
|
||||
func.params[1] = 'avg';
|
||||
expect(func.render('hello.metric')).toEqual("groupByNode(hello.metric, 5, 'avg')");
|
||||
});
|
||||
|
||||
it('should handle function with no metric param', function() {
|
||||
var func = gfunc.createFuncInstance('randomWalk');
|
||||
const func = gfunc.createFuncInstance('randomWalk');
|
||||
func.params[0] = 'test';
|
||||
expect(func.render(undefined)).toEqual("randomWalk('test')");
|
||||
});
|
||||
|
||||
it('should handle function multiple series params', function() {
|
||||
var func = gfunc.createFuncInstance('asPercent');
|
||||
const func = gfunc.createFuncInstance('asPercent');
|
||||
func.params[0] = '#B';
|
||||
expect(func.render('#A')).toEqual('asPercent(#A, #B)');
|
||||
});
|
||||
@@ -95,14 +95,14 @@ describe('when rendering func instance', function() {
|
||||
|
||||
describe('when requesting function definitions', function() {
|
||||
it('should return function definitions', function() {
|
||||
var funcIndex = gfunc.getFuncDefs('1.0');
|
||||
const funcIndex = gfunc.getFuncDefs('1.0');
|
||||
expect(Object.keys(funcIndex).length).toBeGreaterThan(8);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when updating func param', function() {
|
||||
it('should update param value and update text representation', function() {
|
||||
var func = gfunc.createFuncInstance('summarize', {
|
||||
const func = gfunc.createFuncInstance('summarize', {
|
||||
withDefaultParams: true,
|
||||
});
|
||||
func.updateParam('1h', 0);
|
||||
@@ -111,7 +111,7 @@ describe('when updating func param', function() {
|
||||
});
|
||||
|
||||
it('should parse numbers as float', function() {
|
||||
var func = gfunc.createFuncInstance('scale');
|
||||
const func = gfunc.createFuncInstance('scale');
|
||||
func.updateParam('0.001', 0);
|
||||
expect(func.params[0]).toBe('0.001');
|
||||
});
|
||||
@@ -119,13 +119,13 @@ describe('when updating func param', function() {
|
||||
|
||||
describe('when updating func param with optional second parameter', function() {
|
||||
it('should update value and text', function() {
|
||||
var func = gfunc.createFuncInstance('aliasByNode');
|
||||
const func = gfunc.createFuncInstance('aliasByNode');
|
||||
func.updateParam('1', 0);
|
||||
expect(func.params[0]).toBe('1');
|
||||
});
|
||||
|
||||
it('should slit text and put value in second param', function() {
|
||||
var func = gfunc.createFuncInstance('aliasByNode');
|
||||
const func = gfunc.createFuncInstance('aliasByNode');
|
||||
func.updateParam('4,-5', 0);
|
||||
expect(func.params[0]).toBe('4');
|
||||
expect(func.params[1]).toBe('-5');
|
||||
@@ -133,7 +133,7 @@ describe('when updating func param with optional second parameter', function() {
|
||||
});
|
||||
|
||||
it('should remove second param when empty string is set', function() {
|
||||
var func = gfunc.createFuncInstance('aliasByNode');
|
||||
const func = gfunc.createFuncInstance('aliasByNode');
|
||||
func.updateParam('4,-5', 0);
|
||||
func.updateParam('', 1);
|
||||
expect(func.params[0]).toBe('4');
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Lexer } from '../lexer';
|
||||
|
||||
describe('when lexing graphite expression', function() {
|
||||
it('should tokenize metric expression', function() {
|
||||
var lexer = new Lexer('metric.test.*.asd.count');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('metric.test.*.asd.count');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[0].value).toBe('metric');
|
||||
expect(tokens[1].value).toBe('.');
|
||||
expect(tokens[2].type).toBe('identifier');
|
||||
@@ -12,36 +12,36 @@ describe('when lexing graphite expression', function() {
|
||||
});
|
||||
|
||||
it('should tokenize metric expression with dash', function() {
|
||||
var lexer = new Lexer('metric.test.se1-server-*.asd.count');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('metric.test.se1-server-*.asd.count');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[4].type).toBe('identifier');
|
||||
expect(tokens[4].value).toBe('se1-server-*');
|
||||
});
|
||||
|
||||
it('should tokenize metric expression with dash2', function() {
|
||||
var lexer = new Lexer('net.192-168-1-1.192-168-1-9.ping_value.*');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('net.192-168-1-1.192-168-1-9.ping_value.*');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[0].value).toBe('net');
|
||||
expect(tokens[2].value).toBe('192-168-1-1');
|
||||
});
|
||||
|
||||
it('should tokenize metric expression with equal sign', function() {
|
||||
var lexer = new Lexer('apps=test');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('apps=test');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[0].value).toBe('apps=test');
|
||||
});
|
||||
|
||||
it('simple function2', function() {
|
||||
var lexer = new Lexer('offset(test.metric, -100)');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('offset(test.metric, -100)');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[2].type).toBe('identifier');
|
||||
expect(tokens[4].type).toBe('identifier');
|
||||
expect(tokens[6].type).toBe('number');
|
||||
});
|
||||
|
||||
it('should tokenize metric expression with curly braces', function() {
|
||||
var lexer = new Lexer('metric.se1-{first, second}.count');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('metric.se1-{first, second}.count');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens.length).toBe(10);
|
||||
expect(tokens[3].type).toBe('{');
|
||||
expect(tokens[4].value).toBe('first');
|
||||
@@ -50,8 +50,8 @@ describe('when lexing graphite expression', function() {
|
||||
});
|
||||
|
||||
it('should tokenize metric expression with number segments', function() {
|
||||
var lexer = new Lexer('metric.10.12_10.test');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('metric.10.12_10.test');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[0].type).toBe('identifier');
|
||||
expect(tokens[2].type).toBe('identifier');
|
||||
expect(tokens[2].value).toBe('10');
|
||||
@@ -60,16 +60,16 @@ describe('when lexing graphite expression', function() {
|
||||
});
|
||||
|
||||
it('should tokenize metric expression with segment that start with number', function() {
|
||||
var lexer = new Lexer('metric.001-server');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('metric.001-server');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[0].type).toBe('identifier');
|
||||
expect(tokens[2].type).toBe('identifier');
|
||||
expect(tokens.length).toBe(3);
|
||||
});
|
||||
|
||||
it('should tokenize func call with numbered metric and number arg', function() {
|
||||
var lexer = new Lexer('scale(metric.10, 15)');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('scale(metric.10, 15)');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[0].type).toBe('identifier');
|
||||
expect(tokens[2].type).toBe('identifier');
|
||||
expect(tokens[2].value).toBe('metric');
|
||||
@@ -79,24 +79,24 @@ describe('when lexing graphite expression', function() {
|
||||
});
|
||||
|
||||
it('should tokenize metric with template parameter', function() {
|
||||
var lexer = new Lexer('metric.[[server]].test');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('metric.[[server]].test');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[2].type).toBe('identifier');
|
||||
expect(tokens[2].value).toBe('[[server]]');
|
||||
expect(tokens[4].type).toBe('identifier');
|
||||
});
|
||||
|
||||
it('should tokenize metric with question mark', function() {
|
||||
var lexer = new Lexer('metric.server_??.test');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('metric.server_??.test');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[2].type).toBe('identifier');
|
||||
expect(tokens[2].value).toBe('server_??');
|
||||
expect(tokens[4].type).toBe('identifier');
|
||||
});
|
||||
|
||||
it('should handle error with unterminated string', function() {
|
||||
var lexer = new Lexer("alias(metric, 'asd)");
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer("alias(metric, 'asd)");
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[0].value).toBe('alias');
|
||||
expect(tokens[1].value).toBe('(');
|
||||
expect(tokens[2].value).toBe('metric');
|
||||
@@ -107,15 +107,15 @@ describe('when lexing graphite expression', function() {
|
||||
});
|
||||
|
||||
it('should handle float parameters', function() {
|
||||
var lexer = new Lexer('alias(metric, 0.002)');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('alias(metric, 0.002)');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[4].type).toBe('number');
|
||||
expect(tokens[4].value).toBe('0.002');
|
||||
});
|
||||
|
||||
it('should handle bool parameters', function() {
|
||||
var lexer = new Lexer('alias(metric, true, false)');
|
||||
var tokens = lexer.tokenize();
|
||||
const lexer = new Lexer('alias(metric, true, false)');
|
||||
const tokens = lexer.tokenize();
|
||||
expect(tokens[4].type).toBe('bool');
|
||||
expect(tokens[4].value).toBe('true');
|
||||
expect(tokens[6].type).toBe('bool');
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Parser } from '../parser';
|
||||
|
||||
describe('when parsing', function() {
|
||||
it('simple metric expression', function() {
|
||||
var parser = new Parser('metric.test.*.asd.count');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('metric.test.*.asd.count');
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.type).toBe('metric');
|
||||
expect(rootNode.segments.length).toBe(5);
|
||||
@@ -11,8 +11,8 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('simple metric expression with numbers in segments', function() {
|
||||
var parser = new Parser('metric.10.15_20.5');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('metric.10.15_20.5');
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.type).toBe('metric');
|
||||
expect(rootNode.segments.length).toBe(4);
|
||||
@@ -22,8 +22,8 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('simple metric expression with curly braces', function() {
|
||||
var parser = new Parser('metric.se1-{count, max}');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('metric.se1-{count, max}');
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.type).toBe('metric');
|
||||
expect(rootNode.segments.length).toBe(2);
|
||||
@@ -31,8 +31,8 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('simple metric expression with curly braces at start of segment and with post chars', function() {
|
||||
var parser = new Parser('metric.{count, max}-something.count');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('metric.{count, max}-something.count');
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.type).toBe('metric');
|
||||
expect(rootNode.segments.length).toBe(3);
|
||||
@@ -40,31 +40,31 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('simple function', function() {
|
||||
var parser = new Parser('sum(test)');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('sum(test)');
|
||||
const rootNode = parser.getAst();
|
||||
expect(rootNode.type).toBe('function');
|
||||
expect(rootNode.params.length).toBe(1);
|
||||
});
|
||||
|
||||
it('simple function2', function() {
|
||||
var parser = new Parser('offset(test.metric, -100)');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('offset(test.metric, -100)');
|
||||
const rootNode = parser.getAst();
|
||||
expect(rootNode.type).toBe('function');
|
||||
expect(rootNode.params[0].type).toBe('metric');
|
||||
expect(rootNode.params[1].type).toBe('number');
|
||||
});
|
||||
|
||||
it('simple function with string arg', function() {
|
||||
var parser = new Parser("randomWalk('test')");
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser("randomWalk('test')");
|
||||
const rootNode = parser.getAst();
|
||||
expect(rootNode.type).toBe('function');
|
||||
expect(rootNode.params.length).toBe(1);
|
||||
expect(rootNode.params[0].type).toBe('string');
|
||||
});
|
||||
|
||||
it('function with multiple args', function() {
|
||||
var parser = new Parser("sum(test, 1, 'test')");
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser("sum(test, 1, 'test')");
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.type).toBe('function');
|
||||
expect(rootNode.params.length).toBe(3);
|
||||
@@ -74,8 +74,8 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('function with nested function', function() {
|
||||
var parser = new Parser('sum(scaleToSeconds(test, 1))');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('sum(scaleToSeconds(test, 1))');
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.type).toBe('function');
|
||||
expect(rootNode.params.length).toBe(1);
|
||||
@@ -87,8 +87,8 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('function with multiple series', function() {
|
||||
var parser = new Parser('sum(test.test.*.count, test.timers.*.count)');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('sum(test.test.*.count, test.timers.*.count)');
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.type).toBe('function');
|
||||
expect(rootNode.params.length).toBe(2);
|
||||
@@ -97,8 +97,8 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('function with templated series', function() {
|
||||
var parser = new Parser('sum(test.[[server]].count)');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('sum(test.[[server]].count)');
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.message).toBe(undefined);
|
||||
expect(rootNode.params[0].type).toBe('metric');
|
||||
@@ -107,54 +107,54 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('invalid metric expression', function() {
|
||||
var parser = new Parser('metric.test.*.asd.');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('metric.test.*.asd.');
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.message).toBe('Expected metric identifier instead found end of string');
|
||||
expect(rootNode.pos).toBe(19);
|
||||
});
|
||||
|
||||
it('invalid function expression missing closing parenthesis', function() {
|
||||
var parser = new Parser('sum(test');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('sum(test');
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.message).toBe('Expected closing parenthesis instead found end of string');
|
||||
expect(rootNode.pos).toBe(9);
|
||||
});
|
||||
|
||||
it('unclosed string in function', function() {
|
||||
var parser = new Parser("sum('test)");
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser("sum('test)");
|
||||
const rootNode = parser.getAst();
|
||||
|
||||
expect(rootNode.message).toBe('Unclosed string parameter');
|
||||
expect(rootNode.pos).toBe(11);
|
||||
});
|
||||
|
||||
it('handle issue #69', function() {
|
||||
var parser = new Parser('cactiStyle(offset(scale(net.192-168-1-1.192-168-1-9.ping_value.*,0.001),-100))');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('cactiStyle(offset(scale(net.192-168-1-1.192-168-1-9.ping_value.*,0.001),-100))');
|
||||
const rootNode = parser.getAst();
|
||||
expect(rootNode.type).toBe('function');
|
||||
});
|
||||
|
||||
it('handle float function arguments', function() {
|
||||
var parser = new Parser('scale(test, 0.002)');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('scale(test, 0.002)');
|
||||
const rootNode = parser.getAst();
|
||||
expect(rootNode.type).toBe('function');
|
||||
expect(rootNode.params[1].type).toBe('number');
|
||||
expect(rootNode.params[1].value).toBe(0.002);
|
||||
});
|
||||
|
||||
it('handle curly brace pattern at start', function() {
|
||||
var parser = new Parser('{apps}.test');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('{apps}.test');
|
||||
const rootNode = parser.getAst();
|
||||
expect(rootNode.type).toBe('metric');
|
||||
expect(rootNode.segments[0].value).toBe('{apps}');
|
||||
expect(rootNode.segments[1].value).toBe('test');
|
||||
});
|
||||
|
||||
it('series parameters', function() {
|
||||
var parser = new Parser('asPercent(#A, #B)');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('asPercent(#A, #B)');
|
||||
const rootNode = parser.getAst();
|
||||
expect(rootNode.type).toBe('function');
|
||||
expect(rootNode.params[0].type).toBe('series-ref');
|
||||
expect(rootNode.params[0].value).toBe('#A');
|
||||
@@ -162,8 +162,8 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('series parameters, issue 2788', function() {
|
||||
var parser = new Parser("summarize(diffSeries(#A, #B), '10m', 'sum', false)");
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser("summarize(diffSeries(#A, #B), '10m', 'sum', false)");
|
||||
const rootNode = parser.getAst();
|
||||
expect(rootNode.type).toBe('function');
|
||||
expect(rootNode.params[0].type).toBe('function');
|
||||
expect(rootNode.params[1].value).toBe('10m');
|
||||
@@ -171,8 +171,8 @@ describe('when parsing', function() {
|
||||
});
|
||||
|
||||
it('should parse metric expression with ip number segments', function() {
|
||||
var parser = new Parser('5.10.123.5');
|
||||
var rootNode = parser.getAst();
|
||||
const parser = new Parser('5.10.123.5');
|
||||
const rootNode = parser.getAst();
|
||||
expect(rootNode.segments[0].value).toBe('5');
|
||||
expect(rootNode.segments[1].value).toBe('10');
|
||||
expect(rootNode.segments[2].value).toBe('123');
|
||||
|
||||
Reference in New Issue
Block a user