You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
27 lines
832 B
TypeScript
27 lines
832 B
TypeScript
import { strict as assert } from 'assert';
|
|
import testUtils, { GLOBAL } from '../test-utils';
|
|
import LATENCY_HISTORY from './LATENCY_HISTORY';
|
|
|
|
describe('LATENCY HISTORY', () => {
|
|
it('transformArguments', () => {
|
|
assert.deepEqual(
|
|
LATENCY_HISTORY.transformArguments('command'),
|
|
['LATENCY', 'HISTORY', 'command']
|
|
);
|
|
});
|
|
|
|
testUtils.testWithClient('client.latencyHistory', async client => {
|
|
const [,, reply] = await Promise.all([
|
|
client.configSet('latency-monitor-threshold', '100'),
|
|
client.sendCommand(['DEBUG', 'SLEEP', '1']),
|
|
client.latencyHistory('command')
|
|
]);
|
|
|
|
assert.ok(Array.isArray(reply));
|
|
for (const [timestamp, latency] of reply) {
|
|
assert.equal(typeof timestamp, 'number');
|
|
assert.equal(typeof latency, 'number');
|
|
}
|
|
}, GLOBAL.SERVERS.OPEN);
|
|
});
|