@@ -23,12 +23,6 @@ describe('class OnDemandDocument', () => {
23
23
} ) ;
24
24
25
25
context ( 'when given a BSON document with ok set to 1' , ( ) => {
26
- it ( 'has a length of 1' , ( ) => {
27
- const emptyDocument = BSON . serialize ( { ok : 1 } ) ;
28
- const doc = new OnDemandDocument ( emptyDocument , 0 , false ) ;
29
- expect ( doc ) . to . have . lengthOf ( 1 ) ;
30
- } ) ;
31
-
32
26
it ( 'sets exists cache to true for ok' , ( ) => {
33
27
const emptyDocument = BSON . serialize ( { ok : 1 } ) ;
34
28
const doc = new OnDemandDocument ( emptyDocument , 0 , false ) ;
@@ -45,12 +39,6 @@ describe('class OnDemandDocument', () => {
45
39
} ) ;
46
40
47
41
context ( 'when given a BSON document with ok set to 0 and code set to 2' , ( ) => {
48
- it ( 'has a length of 2' , ( ) => {
49
- const emptyDocument = BSON . serialize ( { ok : 0 , code : 2 } ) ;
50
- const doc = new OnDemandDocument ( emptyDocument , 0 , false ) ;
51
- expect ( doc ) . to . have . lengthOf ( 2 ) ;
52
- } ) ;
53
-
54
42
it ( 'tracks element position when finding match' , ( ) => {
55
43
const emptyDocument = BSON . serialize ( { ok : 0 , code : 2 } ) ;
56
44
const doc = new OnDemandDocument ( emptyDocument , 0 , false ) ;
@@ -200,13 +188,14 @@ describe('class OnDemandDocument', () => {
200
188
it ( 'supports returning object' , ( ) => {
201
189
const o = document . get ( 'object' , BSONType . object , true ) ;
202
190
expect ( o ) . to . be . instanceOf ( OnDemandDocument ) ;
203
- expect ( o ) . to . have . lengthOf ( 1 ) ;
191
+ expect ( o . has ( 'a' ) ) . to . be . true ;
204
192
} ) ;
205
193
206
194
it ( 'supports returning array' , ( ) => {
207
195
const a = document . get ( 'array' , BSONType . array , true ) ;
208
196
expect ( a ) . to . be . instanceOf ( OnDemandDocument ) ;
209
- expect ( a ) . to . have . lengthOf ( 2 ) ;
197
+ expect ( a . has ( '0' ) ) . to . be . true ;
198
+ expect ( a . has ( '1' ) ) . to . be . true ;
210
199
} ) ;
211
200
} ) ;
212
201
0 commit comments