Skip to content

Commit a55fbaf

Browse files
shacharPashleibale
andauthored
Add support for BF.CARD command (#2376)
* Add support for BF.CARD command * Update index.ts * Update CARD.ts * Update CARD.spec.ts Co-authored-by: Leibale Eidelman <me@leibale.com>
1 parent c5b6f77 commit a55fbaf

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { strict as assert } from 'assert';
2+
import testUtils, { GLOBAL } from '../../test-utils';
3+
import { transformArguments } from './CARD';
4+
5+
describe('BF CARD', () => {
6+
it('transformArguments', () => {
7+
assert.deepEqual(
8+
transformArguments('bloom'),
9+
['BF.CARD', 'bloom']
10+
);
11+
});
12+
13+
testUtils.testWithClient('client.bf.card', async client => {
14+
assert.equal(
15+
await client.bf.card('key'),
16+
0
17+
);
18+
}, GLOBAL.SERVERS.OPEN);
19+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const FIRST_KEY_INDEX = 1;
2+
3+
export const IS_READ_ONLY = true;
4+
5+
export function transformArguments(key: string): Array<string> {
6+
return ['BF.CARD', key];
7+
}
8+
9+
export declare function transformReply(): number;

packages/bloom/lib/commands/bloom/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as ADD from './ADD';
2+
import * as CARD from './CARD';
23
import * as EXISTS from './EXISTS';
34
import * as INFO from './INFO';
45
import * as INSERT from './INSERT';
@@ -11,6 +12,8 @@ import * as SCANDUMP from './SCANDUMP';
1112
export default {
1213
ADD,
1314
add: ADD,
15+
CARD,
16+
card: CARD,
1417
EXISTS,
1518
exists: EXISTS,
1619
INFO,

0 commit comments

Comments
 (0)