mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Jest: toThrow supports same signature as toThrowError, bump to 19.0.2
This commit is contained in:
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Jest 18.1.0
|
||||
// Type definitions for Jest 19.2.0
|
||||
// Project: http://facebook.github.io/jest/
|
||||
// Definitions by: Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>, Alexey Svetliakov <https://github.com/asvetliakov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -229,7 +229,7 @@ declare namespace jest {
|
||||
/** This ensures that a value matches the most recent snapshot. Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information. */
|
||||
toMatchSnapshot(snapshotName?: string): void;
|
||||
/** Used to test that a function throws when it is called. */
|
||||
toThrow(): void;
|
||||
toThrow(error?: string | Constructable | RegExp): void;
|
||||
/** If you want to test that a specific error is thrown inside a function. */
|
||||
toThrowError(error?: string | Constructable | RegExp): void;
|
||||
/** Used to test that a function throws a error matching the most recent snapshot when it is called. */
|
||||
|
||||
@@ -160,17 +160,21 @@ describe('toThrow API', function () {
|
||||
|
||||
it('throws', function () {
|
||||
expect(throwTypeError()).toThrow();
|
||||
expect(throwTypeError()).toThrowError();
|
||||
});
|
||||
|
||||
it('throws TypeError', function () {
|
||||
expect(throwTypeError()).toThrow(TypeError);
|
||||
expect(throwTypeError()).toThrowError(TypeError);
|
||||
});
|
||||
|
||||
it('throws \'Definition was out of date\'', function () {
|
||||
expect(throwTypeError()).toThrow(/Definition was out of date/);
|
||||
expect(throwTypeError()).toThrowError(/Definition was out of date/);
|
||||
});
|
||||
|
||||
it('throws \'toThorow Definition was out of date\'', function () {
|
||||
expect(throwTypeError()).toThrow('toThrow Definition was out of date');
|
||||
expect(throwTypeError()).toThrowError('toThrow Definition was out of date');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user