@@ -2136,6 +2136,9 @@ describe('contain()', () => {
2136
2136
expect ( Hoek . contain ( 'ab' , [ 'a' , 'b' , 'c' ] ) ) . to . be . false ( ) ;
2137
2137
expect ( Hoek . contain ( 'ab' , [ 'a' , 'b' , 'c' ] , { only : true } ) ) . to . be . false ( ) ;
2138
2138
expect ( Hoek . contain ( 'ab' , [ 'a' , 'b' , 'c' ] , { only : true , once : true } ) ) . to . be . false ( ) ;
2139
+
2140
+ expect ( Hoek . contain ( 'ab' , [ 'c' ] , { part : true } ) ) . to . be . false ( ) ;
2141
+ expect ( Hoek . contain ( 'ab' , [ 'b' ] , { part : true } ) ) . to . be . true ( ) ;
2139
2142
} ) ;
2140
2143
2141
2144
it ( 'tests arrays' , ( ) => {
@@ -2182,6 +2185,9 @@ describe('contain()', () => {
2182
2185
expect ( Hoek . contain ( [ 'a' , 'b' ] , [ 'a' , 'b' , 'c' ] ) ) . to . be . false ( ) ;
2183
2186
expect ( Hoek . contain ( [ 'a' , 'b' ] , [ 'a' , 'b' , 'c' ] , { only : true } ) ) . to . be . false ( ) ;
2184
2187
expect ( Hoek . contain ( [ 'a' , 'b' ] , [ 'a' , 'b' , 'c' ] , { only : true , once : true } ) ) . to . be . false ( ) ;
2188
+
2189
+ expect ( Hoek . contain ( [ 'a' , 'b' ] , [ 'c' ] , { part : true } ) ) . to . be . false ( ) ;
2190
+ expect ( Hoek . contain ( [ 'a' , 'b' ] , [ 'b' ] , { part : true } ) ) . to . be . true ( ) ;
2185
2191
} ) ;
2186
2192
2187
2193
it ( 'tests objects' , ( ) => {
@@ -2226,6 +2232,9 @@ describe('contain()', () => {
2226
2232
expect ( Hoek . contain ( { a : 'foo' , b : 'bar' } , { a : 'foo' , b : 'bar' , c : 'x' } ) ) . to . be . false ( ) ;
2227
2233
expect ( Hoek . contain ( { a : 'foo' , b : 'bar' } , { a : 'foo' , b : 'bar' , c : 'x' } , { only : true } ) ) . to . be . false ( ) ;
2228
2234
2235
+ expect ( Hoek . contain ( { a : 1 , b : 2 } , [ 'c' ] , { part : true } ) ) . to . be . false ( ) ;
2236
+ expect ( Hoek . contain ( { a : 1 , b : 2 } , [ 'b' ] , { part : true } ) ) . to . be . true ( ) ;
2237
+
2229
2238
// Getter check
2230
2239
2231
2240
{
@@ -2314,6 +2323,21 @@ describe('contain()', () => {
2314
2323
expect ( Hoek . contain ( [ sym ] , Symbol ( ) ) ) . to . be . false ( ) ;
2315
2324
expect ( Hoek . contain ( { [ sym ] : 1 } , Symbol ( ) ) ) . to . be . false ( ) ;
2316
2325
} ) ;
2326
+
2327
+ it ( 'compares error keys' , ( ) => {
2328
+
2329
+ const error = new Error ( 'test' ) ;
2330
+ expect ( Hoek . contain ( error , { x : 1 } ) ) . to . be . false ( ) ;
2331
+ expect ( Hoek . contain ( error , { x : 1 } , { part : true } ) ) . to . be . false ( ) ;
2332
+
2333
+ error . x = 1 ;
2334
+
2335
+ expect ( Hoek . contain ( error , { x : 1 } ) ) . to . be . true ( ) ;
2336
+ expect ( Hoek . contain ( error , { x : 1 } , { part : true } ) ) . to . be . true ( ) ;
2337
+
2338
+ expect ( Hoek . contain ( error , { x : 1 , y : 2 } ) ) . to . be . false ( ) ;
2339
+ expect ( Hoek . contain ( error , { x : 1 , y : 2 } , { part : true } ) ) . to . be . true ( ) ;
2340
+ } ) ;
2317
2341
} ) ;
2318
2342
2319
2343
describe ( 'flatten()' , ( ) => {
0 commit comments