mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
|
|
|
|
import InfluxQuery = require('../influx_query');
|
|
|
|
describe.only('InfluxQuery', function() {
|
|
|
|
describe('series with mesurement only', function() {
|
|
it('should generate correct query', function() {
|
|
var query = new InfluxQuery({
|
|
measurement: 'cpu',
|
|
});
|
|
|
|
var queryText = query.render();
|
|
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($interval)');
|
|
});
|
|
});
|
|
|
|
describe('series with math and alias', function() {
|
|
it('should generate correct query', function() {
|
|
var query = new InfluxQuery({
|
|
measurement: 'cpu',
|
|
select: [
|
|
[
|
|
{name: 'mean', params: ['value']},
|
|
{name: 'math', params: ['/100']},
|
|
{name: 'alias', params: ['text']},
|
|
]
|
|
]
|
|
});
|
|
|
|
var queryText = query.render();
|
|
expect(queryText).to.be('SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($interval)');
|
|
});
|
|
});
|
|
|
|
});
|