1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
Files
node-redis/packages/client/lib/commands/LATENCY_LATEST.spec.ts
2023-09-19 19:23:24 -04:00

28 lines
930 B
TypeScript

import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import LATENCY_LATEST from './LATENCY_LATEST';
describe('LATENCY LATEST', () => {
it('transformArguments', () => {
assert.deepEqual(
LATENCY_LATEST.transformArguments(),
['LATENCY', 'LATEST']
);
});
testUtils.testWithClient('client.latencyLatest', async client => {
const [,, reply] = await Promise.all([
client.configSet('latency-monitor-threshold', '100'),
client.sendCommand(['DEBUG', 'SLEEP', '1']),
client.latencyLatest()
]);
assert.ok(Array.isArray(reply));
for (const [name, timestamp, latestLatency, allTimeLatency] of reply) {
assert.equal(typeof name, 'string');
assert.equal(typeof timestamp, 'number');
assert.equal(typeof latestLatency, 'number');
assert.equal(typeof allTimeLatency, 'number');
}
}, GLOBAL.SERVERS.OPEN);
});