1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

fix BITCOUNT spec

This commit is contained in:
dovi
2023-05-03 18:59:43 -04:00
parent 4de409e0ad
commit f6be2c77d8

View File

@@ -1,44 +1,47 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './BITCOUNT'; import BITCOUNT from './BITCOUNT';
describe('BITCOUNT', () => { describe('BITCOUNT', () => {
describe('transformArguments', () => { describe('transformArguments', () => {
it('simple', () => { it('simple', () => {
assert.deepEqual( assert.deepEqual(
transformArguments('key'), BITCOUNT.transformArguments('key'),
['BITCOUNT', '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 => { describe('with range', () => {
assert.equal( it('simple', () => {
await client.bitCount('key'), assert.deepEqual(
0 BITCOUNT.transformArguments('key', {
start: 0,
end: 1
}),
['BITCOUNT', 'key', '0', '1']
); );
}, GLOBAL.SERVERS.OPEN); });
it('with mode', () => {
assert.deepEqual(
BITCOUNT.transformArguments('key', {
start: 0,
end: 1,
mode: 'BIT'
}),
['BITCOUNT', 'key', '0', '1', 'BIT']
);
});
});
});
testUtils.testAll('bitCount', async client => {
assert.equal(
await client.bitCount('key'),
0
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
}); });