| 1 |
import { strict as assert } from 'assert'; |
| 2 |
import { TimeSeriesAggregationType } from '.'; |
| 3 |
import testUtils, { GLOBAL } from '../test-utils'; |
| 4 |
import { transformArguments } from './CREATERULE'; |
| 5 |
|
| 6 |
describe('CREATERULE', () => { |
| 7 |
describe('transformArguments', () => { |
| 8 |
it('without options', () => { |
| 9 |
assert.deepEqual( |
| 10 |
transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1), |
| 11 |
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'AVG', '1'] |
| 12 |
); |
| 13 |
}); |
| 14 |
|
| 15 |
it('with alignTimestamp', () => { |
| 16 |
assert.deepEqual( |
| 17 |
transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1, 1), |
| 18 |
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'AVG', '1', '1'] |
| 19 |
); |
| 20 |
}); |
| 21 |
}); |
| 22 |
|
| 23 |
testUtils.testWithClient('client.ts.createRule', async client => { |
| 24 |
await Promise.all([ |
| 25 |
client.ts.create('source'), |
| 26 |
client.ts.create('destination') |
| 27 |
]); |
| 28 |
|
| 29 |
assert.equal( |
| 30 |
await client.ts.createRule('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1), |
| 31 |
'OK' |
| 32 |
); |
| 33 |
}, GLOBAL.SERVERS.OPEN); |
| 34 |
}); |