-
Notifications
You must be signed in to change notification settings - Fork 6
/
jasmine2-custom-message.d.ts
63 lines (55 loc) · 1.84 KB
/
jasmine2-custom-message.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Type definitions for Jasmine2 custom messages
// Project: https://github.com/avrelian/jasmine2-custom-message
// Definitions by: Holger Jeromin <https://github.com/HolgerJeromin>
// Definitions: https://github.com/avrelian/jasmine2-custom-message
/// <reference types="jasmine" />
interface Jasmine2CustomMessageFncParam {
/** The actual value */
actual: any,
/** The expected value */
expected: any
}
interface ExpectWrapper {
/**
* Create an expectation for a spec.
* @param spy
*/
expect(spy: Function): jasmine.Matchers<any>;
/**
* Create an expectation for a spec.
* @param actual
*/
expect<T>(actual: ArrayLike<T>): jasmine.ArrayLikeMatchers<T>;
/**
* Create an expectation for a spec.
* @param actual Actual computed value to test expectations against.
*/
expect<T>(actual: T): jasmine.Matchers<T>;
/**
* Create an expectation for a spec.
*/
expect(): jasmine.NothingMatcher;
}
/**
* Add a dynamic custom message.
* The original message from jasmine is available as this.message
* The return value will be converted with toString()
* If it is already a string #{actual} and #{expected} will be replaced with the current values.
* #{message} will be replaced with the original message from jasmine.
*/
declare function since(messageGenerator: (this: Jasmine2CustomMessageFncParam) => any): ExpectWrapper;
/**
* Add a custom message.
* #{actual} and #{expected} will be replaced with the current values.
* #{message} will be replaced with the original message from jasmine.
*/
declare function since(message: string): ExpectWrapper;
/**
* Add a static custom message.
*/
declare function since(message: number | boolean): ExpectWrapper;
/**
* Add a static custom message.
* The text will be generated from toString() or JSON.stringify()
*/
declare function since(message: any): ExpectWrapper;