1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/packages/client/lib/test-utils.ts
Leibale Eidelman 0752f143a6 prepare 4.1.0 (#2111)
* increase test coverage

* @node-redis to @redis

* ugprade deps

* fix benchmark

* use 7.0 docker (not rc), update readmes, clean code, fix @-redis import

* update readme

* fix function in cluster

* update docs

Co-authored-by: Chayim <chayim@users.noreply.github.com>

* Update clustering.md

* add subpackages move warning

* drop support for node 12

* upgrade deps

* fix tsconfig.base.json

Co-authored-by: Chayim <chayim@users.noreply.github.com>
2022-05-02 11:48:12 -04:00

50 lines
1.2 KiB
TypeScript

import TestUtils from '@redis/test-utils';
import { SinonSpy } from 'sinon';
import { promiseTimeout } from './utils';
export default new TestUtils({
defaultDockerVersion: '7.0-rc3',
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);
}