1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Files
node-redis/packages/client/lib/commands/BITCOUNT.spec.ts
Avital Fine fe16dc0eae Support BIT|BYTE option (#2035)
* Support BIT|BYTE option

* clean code

* clean code

* clean code

Co-authored-by: leibale <leibale1998@gmail.com>
2022-03-24 11:00:08 -04:00

45 lines
1.2 KiB
TypeScript

import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './BITCOUNT';
describe('BITCOUNT', () => {
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
transformArguments('key'),
['BITCOUNT', 'key']
);
});
describe('with range', () => {
it('simple', () => {
assert.deepEqual(
transformArguments('key', {
start: 0,
end: 1
}),
['BITCOUNT', 'key', '0', '1']
);
});
it('with mode', () => {
assert.deepEqual(
transformArguments('key', {
start: 0,
end: 1,
mode: 'BIT'
}),
['BITCOUNT', 'key', '0', '1', 'BIT']
);
});
});
});
testUtils.testWithClient('client.bitCount', async client => {
assert.equal(
await client.bitCount('key'),
0
);
}, GLOBAL.SERVERS.OPEN);
});