File tree Expand file tree Collapse file tree 6 files changed +29
-3
lines changed
Expand file tree Collapse file tree 6 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ thenableNum = chai.expect(thenableNum).to.eventually.have.ownProperty("foo");
1515thenableNum = chai . expect ( thenableNum ) . to . eventually . have . ownProperty ( Symbol . for ( "bar" ) ) ;
1616thenableNum = chai . expect ( thenableNum ) . to . eventually . have . ownPropertyDescriptor ( "foo" ) ;
1717thenableNum = chai . expect ( thenableNum ) . to . eventually . have . ownPropertyDescriptor ( Symbol . for ( "bar" ) ) ;
18+ thenableNum = chai . expect ( thenableNum ) . to . eventually . containSubset ( { } ) ;
1819thenableNum = chai . expect ( thenableNum ) . to . become ( 3 ) ;
1920thenableNum = chai . expect ( thenableNum ) . to . be . fulfilled ;
2021thenableNum = chai . expect ( thenableNum ) . to . be . rejected ;
@@ -33,6 +34,7 @@ thenableNum = thenableNum.should.be.fulfilled;
3334thenableNum = thenableNum . should . eventually . deep . equal ( 3 ) ;
3435thenableNum = thenableNum . should . eventually . become ( 3 ) ;
3536thenableNum = thenableNum . should . become ( 3 ) ;
37+ thenableNum = thenableNum . should . eventually . containSubset ( 3 ) ;
3638thenableNum = thenableNum . should . be . rejected ;
3739thenableNum = thenableNum . should . be . rejectedWith ( Error ) ;
3840thenableNum = thenableNum . should . be . rejectedWith ( "Error" ) ;
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ declare global {
5252 Arguments : PromisedAssertion ;
5353 equal : PromisedEqual ;
5454 equals : PromisedEqual ;
55+ containSubset : PromisedContainSubset ;
5556 eq : PromisedEqual ;
5657 eql : PromisedEqual ;
5758 eqls : PromisedEqual ;
@@ -174,6 +175,10 @@ declare global {
174175 ( value : any , message ?: string ) : PromisedAssertion ;
175176 }
176177
178+ interface PromisedContainSubset {
179+ ( value : any ) : PromisedAssertion ;
180+ }
181+
177182 interface PromisedProperty {
178183 ( name : string | symbol , value ?: any , message ?: string ) : PromisedAssertion ;
179184 }
Original file line number Diff line number Diff line change 55 "projects" : [
66 " https://github.com/debitoor/chai-subset"
77 ],
8- "dependencies " : {
9- "@types/chai" : " * "
8+ "peerDependencies " : {
9+ "@types/chai" : " <5.2.0 "
1010 },
1111 "devDependencies" : {
1212 "@types/chai-subset" : " workspace:."
Original file line number Diff line number Diff line change @@ -114,6 +114,11 @@ function equal() {
114114 should . equal ( undefined , void ( 0 ) ) ;
115115}
116116
117+ function containSubset ( ) {
118+ expect ( { } ) . to . containSubset ( { } ) ;
119+ ( { } ) . should . containSubset ( { } ) ;
120+ }
121+
117122function _typeof ( ) {
118123 expect ( "test" ) . to . be . a ( "string" ) ;
119124 "test" . should . be . a ( "string" ) ;
Original file line number Diff line number Diff line change @@ -195,6 +195,7 @@ declare global {
195195 eq : Equal ;
196196 eql : Equal ;
197197 eqls : Equal ;
198+ containSubset : ContainSubset ;
198199 property : Property ;
199200 ownProperty : Property ;
200201 haveOwnProperty : Property ;
@@ -329,6 +330,10 @@ declare global {
329330 ( value : any , message ?: string ) : Assertion ;
330331 }
331332
333+ interface ContainSubset {
334+ ( expected : any ) : Assertion ;
335+ }
336+
332337 interface Property {
333338 ( name : string | symbol , value : any , message ?: string ) : Assertion ;
334339 ( name : string | symbol , message ?: string ) : Assertion ;
@@ -523,6 +528,15 @@ declare global {
523528 */
524529 deepStrictEqual < T > ( actual : T , expected : T , message ?: string ) : void ;
525530
531+ /**
532+ * Partially matches actual and expected.
533+ *
534+ * @param actual Actual value.
535+ * @param expected Potential subset of the value.
536+ * @param message Message to display on error.
537+ */
538+ containSubset ( val : any , exp : any , msg ?: string ) : void ;
539+
526540 /**
527541 * Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
528542 *
Original file line number Diff line number Diff line change 11{
22 "private" : true ,
33 "name" : " @types/chai" ,
4- "version" : " 5.0 .9999" ,
4+ "version" : " 5.2 .9999" ,
55 "type" : " module" ,
66 "projects" : [
77 " http://chaijs.com/"
You can’t perform that action at this time.
0 commit comments