123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- // Type definitions for expect.js 0.2.0
- // Project: https://github.com/LearnBoost/expect.js
- // Definitions by: Teppei Sato <https://github.com/teppeis>
- // Definitions: https://github.com/borisyankov/DefinitelyTyped
- declare function expect(target?: any): Expect.Root;
- declare module Expect {
- interface Assertion {
- /**
- * Check if the value is truthy
- */
- ok(): void;
- /**
- * Assert that the function throws.
- *
- * @param fn callback to match error string against
- */
- throwError(fn?: (exception: any) => void): void;
- /**
- * Assert that the function throws.
- *
- * @param fn callback to match error string against
- */
- throwException(fn?: (exception: any) => void): void;
- /**
- * Assert that the function throws.
- *
- * @param regexp regexp to match error string against
- */
- throwError(regexp: RegExp): void;
- /**
- * Assert that the function throws.
- *
- * @param fn callback to match error string against
- */
- throwException(regexp: RegExp): void;
- /**
- * Checks if the array is empty.
- */
- empty(): Assertion;
- /**
- * Checks if the obj exactly equals another.
- */
- equal(obj: any): Assertion;
- /**
- * Checks if the obj sortof equals another.
- */
- eql(obj: any): Assertion;
- /**
- * Assert within start to finish (inclusive).
- *
- * @param start
- * @param finish
- */
- within(start: number, finish: number): Assertion;
- /**
- * Assert typeof.
- */
- a(type: string): Assertion;
- /**
- * Assert instanceof.
- */
- a(type: Function): Assertion;
- /**
- * Assert typeof / instanceof.
- */
- an: An;
- /**
- * Assert numeric value above n.
- */
- greaterThan(n: number): Assertion;
- /**
- * Assert numeric value above n.
- */
- above(n: number): Assertion;
- /**
- * Assert numeric value below n.
- */
- lessThan(n: number): Assertion;
- /**
- * Assert numeric value below n.
- */
- below(n: number): Assertion;
- /**
- * Assert string value matches regexp.
- *
- * @param regexp
- */
- match(regexp: RegExp): Assertion;
- /**
- * Assert property "length" exists and has value of n.
- *
- * @param n
- */
- length(n: number): Assertion;
- /**
- * Assert property name exists, with optional val.
- *
- * @param name
- * @param val
- */
- property(name: string, val?: any): Assertion;
- /**
- * Assert that string contains str.
- */
- contain(str: string): Assertion;
- string(str: string): Assertion;
- /**
- * Assert that the array contains obj.
- */
- contain(obj: any): Assertion;
- string(obj: any): Assertion;
- /**
- * Assert exact keys or inclusion of keys by using the `.own` modifier.
- */
- key(keys: string[]): Assertion;
- /**
- * Assert exact keys or inclusion of keys by using the `.own` modifier.
- */
- key(...keys: string[]): Assertion;
- /**
- * Assert exact keys or inclusion of keys by using the `.own` modifier.
- */
- keys(keys: string[]): Assertion;
- /**
- * Assert exact keys or inclusion of keys by using the `.own` modifier.
- */
- keys(...keys: string[]): Assertion;
- /**
- * Assert a failure.
- */
- fail(message?: string): Assertion;
- }
- interface Root extends Assertion {
- not: Not;
- to: To;
- only: Only;
- have: Have;
- be: Be;
- }
- interface Be extends Assertion {
- /**
- * Checks if the obj exactly equals another.
- */
- (obj: any): Assertion;
- an: An;
- }
- interface An extends Assertion {
- /**
- * Assert typeof.
- */
- (type: string): Assertion;
- /**
- * Assert instanceof.
- */
- (type: Function): Assertion;
- }
- interface Not extends Expect.NotBase {
- to: Expect.ToBase;
- }
- interface NotBase extends Assertion {
- be: Be;
- have: Have;
- include: Assertion;
- only: Only;
- }
- interface To extends Expect.ToBase {
- not: Expect.NotBase;
- }
- interface ToBase extends Assertion {
- be: Be;
- have: Have;
- include: Assertion;
- only: Only;
- }
- interface Only extends Assertion {
- have: Have;
- }
- interface Have extends Assertion {
- own: Assertion;
- }
- }
- declare module "expect.js" {
- export = expect;
- }
|