Merge pull request #23505 from garthk/add-rejects

Add typings for reject/rejects from code 5.0.0
This commit is contained in:
Daniel Rosenwasser
2018-02-13 11:56:19 -08:00
committed by GitHub
2 changed files with 12 additions and 0 deletions
+8
View File
@@ -159,3 +159,11 @@ expect<number[]>(foo).to.equal([]);
const bar = Object.create(null);
settings.comparePrototypes = false;
expect(bar).to.equal({});
const rejection = Promise.reject(new Error('Oh no!'));
/* await */ expect(rejection).to.reject('Oh no!');
/* await */ expect(rejection).rejects('Oh no!');
const typedRejection = Promise.reject(new CustomError('Oh no!'));
/* await */ expect(typedRejection).to.reject(CustomError, 'Oh no!');
/* await */ expect(typedRejection).rejects(CustomError, 'Oh no!');
+4
View File
@@ -160,6 +160,10 @@ export interface Values<T> {
match(regex: RegExp): AssertionChain<T>;
/** Asserts that the reference value's toString() representation matches the provided regular expression. */
matches(regex: RegExp): AssertionChain<T>;
/** Asserts that the Promise reference value rejects with an exception when called */
reject(type?: any, message?: string | RegExp): AssertionChain<T>;
/** Asserts that the Promise reference value rejects with an exception when called */
rejects(type?: any, message?: string | RegExp): AssertionChain<T>;
/** Asserts that the reference value satisfies the provided validator function. */
satisfy(validator: (value: T) => boolean): AssertionChain<T>;
/** Asserts that the reference value satisfies the provided validator function. */