1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
Files
node-redis/packages/time-series/lib/commands/MGET_WITHLABELS.spec.ts
2023-09-18 15:03:07 -04:00

42 lines
1.1 KiB
TypeScript

import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import MGET_WITHLABELS from './MGET_WITHLABELS';
describe('TS.MGET_WITHLABELS', () => {
describe('transformArguments', () => {
it('without options', () => {
assert.deepEqual(
MGET_WITHLABELS.transformArguments('label=value'),
['TS.MGET', 'WITHLABELS', 'FILTER', 'label=value']
);
});
it('with SELECTED_LABELS', () => {
assert.deepEqual(
MGET_WITHLABELS.transformArguments('label=value', {
SELECTED_LABELS: 'label'
}),
['TS.MGET', 'SELECTED_LABELS', 'label', 'FILTER', 'label=value']
);
});
});
testUtils.testWithClient('client.ts.mGetWithLabels', async client => {
const [, reply] = await Promise.all([
client.ts.add('key', 0, 0, {
LABELS: { label: 'value' }
}),
client.ts.mGetWithLabels('label=value')
]);
assert.deepEqual(reply, [{
key: 'key',
labels: { label: 'value' },
sample: {
timestamp: 0,
value: 0
}
}]);
}, GLOBAL.SERVERS.OPEN);
});