mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 21:40:21 +00:00
Merge pull request #19028 from lumaxis/feature/should-updates
[should] Minor fix and updates for should v11
This commit is contained in:
Vendored
+7
-5
@@ -1,6 +1,6 @@
|
||||
// Type definitions for should.js v8.3.0
|
||||
// Type definitions for should.js v11.2.0
|
||||
// Project: https://github.com/shouldjs/should.js
|
||||
// Definitions by: Alex Varju <https://github.com/varju/>, Maxime LUCE <https://github.com/SomaticIT/>
|
||||
// Definitions by: Alex Varju <https://github.com/varju/>, Maxime LUCE <https://github.com/SomaticIT/>, Lukas Spieß <https://github.com/lumaxis/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Object {
|
||||
@@ -88,10 +88,12 @@ interface ShouldAssertion {
|
||||
keys(...allKeys: string[]): ShouldAssertion;
|
||||
keys(allKeys: string[]): ShouldAssertion;
|
||||
enumerable(property: string, value?: any): ShouldAssertion;
|
||||
size(size: number): ShouldAssertion;
|
||||
value(key: string | number, value: any): ShouldAssertion;
|
||||
enumerables(...properties: string[]): ShouldAssertion;
|
||||
startWith(expected: string, message?: any): ShouldAssertion;
|
||||
endWith(expected: string, message?: any): ShouldAssertion;
|
||||
throw(message?: any): ShouldAssertion;
|
||||
throw(message?: any, properties?: {}): ShouldAssertion;
|
||||
|
||||
//promises
|
||||
eventually: ShouldAssertion;
|
||||
@@ -99,7 +101,7 @@ interface ShouldAssertion {
|
||||
fulfilled(): Promise<any>;
|
||||
fulfilledWith(value: any): Promise<any>
|
||||
rejected(): Promise<any>;
|
||||
rejectedWith(message: (string | Function | RegExp), properties?: Object): Promise<any>;
|
||||
rejectedWith(message: (string | Function | RegExp), properties?: {}): Promise<any>;
|
||||
rejectedWith(errType: Object): Promise<any>;
|
||||
|
||||
//http
|
||||
@@ -137,7 +139,7 @@ interface ShouldAssertion {
|
||||
deepEqual(expected: any, description?: string): ShouldAssertion;
|
||||
exactly(expected: any, description?: string): ShouldAssertion;
|
||||
instanceOf(constructor: Function, description?: string): ShouldAssertion;
|
||||
throwError(message?: any): ShouldAssertion;
|
||||
throwError(message?: any, properties?: {}): ShouldAssertion;
|
||||
lengthOf(n: number, description?: string): ShouldAssertion;
|
||||
key(key: string): ShouldAssertion;
|
||||
hasOwnProperty(name: string, description?: string): ShouldAssertion;
|
||||
|
||||
@@ -243,6 +243,18 @@ spy.should.have.threw("ReferenceError");
|
||||
throw new Error('failed to foo');
|
||||
}).should.throw(/^fail/);
|
||||
|
||||
(function () {
|
||||
throw new Error('failed to foo');
|
||||
}).should.throw(Error);
|
||||
|
||||
(function () {
|
||||
throw new Error('failed to foo');
|
||||
}).should.throw(Error, { message: 'failed to baz' });
|
||||
|
||||
(function () {
|
||||
throw new Error('failed to foo');
|
||||
}).should.throwError(Error, { message: 'failed to baz' });
|
||||
|
||||
(function () {
|
||||
throw new Error('failed to baz');
|
||||
}).should.throwError(/^fail.*/);
|
||||
@@ -252,6 +264,11 @@ obj.should.have.keys('foo', 'bar');
|
||||
obj.should.have.keys(['foo', 'bar']);
|
||||
obj.should.have.key('foo');
|
||||
|
||||
({ a: 10 }).should.have.size(1);
|
||||
|
||||
({ a: 10 }).should.have.value('a', 10);
|
||||
({ a: 10 }).should.have.value(1, 2);
|
||||
|
||||
({ a: 10 }).should.have.enumerable('a');
|
||||
({ a: 10 }).should.have.enumerable('a', 10);
|
||||
({ a: 10, b: 10 }).should.have.enumerables('a', 'b');
|
||||
|
||||
Reference in New Issue
Block a user