| 1 |
import { strict as assert } from 'assert'; |
| 2 |
import testUtils, { GLOBAL } from '../test-utils'; |
| 3 |
import { transformArguments } from './GET'; |
| 4 |
|
| 5 |
describe('GET', () => { |
| 6 |
describe('transformArguments', () => { |
| 7 |
it('without options', () => { |
| 8 |
assert.deepEqual( |
| 9 |
transformArguments('key'), |
| 10 |
['TS.GET', 'key'] |
| 11 |
); |
| 12 |
}); |
| 13 |
|
| 14 |
it('with LATEST', () => { |
| 15 |
assert.deepEqual( |
| 16 |
transformArguments('key', { |
| 17 |
LATEST: true |
| 18 |
}), |
| 19 |
['TS.GET', 'key', 'LATEST'] |
| 20 |
); |
| 21 |
}); |
| 22 |
}); |
| 23 |
|
| 24 |
describe('client.ts.get', () => { |
| 25 |
testUtils.testWithClient('null', async client => { |
| 26 |
await client.ts.create('key'); |
| 27 |
|
| 28 |
assert.equal( |
| 29 |
await client.ts.get('key'), |
| 30 |
null |
| 31 |
); |
| 32 |
}, GLOBAL.SERVERS.OPEN); |
| 33 |
|
| 34 |
testUtils.testWithClient('with samples', async client => { |
| 35 |
await client.ts.add('key', 0, 1); |
| 36 |
|
| 37 |
assert.deepEqual( |
| 38 |
await client.ts.get('key'), |
| 39 |
{ |
| 40 |
timestamp: 0, |
| 41 |
value: 1 |
| 42 |
} |
| 43 |
); |
| 44 |
}, GLOBAL.SERVERS.OPEN); |
| 45 |
}); |
| 46 |
}); |