1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-13 10:02:24 +03:00
Files
node-redis/lib/multi-command.spec.ts
2021-05-12 14:27:02 -04:00

35 lines
902 B
TypeScript

import { strict as assert } from 'assert';
import RedisMultiCommand, { MultiQueuedCommand } from './multi-command.js';
import RedisClient from './client.js';
describe('Multi Command', () => {
it('create', async () => {
const multi = RedisMultiCommand.create(async (encodedCommands: Array<MultiQueuedCommand>): Promise<Array<string>> => {
return Object.keys(encodedCommands);
});
multi.ping();
multi.set('a', 'b');
// console.log(
await multi.exec()
// );
});
it('client.multi', async () => {
const client = RedisClient.create();
await client.connect();
assert.deepEqual(
await client
.multi()
.ping()
.set('key', 'value')
.exec(),
['PONG', 'OK']
);
await client.disconnect();
});
});