1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00
Files
node-redis/packages/client/lib/test-utils.ts
Leibale Eidelman 23b65133c9 New RESP2 parser (#1899)
* parser

* a new RESP parser :)

* clean code

* fix simple string and bulk string cursor

* performance improvements

* change typescript compiler target

* do not use stream.Transform

* Update decoder.ts

* fix for 1d09acb

* improve integer performance

* revert 1d09acb

* improve RESP2 decoder performance

* improve performance

* improve encode performance

* remove unused import

* upgrade benchmark deps

* clean code

* fix socket error handlers, reset parser on error

* fix #2080 - reset pubSubState on socket error

* reset decoder on socket error

* fix pubsub

* fix "RedisSocketInitiator"

* fix returnStringsAsBuffers

* fix merge
2022-04-25 08:24:33 -04:00

50 lines
1.2 KiB
TypeScript

import TestUtils from '@node-redis/test-utils';
import { SinonSpy } from 'sinon';
import { promiseTimeout } from './utils';
export default new TestUtils({
defaultDockerVersion: '6.2',
dockerImageName: 'redis',
dockerImageVersionArgument: 'redis-version'
});
export const GLOBAL = {
SERVERS: {
OPEN: {
serverArguments: []
},
PASSWORD: {
serverArguments: ['--requirepass', 'password'],
clientOptions: {
password: 'password'
}
}
},
CLUSTERS: {
OPEN: {
serverArguments: []
},
PASSWORD: {
serverArguments: ['--requirepass', 'password'],
clusterConfiguration: {
defaults: {
password: 'password'
}
}
}
}
};
export async function waitTillBeenCalled(spy: SinonSpy): Promise<void> {
const start = process.hrtime.bigint(),
calls = spy.callCount;
do {
if (process.hrtime.bigint() - start > 1_000_000_000) {
throw new Error('Waiting for more than 1 second');
}
await promiseTimeout(50);
} while (spy.callCount === calls);
}