-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support JSON.MERGE Command * test only 2.6+ ReJson version * test on edge * review * Update test-utils.ts --------- Co-authored-by: Leibale Eidelman <[email protected]>
- Loading branch information
1 parent
8c8740a
commit cf21c1a
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { strict as assert } from 'assert'; | ||
import testUtils, { GLOBAL } from '../test-utils'; | ||
import { transformArguments } from './MERGE'; | ||
|
||
describe('MERGE', () => { | ||
testUtils.isVersionGreaterThanHook([2, 6]); | ||
|
||
it('transformArguments', () => { | ||
assert.deepEqual( | ||
transformArguments('key', '$', 1), | ||
['JSON.MERGE', 'key', '$', '1'] | ||
); | ||
}); | ||
|
||
testUtils.testWithClient('client.json.merge', async client => { | ||
assert.equal( | ||
await client.json.merge('key', '$', 'json'), | ||
'OK' | ||
); | ||
}, GLOBAL.SERVERS.OPEN); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { RedisJSON, transformRedisJsonArgument } from '.'; | ||
|
||
export const FIRST_KEY_INDEX = 1; | ||
|
||
export function transformArguments(key: string, path: string, json: RedisJSON): Array<string> { | ||
return ['JSON.MERGE', key, path, transformRedisJsonArgument(json)]; | ||
} | ||
|
||
export declare function transformReply(): 'OK'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters