1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
Files
node-redis/packages/client/lib/commands/FUNCTION_RESTORE.spec.ts
2023-09-18 15:03:07 -04:00

41 lines
1.0 KiB
TypeScript

import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import FUNCTION_RESTORE from './FUNCTION_RESTORE';
import { RESP_TYPES } from '../RESP/decoder';
describe('FUNCTION RESTORE', () => {
testUtils.isVersionGreaterThanHook([7]);
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
FUNCTION_RESTORE.transformArguments('dump'),
['FUNCTION', 'RESTORE', 'dump']
);
});
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(),
{
mode: 'REPLACE'
}
),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
});