@@ -8,24 +8,24 @@ describe('ContextIndex tests', () => {
8
8
indexUnderTest . notice ( 'third' , 3 ) ;
9
9
10
10
expect ( indexUnderTest . container . index . length ) . toEqual ( 3 ) ;
11
- expect ( indexUnderTest . container . index . at ( 0 ) ) . toEqual ( { id : 'first' , timestamp : 1 } ) ;
12
- expect ( indexUnderTest . container . index . at ( 1 ) ) . toEqual ( { id : 'second' , timestamp : 2 } ) ;
13
- expect ( indexUnderTest . container . index . at ( 2 ) ) . toEqual ( { id : 'third' , timestamp : 3 } ) ;
11
+ expect ( indexUnderTest . container . index [ 0 ] ) . toEqual ( { id : 'first' , timestamp : 1 } ) ;
12
+ expect ( indexUnderTest . container . index [ 1 ] ) . toEqual ( { id : 'second' , timestamp : 2 } ) ;
13
+ expect ( indexUnderTest . container . index [ 2 ] ) . toEqual ( { id : 'third' , timestamp : 3 } ) ;
14
14
} ) ;
15
15
16
16
test ( 'notice updates timestamp' , async ( ) => {
17
17
const indexUnderTest = new ContextIndex ( ) ;
18
18
indexUnderTest . notice ( 'first' , 1 ) ;
19
19
indexUnderTest . notice ( 'second' , 2 ) ;
20
20
expect ( indexUnderTest . container . index . length ) . toEqual ( 2 ) ;
21
- expect ( indexUnderTest . container . index . at ( 0 ) ) . toEqual ( { id : 'first' , timestamp : 1 } ) ;
22
- expect ( indexUnderTest . container . index . at ( 1 ) ) . toEqual ( { id : 'second' , timestamp : 2 } ) ;
21
+ expect ( indexUnderTest . container . index [ 0 ] ) . toEqual ( { id : 'first' , timestamp : 1 } ) ;
22
+ expect ( indexUnderTest . container . index [ 1 ] ) . toEqual ( { id : 'second' , timestamp : 2 } ) ;
23
23
24
24
indexUnderTest . notice ( 'first' , 3 ) ;
25
25
indexUnderTest . notice ( 'second' , 4 ) ;
26
26
expect ( indexUnderTest . container . index . length ) . toEqual ( 2 ) ;
27
- expect ( indexUnderTest . container . index . at ( 0 ) ) . toEqual ( { id : 'first' , timestamp : 3 } ) ;
28
- expect ( indexUnderTest . container . index . at ( 1 ) ) . toEqual ( { id : 'second' , timestamp : 4 } ) ;
27
+ expect ( indexUnderTest . container . index [ 0 ] ) . toEqual ( { id : 'first' , timestamp : 3 } ) ;
28
+ expect ( indexUnderTest . container . index [ 1 ] ) . toEqual ( { id : 'second' , timestamp : 4 } ) ;
29
29
} ) ;
30
30
31
31
test ( 'prune oldest down to maximum' , async ( ) => {
@@ -38,8 +38,8 @@ describe('ContextIndex tests', () => {
38
38
39
39
indexUnderTest . prune ( 2 ) ;
40
40
expect ( indexUnderTest . container . index . length ) . toEqual ( 2 ) ;
41
- expect ( indexUnderTest . container . index . at ( 0 ) ) . toEqual ( { id : 'first' , timestamp : 50 } ) ;
42
- expect ( indexUnderTest . container . index . at ( 1 ) ) . toEqual ( { id : 'fourth' , timestamp : 51 } ) ;
41
+ expect ( indexUnderTest . container . index [ 0 ] ) . toEqual ( { id : 'first' , timestamp : 50 } ) ;
42
+ expect ( indexUnderTest . container . index [ 1 ] ) . toEqual ( { id : 'fourth' , timestamp : 51 } ) ;
43
43
} ) ;
44
44
45
45
test ( 'prune oldest down to 0' , async ( ) => {
@@ -94,9 +94,9 @@ describe('ContextIndex tests', () => {
94
94
'{"index":[{"id":"first","timestamp":1},{"id":"second","timestamp":2},{"id":"third","timestamp":3}]}' ;
95
95
const indexUnderTest = ContextIndex . fromJson ( input ) ;
96
96
expect ( indexUnderTest . container . index . length ) . toEqual ( 3 ) ;
97
- expect ( indexUnderTest . container . index . at ( 0 ) ) . toEqual ( { id : 'first' , timestamp : 1 } ) ;
98
- expect ( indexUnderTest . container . index . at ( 1 ) ) . toEqual ( { id : 'second' , timestamp : 2 } ) ;
99
- expect ( indexUnderTest . container . index . at ( 2 ) ) . toEqual ( { id : 'third' , timestamp : 3 } ) ;
97
+ expect ( indexUnderTest . container . index [ 0 ] ) . toEqual ( { id : 'first' , timestamp : 1 } ) ;
98
+ expect ( indexUnderTest . container . index [ 1 ] ) . toEqual ( { id : 'second' , timestamp : 2 } ) ;
99
+ expect ( indexUnderTest . container . index [ 2 ] ) . toEqual ( { id : 'third' , timestamp : 3 } ) ;
100
100
} ) ;
101
101
102
102
test ( 'fromJson invalid' , async ( ) => {
0 commit comments