1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00
This commit is contained in:
Leibale
2023-06-19 18:04:31 -04:00
parent 9c1f2a0f86
commit f150e86f95
47 changed files with 2490 additions and 1798 deletions

View File

@@ -1,37 +1,38 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './FUNCTION_RESTORE';
import FUNCTION_RESTORE from './FUNCTION_RESTORE';
import { RESP_TYPES } from '../RESP/decoder';
describe('FUNCTION RESTORE', () => {
testUtils.isVersionGreaterThanHook([7]);
testUtils.isVersionGreaterThanHook([7]);
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
transformArguments('dump'),
['FUNCTION', 'RESTORE', 'dump']
);
});
it('with mode', () => {
assert.deepEqual(
transformArguments('dump', 'APPEND'),
['FUNCTION', 'RESTORE', 'dump', 'APPEND']
);
});
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
FUNCTION_RESTORE.transformArguments('dump'),
['FUNCTION', 'RESTORE', 'dump']
);
});
testUtils.testWithClient('client.functionRestore', async client => {
assert.equal(
await client.functionRestore(
await client.functionDump(
client.commandOptions({
returnBuffers: true
})
),
'FLUSH'
),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
it('with mode', () => {
assert.deepEqual(
FUNCTION_RESTORE.transformArguments('dump', {
mode: 'APPEND'
}),
['FUNCTION', 'RESTORE', 'dump', 'APPEND']
);
});
});
testUtils.testWithClient('client.functionRestore', async client => {
assert.equal(
await client.functionRestore(
await client.withTypeMapping({
[RESP_TYPES.BLOB_STRING]: Buffer
}).functionDump(),
'FLUSH'
),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
});