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/BITPOS.spec.ts
2023-09-18 15:03:07 -04:00

46 lines
1.0 KiB
TypeScript

import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import BITPOS from './BITPOS';
describe('BITPOS', () => {
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
BITPOS.transformArguments('key', 1),
['BITPOS', 'key', '1']
);
});
it('with start', () => {
assert.deepEqual(
BITPOS.transformArguments('key', 1, 1),
['BITPOS', 'key', '1', '1']
);
});
it('with start and end', () => {
assert.deepEqual(
BITPOS.transformArguments('key', 1, 1, -1),
['BITPOS', 'key', '1', '1', '-1']
);
});
it('with start, end and mode', () => {
assert.deepEqual(
BITPOS.transformArguments('key', 1, 1, -1, 'BIT'),
['BITPOS', 'key', '1', '1', '-1', 'BIT']
);
});
});
testUtils.testAll('bitPos', async client => {
assert.equal(
await client.bitPos('key', 1, 1),
-1
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});