1
1
import { strict as assert } from 'node:assert' ;
2
- import testUtils , { GLOBAL , sleep } from '../test-utils' ;
2
+ import testUtils , { GLOBAL } from '../test-utils' ;
3
3
import { BasicCommandParser } from '../client/parser' ;
4
4
import HGETEX from './HGETEX' ;
5
+ import { setTimeout } from 'timers/promises' ;
5
6
6
7
describe ( 'HGETEX parseCommand' , ( ) => {
7
8
it ( 'hGetEx parseCommand base' , ( ) => {
@@ -36,30 +37,28 @@ describe('HGETEX parseCommand', () => {
36
37
} ) ;
37
38
38
39
39
- // TODO: enable when new test container is released
40
- describe . skip ( 'HGETEX call' , ( ) => {
40
+ describe ( 'HGETEX call' , ( ) => {
41
41
testUtils . testWithClientIfVersionWithinRange ( [ [ 8 ] , 'LATEST' ] , 'hGetEx empty single field' , async client => {
42
42
assert . deepEqual (
43
- await client . hGetEx ( 'key' , 'filed1 ' , { expiration : 'PERSIST' } ) ,
43
+ await client . hGetEx ( 'key' , 'field1 ' , { expiration : 'PERSIST' } ) ,
44
44
[ null ]
45
45
) ;
46
46
} , GLOBAL . SERVERS . OPEN ) ;
47
47
48
48
testUtils . testWithClientIfVersionWithinRange ( [ [ 8 ] , 'LATEST' ] , 'hGetEx empty multiple fields' , async client => {
49
49
assert . deepEqual (
50
- await client . hGetEx ( 'key' , [ 'filed1 ' , 'field2' ] , { expiration : 'PERSIST' } ) ,
50
+ await client . hGetEx ( 'key' , [ 'field1 ' , 'field2' ] , { expiration : 'PERSIST' } ) ,
51
51
[ null , null ]
52
52
) ;
53
53
} , GLOBAL . SERVERS . OPEN ) ;
54
54
55
55
testUtils . testWithClientIfVersionWithinRange ( [ [ 8 ] , 'LATEST' ] , 'hGetEx set expiry' , async client => {
56
56
await client . hSet ( 'key' , 'field' , 'value' )
57
57
assert . deepEqual (
58
- await client . hGetEx ( 'key' , 'field' , { expiration : { type : 'PX' , value : 500 } } ) ,
58
+ await client . hGetEx ( 'key' , 'field' , { expiration : { type : 'PX' , value : 50 } } ) ,
59
59
[ 'value' ]
60
60
) ;
61
-
62
- await sleep ( 600 )
61
+ await setTimeout ( 100 )
63
62
assert . deepEqual (
64
63
await client . hGet ( 'key' , 'field' ) ,
65
64
null
@@ -68,9 +67,9 @@ describe.skip('HGETEX call', () => {
68
67
69
68
testUtils . testWithClientIfVersionWithinRange ( [ [ 8 ] , 'LATEST' ] , 'gGetEx set expiry PERSIST' , async client => {
70
69
await client . hSet ( 'key' , 'field' , 'value' )
71
- await client . hGetEx ( 'key' , 'field' , { expiration : { type : 'PX' , value : 500 } } )
70
+ await client . hGetEx ( 'key' , 'field' , { expiration : { type : 'PX' , value : 50 } } )
72
71
await client . hGetEx ( 'key' , 'field' , { expiration : 'PERSIST' } )
73
- await sleep ( 600 )
72
+ await setTimeout ( 100 )
74
73
assert . deepEqual (
75
74
await client . hGet ( 'key' , 'field' ) ,
76
75
'value'
0 commit comments