diff --git a/types/should/index.d.ts b/types/should/index.d.ts index 0a5038d027..96584bfe96 100644 --- a/types/should/index.d.ts +++ b/types/should/index.d.ts @@ -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 , Maxime LUCE +// Definitions by: Alex Varju , Maxime LUCE , Lukas Spieß // 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; fulfilledWith(value: any): Promise rejected(): Promise; - rejectedWith(message: (string | Function | RegExp), properties?: Object): Promise; + rejectedWith(message: (string | Function | RegExp), properties?: {}): Promise; rejectedWith(errType: Object): Promise; //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; diff --git a/types/should/should-tests.ts b/types/should/should-tests.ts index 4b4b7146b7..9f894233bd 100644 --- a/types/should/should-tests.ts +++ b/types/should/should-tests.ts @@ -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');