| 1 |
import { strict as assert } from 'assert'; |
| 2 |
import testUtils, { GLOBAL } from '../../test-utils'; |
| 3 |
import { transformArguments } from './INCRBY'; |
| 4 |
|
| 5 |
describe('CMS INCRBY', () => { |
| 6 |
describe('transformArguments', () => { |
| 7 |
it('single item', () => { |
| 8 |
assert.deepEqual( |
| 9 |
transformArguments('key', { |
| 10 |
item: 'item', |
| 11 |
incrementBy: 1 |
| 12 |
}), |
| 13 |
['CMS.INCRBY', 'key', 'item', '1'] |
| 14 |
); |
| 15 |
}); |
| 16 |
|
| 17 |
it('multiple items', () => { |
| 18 |
assert.deepEqual( |
| 19 |
transformArguments('key', [{ |
| 20 |
item: 'a', |
| 21 |
incrementBy: 1 |
| 22 |
}, { |
| 23 |
item: 'b', |
| 24 |
incrementBy: 2 |
| 25 |
}]), |
| 26 |
['CMS.INCRBY', 'key', 'a', '1', 'b', '2'] |
| 27 |
); |
| 28 |
}); |
| 29 |
}); |
| 30 |
|
| 31 |
testUtils.testWithClient('client.cms.incrBy', async client => { |
| 32 |
await client.cms.initByDim('key', 1000, 5); |
| 33 |
assert.deepEqual( |
| 34 |
await client.cms.incrBy('key', { |
| 35 |
item: 'item', |
| 36 |
incrementBy: 1 |
| 37 |
}), |
| 38 |
[1] |
| 39 |
); |
| 40 |
}, GLOBAL.SERVERS.OPEN); |
| 41 |
}); |