1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00
Files
node-redis/lib/multi-command.spec.ts

28 lines
791 B
TypeScript

import { strict as assert } from 'assert';
import RedisMultiCommand from './multi-command';
import RedisCommandsQueue from './commands-queue';
describe('Multi Command', () => {
it('simple', async () => {
const multi = RedisMultiCommand.create(queue => {
assert.deepEqual(
queue.map(({encodedCommand}) => encodedCommand),
[
RedisCommandsQueue.encodeCommand(['MULTI']),
RedisCommandsQueue.encodeCommand(['PING']),
RedisCommandsQueue.encodeCommand(['EXEC']),
]
);
return Promise.resolve(['PONG']);
});
multi.ping();
assert.deepEqual(
await multi.exec(),
['PONG']
);
});
});