@oneblink/sdk 0.4.4-beta.1 → 0.4.4-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +7 -19
  3. package/package.json +48 -40
  4. package/tenants/civicplus.d.ts +1 -0
  5. package/tenants/civicplus.js +26 -0
  6. package/tenants/civicplus.js.map +1 -0
  7. package/tenants/classes/Approvals.d.ts +95 -0
  8. package/tenants/classes/Approvals.js +95 -0
  9. package/tenants/classes/Approvals.js.map +1 -0
  10. package/tenants/classes/DataManager.d.ts +45 -0
  11. package/tenants/classes/DataManager.js +68 -0
  12. package/tenants/classes/DataManager.js.map +1 -0
  13. package/tenants/classes/EmailTemplates.d.ts +100 -0
  14. package/tenants/classes/EmailTemplates.js +128 -0
  15. package/tenants/classes/EmailTemplates.js.map +1 -0
  16. package/tenants/classes/Forms.d.ts +667 -0
  17. package/tenants/classes/Forms.js +859 -0
  18. package/tenants/classes/Forms.js.map +1 -0
  19. package/tenants/classes/FormsAppEnvironments.d.ts +103 -0
  20. package/tenants/classes/FormsAppEnvironments.js +131 -0
  21. package/tenants/classes/FormsAppEnvironments.js.map +1 -0
  22. package/tenants/classes/FormsApps.d.ts +207 -0
  23. package/tenants/classes/FormsApps.js +296 -0
  24. package/tenants/classes/FormsApps.js.map +1 -0
  25. package/tenants/classes/Jobs.d.ts +102 -0
  26. package/tenants/classes/Jobs.js +180 -0
  27. package/tenants/classes/Jobs.js.map +1 -0
  28. package/tenants/classes/Keys.d.ts +33 -0
  29. package/tenants/classes/Keys.js +46 -0
  30. package/tenants/classes/Keys.js.map +1 -0
  31. package/tenants/classes/Organisations.d.ts +50 -0
  32. package/tenants/classes/Organisations.js +73 -0
  33. package/tenants/classes/Organisations.js.map +1 -0
  34. package/tenants/classes/PDF.d.ts +108 -0
  35. package/tenants/classes/PDF.js +133 -0
  36. package/tenants/classes/PDF.js.map +1 -0
  37. package/tenants/classes/TeamMembers.d.ts +34 -0
  38. package/tenants/classes/TeamMembers.js +55 -0
  39. package/tenants/classes/TeamMembers.js.map +1 -0
  40. package/tenants/classes/index.d.ts +13 -0
  41. package/tenants/classes/index.js +33 -0
  42. package/tenants/classes/index.js.map +1 -0
  43. package/tenants/classes/sendEmail.d.ts +36 -0
  44. package/tenants/classes/sendEmail.js +53 -0
  45. package/tenants/classes/sendEmail.js.map +1 -0
  46. package/tenants/lib/forms-schema/common.d.ts +9 -0
  47. package/tenants/lib/forms-schema/common.js +67 -0
  48. package/tenants/lib/forms-schema/common.js.map +1 -0
  49. package/tenants/lib/forms-schema/element-schema.d.ts +3 -0
  50. package/tenants/lib/forms-schema/element-schema.js +230 -0
  51. package/tenants/lib/forms-schema/element-schema.js.map +1 -0
  52. package/tenants/lib/forms-schema/elements/AbnElement.d.ts +4 -0
  53. package/tenants/lib/forms-schema/elements/AbnElement.js +22 -0
  54. package/tenants/lib/forms-schema/elements/AbnElement.js.map +1 -0
  55. package/tenants/lib/forms-schema/elements/AutocompleteElement.d.ts +4 -0
  56. package/tenants/lib/forms-schema/elements/AutocompleteElement.js +30 -0
  57. package/tenants/lib/forms-schema/elements/AutocompleteElement.js.map +1 -0
  58. package/tenants/lib/forms-schema/elements/BarcodeElement.d.ts +4 -0
  59. package/tenants/lib/forms-schema/elements/BarcodeElement.js +30 -0
  60. package/tenants/lib/forms-schema/elements/BarcodeElement.js.map +1 -0
  61. package/tenants/lib/forms-schema/elements/BooleanElement.d.ts +4 -0
  62. package/tenants/lib/forms-schema/elements/BooleanElement.js +22 -0
  63. package/tenants/lib/forms-schema/elements/BooleanElement.js.map +1 -0
  64. package/tenants/lib/forms-schema/elements/BsbElement.d.ts +4 -0
  65. package/tenants/lib/forms-schema/elements/BsbElement.js +22 -0
  66. package/tenants/lib/forms-schema/elements/BsbElement.js.map +1 -0
  67. package/tenants/lib/forms-schema/elements/CalculationElement.d.ts +4 -0
  68. package/tenants/lib/forms-schema/elements/CalculationElement.js +32 -0
  69. package/tenants/lib/forms-schema/elements/CalculationElement.js.map +1 -0
  70. package/tenants/lib/forms-schema/elements/CameraElement.d.ts +4 -0
  71. package/tenants/lib/forms-schema/elements/CameraElement.js +24 -0
  72. package/tenants/lib/forms-schema/elements/CameraElement.js.map +1 -0
  73. package/tenants/lib/forms-schema/elements/CaptchaElement.d.ts +4 -0
  74. package/tenants/lib/forms-schema/elements/CaptchaElement.js +20 -0
  75. package/tenants/lib/forms-schema/elements/CaptchaElement.js.map +1 -0
  76. package/tenants/lib/forms-schema/elements/CheckboxElement.d.ts +4 -0
  77. package/tenants/lib/forms-schema/elements/CheckboxElement.js +25 -0
  78. package/tenants/lib/forms-schema/elements/CheckboxElement.js.map +1 -0
  79. package/tenants/lib/forms-schema/elements/CivicaNameRecordElement.d.ts +4 -0
  80. package/tenants/lib/forms-schema/elements/CivicaNameRecordElement.js +47 -0
  81. package/tenants/lib/forms-schema/elements/CivicaNameRecordElement.js.map +1 -0
  82. package/tenants/lib/forms-schema/elements/CivicaStreetNameElement.d.ts +4 -0
  83. package/tenants/lib/forms-schema/elements/CivicaStreetNameElement.js +22 -0
  84. package/tenants/lib/forms-schema/elements/CivicaStreetNameElement.js.map +1 -0
  85. package/tenants/lib/forms-schema/elements/ComplianceElement.d.ts +4 -0
  86. package/tenants/lib/forms-schema/elements/ComplianceElement.js +24 -0
  87. package/tenants/lib/forms-schema/elements/ComplianceElement.js.map +1 -0
  88. package/tenants/lib/forms-schema/elements/DateElement.d.ts +5 -0
  89. package/tenants/lib/forms-schema/elements/DateElement.js +70 -0
  90. package/tenants/lib/forms-schema/elements/DateElement.js.map +1 -0
  91. package/tenants/lib/forms-schema/elements/DrawElement.d.ts +4 -0
  92. package/tenants/lib/forms-schema/elements/DrawElement.js +23 -0
  93. package/tenants/lib/forms-schema/elements/DrawElement.js.map +1 -0
  94. package/tenants/lib/forms-schema/elements/EmailElement.d.ts +4 -0
  95. package/tenants/lib/forms-schema/elements/EmailElement.js +24 -0
  96. package/tenants/lib/forms-schema/elements/EmailElement.js.map +1 -0
  97. package/tenants/lib/forms-schema/elements/FilesElement.d.ts +4 -0
  98. package/tenants/lib/forms-schema/elements/FilesElement.js +36 -0
  99. package/tenants/lib/forms-schema/elements/FilesElement.js.map +1 -0
  100. package/tenants/lib/forms-schema/elements/FormElement.d.ts +4 -0
  101. package/tenants/lib/forms-schema/elements/FormElement.js +17 -0
  102. package/tenants/lib/forms-schema/elements/FormElement.js.map +1 -0
  103. package/tenants/lib/forms-schema/elements/FreshdeskDependentFieldElement.d.ts +4 -0
  104. package/tenants/lib/forms-schema/elements/FreshdeskDependentFieldElement.js +31 -0
  105. package/tenants/lib/forms-schema/elements/FreshdeskDependentFieldElement.js.map +1 -0
  106. package/tenants/lib/forms-schema/elements/GeoscapeElement.d.ts +4 -0
  107. package/tenants/lib/forms-schema/elements/GeoscapeElement.js +23 -0
  108. package/tenants/lib/forms-schema/elements/GeoscapeElement.js.map +1 -0
  109. package/tenants/lib/forms-schema/elements/HTMLElement.d.ts +4 -0
  110. package/tenants/lib/forms-schema/elements/HTMLElement.js +22 -0
  111. package/tenants/lib/forms-schema/elements/HTMLElement.js.map +1 -0
  112. package/tenants/lib/forms-schema/elements/HeadingElement.d.ts +4 -0
  113. package/tenants/lib/forms-schema/elements/HeadingElement.js +18 -0
  114. package/tenants/lib/forms-schema/elements/HeadingElement.js.map +1 -0
  115. package/tenants/lib/forms-schema/elements/ImageElement.d.ts +4 -0
  116. package/tenants/lib/forms-schema/elements/ImageElement.js +18 -0
  117. package/tenants/lib/forms-schema/elements/ImageElement.js.map +1 -0
  118. package/tenants/lib/forms-schema/elements/InfoPageElement.d.ts +4 -0
  119. package/tenants/lib/forms-schema/elements/InfoPageElement.js +17 -0
  120. package/tenants/lib/forms-schema/elements/InfoPageElement.js.map +1 -0
  121. package/tenants/lib/forms-schema/elements/LocationElement.d.ts +4 -0
  122. package/tenants/lib/forms-schema/elements/LocationElement.js +21 -0
  123. package/tenants/lib/forms-schema/elements/LocationElement.js.map +1 -0
  124. package/tenants/lib/forms-schema/elements/NumberElement.d.ts +4 -0
  125. package/tenants/lib/forms-schema/elements/NumberElement.js +95 -0
  126. package/tenants/lib/forms-schema/elements/NumberElement.js.map +1 -0
  127. package/tenants/lib/forms-schema/elements/PhoneElement.d.ts +4 -0
  128. package/tenants/lib/forms-schema/elements/PhoneElement.js +24 -0
  129. package/tenants/lib/forms-schema/elements/PhoneElement.js.map +1 -0
  130. package/tenants/lib/forms-schema/elements/PointElement.d.ts +4 -0
  131. package/tenants/lib/forms-schema/elements/PointElement.js +24 -0
  132. package/tenants/lib/forms-schema/elements/PointElement.js.map +1 -0
  133. package/tenants/lib/forms-schema/elements/RadioElement.d.ts +4 -0
  134. package/tenants/lib/forms-schema/elements/RadioElement.js +24 -0
  135. package/tenants/lib/forms-schema/elements/RadioElement.js.map +1 -0
  136. package/tenants/lib/forms-schema/elements/RepeatableSetElement.d.ts +4 -0
  137. package/tenants/lib/forms-schema/elements/RepeatableSetElement.js +44 -0
  138. package/tenants/lib/forms-schema/elements/RepeatableSetElement.js.map +1 -0
  139. package/tenants/lib/forms-schema/elements/SectionElement.d.ts +4 -0
  140. package/tenants/lib/forms-schema/elements/SectionElement.js +34 -0
  141. package/tenants/lib/forms-schema/elements/SectionElement.js.map +1 -0
  142. package/tenants/lib/forms-schema/elements/SelectElement.d.ts +4 -0
  143. package/tenants/lib/forms-schema/elements/SelectElement.js +34 -0
  144. package/tenants/lib/forms-schema/elements/SelectElement.js.map +1 -0
  145. package/tenants/lib/forms-schema/elements/SummaryElement.d.ts +4 -0
  146. package/tenants/lib/forms-schema/elements/SummaryElement.js +22 -0
  147. package/tenants/lib/forms-schema/elements/SummaryElement.js.map +1 -0
  148. package/tenants/lib/forms-schema/elements/TextElement.d.ts +5 -0
  149. package/tenants/lib/forms-schema/elements/TextElement.js +45 -0
  150. package/tenants/lib/forms-schema/elements/TextElement.js.map +1 -0
  151. package/tenants/lib/forms-schema/elements/TimeElement.d.ts +4 -0
  152. package/tenants/lib/forms-schema/elements/TimeElement.js +23 -0
  153. package/tenants/lib/forms-schema/elements/TimeElement.js.map +1 -0
  154. package/tenants/lib/forms-schema/index.d.ts +15 -0
  155. package/tenants/lib/forms-schema/index.js +441 -0
  156. package/tenants/lib/forms-schema/index.js.map +1 -0
  157. package/tenants/lib/forms-schema/property-schemas.d.ts +53 -0
  158. package/tenants/lib/forms-schema/property-schemas.js +239 -0
  159. package/tenants/lib/forms-schema/property-schemas.js.map +1 -0
  160. package/tenants/lib/forms-validation/common.d.ts +5 -0
  161. package/tenants/lib/forms-validation/common.js +50 -0
  162. package/tenants/lib/forms-validation/common.js.map +1 -0
  163. package/tenants/lib/forms-validation/index.d.ts +8 -0
  164. package/tenants/lib/forms-validation/index.js +165 -0
  165. package/tenants/lib/forms-validation/index.js.map +1 -0
  166. package/tenants/lib/forms-validation/validate-form-events.d.ts +16 -0
  167. package/tenants/lib/forms-validation/validate-form-events.js +164 -0
  168. package/tenants/lib/forms-validation/validate-form-events.js.map +1 -0
  169. package/tenants/lib/generate-form-element.d.ts +2 -0
  170. package/tenants/lib/generate-form-element.js +49 -0
  171. package/tenants/lib/generate-form-element.js.map +1 -0
  172. package/tenants/lib/generate-form-url.d.ts +9 -0
  173. package/tenants/lib/generate-form-url.js +32 -0
  174. package/tenants/lib/generate-form-url.js.map +1 -0
  175. package/tenants/lib/generate-jwt.d.ts +1 -0
  176. package/tenants/lib/generate-jwt.js +15 -0
  177. package/tenants/lib/generate-jwt.js.map +1 -0
  178. package/tenants/lib/generate-page-element.d.ts +2 -0
  179. package/tenants/lib/generate-page-element.js +32 -0
  180. package/tenants/lib/generate-page-element.js.map +1 -0
  181. package/tenants/lib/generate-tenant.d.ts +2 -0
  182. package/tenants/lib/generate-tenant.js +13 -0
  183. package/tenants/lib/generate-tenant.js.map +1 -0
  184. package/tenants/lib/one-blink-api.d.ts +37 -0
  185. package/tenants/lib/one-blink-api.js +122 -0
  186. package/tenants/lib/one-blink-api.js.map +1 -0
  187. package/tenants/lib/package.d.ts +2 -0
  188. package/tenants/lib/package.js +6 -0
  189. package/tenants/lib/package.js.map +1 -0
  190. package/tenants/lib/pre-fill-data.d.ts +2 -0
  191. package/tenants/lib/pre-fill-data.js +29 -0
  192. package/tenants/lib/pre-fill-data.js.map +1 -0
  193. package/tenants/lib/retrieve-submission-data.d.ts +2 -0
  194. package/tenants/lib/retrieve-submission-data.js +26 -0
  195. package/tenants/lib/retrieve-submission-data.js.map +1 -0
  196. package/tenants/lib/tenant-configuration.d.ts +3 -0
  197. package/tenants/lib/tenant-configuration.js +22 -0
  198. package/tenants/lib/tenant-configuration.js.map +1 -0
  199. package/tenants/lib/upload-asset.d.ts +4 -0
  200. package/tenants/lib/upload-asset.js +30 -0
  201. package/tenants/lib/upload-asset.js.map +1 -0
  202. package/tenants/lib/user-token-helpers.d.ts +9 -0
  203. package/tenants/lib/user-token-helpers.js +34 -0
  204. package/tenants/lib/user-token-helpers.js.map +1 -0
  205. package/tenants/oneblink.d.ts +1 -0
  206. package/tenants/oneblink.js +26 -0
  207. package/tenants/oneblink.js.map +1 -0
  208. package/tenants/types.d.ts +304 -0
  209. package/tenants/types.js +18 -0
  210. package/tenants/types.js.map +1 -0
  211. package/changelog.md +0 -201
  212. package/classes/Forms.js +0 -244
  213. package/classes/FormsApps.js +0 -98
  214. package/classes/Jobs.js +0 -133
  215. package/classes/Keys.js +0 -23
  216. package/classes/Organisations.js +0 -25
  217. package/classes/TeamMembers.js +0 -34
  218. package/flow-typed/npm/axios_v0.18.x.js +0 -165
  219. package/flow-typed/npm/jest_v24.x.x.js +0 -1186
  220. package/flow-typed/types.js +0 -301
  221. package/index.js +0 -18
  222. package/lib/forms-schema.js +0 -859
  223. package/lib/forms-validation.js +0 -33
  224. package/lib/generate-form-element.js +0 -75
  225. package/lib/generate-form-url.js +0 -29
  226. package/lib/generate-jwt.js +0 -18
  227. package/lib/one-blink-api-error-handler.js +0 -31
  228. package/lib/one-blink-api.js +0 -107
  229. package/lib/pre-fill-data.js +0 -33
  230. package/lib/retrieve-submission-data.js +0 -29
  231. package/lib/tenant.js +0 -23
@@ -1,1186 +0,0 @@
1
- // flow-typed signature: 833075a5cefc49eb523160a5fca9d8b6
2
- // flow-typed version: 325925f1b7/jest_v24.x.x/flow_>=v0.39.x
3
-
4
- type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
5
- (...args: TArguments): TReturn,
6
- /**
7
- * An object for introspecting mock calls
8
- */
9
- mock: {
10
- /**
11
- * An array that represents all calls that have been made into this mock
12
- * function. Each call is represented by an array of arguments that were
13
- * passed during the call.
14
- */
15
- calls: Array<TArguments>,
16
- /**
17
- * An array that contains all the object instances that have been
18
- * instantiated from this mock function.
19
- */
20
- instances: Array<TReturn>,
21
- /**
22
- * An array that contains all the object results that have been
23
- * returned by this mock function call
24
- */
25
- results: Array<{ isThrow: boolean, value: TReturn }>,
26
- },
27
- /**
28
- * Resets all information stored in the mockFn.mock.calls and
29
- * mockFn.mock.instances arrays. Often this is useful when you want to clean
30
- * up a mock's usage data between two assertions.
31
- */
32
- mockClear(): void,
33
- /**
34
- * Resets all information stored in the mock. This is useful when you want to
35
- * completely restore a mock back to its initial state.
36
- */
37
- mockReset(): void,
38
- /**
39
- * Removes the mock and restores the initial implementation. This is useful
40
- * when you want to mock functions in certain test cases and restore the
41
- * original implementation in others. Beware that mockFn.mockRestore only
42
- * works when mock was created with jest.spyOn. Thus you have to take care of
43
- * restoration yourself when manually assigning jest.fn().
44
- */
45
- mockRestore(): void,
46
- /**
47
- * Accepts a function that should be used as the implementation of the mock.
48
- * The mock itself will still record all calls that go into and instances
49
- * that come from itself -- the only difference is that the implementation
50
- * will also be executed when the mock is called.
51
- */
52
- mockImplementation(
53
- fn: (...args: TArguments) => TReturn
54
- ): JestMockFn<TArguments, TReturn>,
55
- /**
56
- * Accepts a function that will be used as an implementation of the mock for
57
- * one call to the mocked function. Can be chained so that multiple function
58
- * calls produce different results.
59
- */
60
- mockImplementationOnce(
61
- fn: (...args: TArguments) => TReturn
62
- ): JestMockFn<TArguments, TReturn>,
63
- /**
64
- * Accepts a string to use in test result output in place of "jest.fn()" to
65
- * indicate which mock function is being referenced.
66
- */
67
- mockName(name: string): JestMockFn<TArguments, TReturn>,
68
- /**
69
- * Just a simple sugar function for returning `this`
70
- */
71
- mockReturnThis(): void,
72
- /**
73
- * Accepts a value that will be returned whenever the mock function is called.
74
- */
75
- mockReturnValue(value: TReturn): JestMockFn<TArguments, TReturn>,
76
- /**
77
- * Sugar for only returning a value once inside your mock
78
- */
79
- mockReturnValueOnce(value: TReturn): JestMockFn<TArguments, TReturn>,
80
- /**
81
- * Sugar for jest.fn().mockImplementation(() => Promise.resolve(value))
82
- */
83
- mockResolvedValue(value: TReturn): JestMockFn<TArguments, Promise<TReturn>>,
84
- /**
85
- * Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value))
86
- */
87
- mockResolvedValueOnce(
88
- value: TReturn
89
- ): JestMockFn<TArguments, Promise<TReturn>>,
90
- /**
91
- * Sugar for jest.fn().mockImplementation(() => Promise.reject(value))
92
- */
93
- mockRejectedValue(value: TReturn): JestMockFn<TArguments, Promise<any>>,
94
- /**
95
- * Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value))
96
- */
97
- mockRejectedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<any>>,
98
- };
99
-
100
- type JestAsymmetricEqualityType = {
101
- /**
102
- * A custom Jasmine equality tester
103
- */
104
- asymmetricMatch(value: mixed): boolean,
105
- };
106
-
107
- type JestCallsType = {
108
- allArgs(): mixed,
109
- all(): mixed,
110
- any(): boolean,
111
- count(): number,
112
- first(): mixed,
113
- mostRecent(): mixed,
114
- reset(): void,
115
- };
116
-
117
- type JestClockType = {
118
- install(): void,
119
- mockDate(date: Date): void,
120
- tick(milliseconds?: number): void,
121
- uninstall(): void,
122
- };
123
-
124
- type JestMatcherResult = {
125
- message?: string | (() => string),
126
- pass: boolean,
127
- };
128
-
129
- type JestMatcher = (
130
- actual: any,
131
- expected: any
132
- ) => JestMatcherResult | Promise<JestMatcherResult>;
133
-
134
- type JestPromiseType = {
135
- /**
136
- * Use rejects to unwrap the reason of a rejected promise so any other
137
- * matcher can be chained. If the promise is fulfilled the assertion fails.
138
- */
139
- rejects: JestExpectType,
140
- /**
141
- * Use resolves to unwrap the value of a fulfilled promise so any other
142
- * matcher can be chained. If the promise is rejected the assertion fails.
143
- */
144
- resolves: JestExpectType,
145
- };
146
-
147
- /**
148
- * Jest allows functions and classes to be used as test names in test() and
149
- * describe()
150
- */
151
- type JestTestName = string | Function;
152
-
153
- /**
154
- * Plugin: jest-styled-components
155
- */
156
-
157
- type JestStyledComponentsMatcherValue =
158
- | string
159
- | JestAsymmetricEqualityType
160
- | RegExp
161
- | typeof undefined;
162
-
163
- type JestStyledComponentsMatcherOptions = {
164
- media?: string,
165
- modifier?: string,
166
- supports?: string,
167
- };
168
-
169
- type JestStyledComponentsMatchersType = {
170
- toHaveStyleRule(
171
- property: string,
172
- value: JestStyledComponentsMatcherValue,
173
- options?: JestStyledComponentsMatcherOptions
174
- ): void,
175
- };
176
-
177
- /**
178
- * Plugin: jest-enzyme
179
- */
180
- type EnzymeMatchersType = {
181
- // 5.x
182
- toBeEmpty(): void,
183
- toBePresent(): void,
184
- // 6.x
185
- toBeChecked(): void,
186
- toBeDisabled(): void,
187
- toBeEmptyRender(): void,
188
- toContainMatchingElement(selector: string): void,
189
- toContainMatchingElements(n: number, selector: string): void,
190
- toContainExactlyOneMatchingElement(selector: string): void,
191
- toContainReact(element: React$Element<any>): void,
192
- toExist(): void,
193
- toHaveClassName(className: string): void,
194
- toHaveHTML(html: string): void,
195
- toHaveProp: ((propKey: string, propValue?: any) => void) &
196
- ((props: {}) => void),
197
- toHaveRef(refName: string): void,
198
- toHaveState: ((stateKey: string, stateValue?: any) => void) &
199
- ((state: {}) => void),
200
- toHaveStyle: ((styleKey: string, styleValue?: any) => void) &
201
- ((style: {}) => void),
202
- toHaveTagName(tagName: string): void,
203
- toHaveText(text: string): void,
204
- toHaveValue(value: any): void,
205
- toIncludeText(text: string): void,
206
- toMatchElement(
207
- element: React$Element<any>,
208
- options?: {| ignoreProps?: boolean, verbose?: boolean |}
209
- ): void,
210
- toMatchSelector(selector: string): void,
211
- // 7.x
212
- toHaveDisplayName(name: string): void,
213
- };
214
-
215
- // DOM testing library extensions https://github.com/kentcdodds/dom-testing-library#custom-jest-matchers
216
- type DomTestingLibraryType = {
217
- toBeDisabled(): void,
218
- toBeEmpty(): void,
219
- toBeInTheDocument(): void,
220
- toBeVisible(): void,
221
- toContainElement(element: HTMLElement | null): void,
222
- toContainHTML(htmlText: string): void,
223
- toHaveAttribute(name: string, expectedValue?: string): void,
224
- toHaveClass(...classNames: string[]): void,
225
- toHaveFocus(): void,
226
- toHaveFormValues(expectedValues: { [name: string]: any }): void,
227
- toHaveStyle(css: string): void,
228
- toHaveTextContent(
229
- content: string | RegExp,
230
- options?: { normalizeWhitespace: boolean }
231
- ): void,
232
- toBeInTheDOM(): void,
233
- };
234
-
235
- // Jest JQuery Matchers: https://github.com/unindented/custom-jquery-matchers
236
- type JestJQueryMatchersType = {
237
- toExist(): void,
238
- toHaveLength(len: number): void,
239
- toHaveId(id: string): void,
240
- toHaveClass(className: string): void,
241
- toHaveTag(tag: string): void,
242
- toHaveAttr(key: string, val?: any): void,
243
- toHaveProp(key: string, val?: any): void,
244
- toHaveText(text: string | RegExp): void,
245
- toHaveData(key: string, val?: any): void,
246
- toHaveValue(val: any): void,
247
- toHaveCss(css: { [key: string]: any }): void,
248
- toBeChecked(): void,
249
- toBeDisabled(): void,
250
- toBeEmpty(): void,
251
- toBeHidden(): void,
252
- toBeSelected(): void,
253
- toBeVisible(): void,
254
- toBeFocused(): void,
255
- toBeInDom(): void,
256
- toBeMatchedBy(sel: string): void,
257
- toHaveDescendant(sel: string): void,
258
- toHaveDescendantWithText(sel: string, text: string | RegExp): void,
259
- };
260
-
261
- // Jest Extended Matchers: https://github.com/jest-community/jest-extended
262
- type JestExtendedMatchersType = {
263
- /**
264
- * Note: Currently unimplemented
265
- * Passing assertion
266
- *
267
- * @param {String} message
268
- */
269
- // pass(message: string): void;
270
-
271
- /**
272
- * Note: Currently unimplemented
273
- * Failing assertion
274
- *
275
- * @param {String} message
276
- */
277
- // fail(message: string): void;
278
-
279
- /**
280
- * Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty.
281
- */
282
- toBeEmpty(): void,
283
-
284
- /**
285
- * Use .toBeOneOf when checking if a value is a member of a given Array.
286
- * @param {Array.<*>} members
287
- */
288
- toBeOneOf(members: any[]): void,
289
-
290
- /**
291
- * Use `.toBeNil` when checking a value is `null` or `undefined`.
292
- */
293
- toBeNil(): void,
294
-
295
- /**
296
- * Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`.
297
- * @param {Function} predicate
298
- */
299
- toSatisfy(predicate: (n: any) => boolean): void,
300
-
301
- /**
302
- * Use `.toBeArray` when checking if a value is an `Array`.
303
- */
304
- toBeArray(): void,
305
-
306
- /**
307
- * Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x.
308
- * @param {Number} x
309
- */
310
- toBeArrayOfSize(x: number): void,
311
-
312
- /**
313
- * Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set.
314
- * @param {Array.<*>} members
315
- */
316
- toIncludeAllMembers(members: any[]): void,
317
-
318
- /**
319
- * Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set.
320
- * @param {Array.<*>} members
321
- */
322
- toIncludeAnyMembers(members: any[]): void,
323
-
324
- /**
325
- * Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array.
326
- * @param {Function} predicate
327
- */
328
- toSatisfyAll(predicate: (n: any) => boolean): void,
329
-
330
- /**
331
- * Use `.toBeBoolean` when checking if a value is a `Boolean`.
332
- */
333
- toBeBoolean(): void,
334
-
335
- /**
336
- * Use `.toBeTrue` when checking a value is equal (===) to `true`.
337
- */
338
- toBeTrue(): void,
339
-
340
- /**
341
- * Use `.toBeFalse` when checking a value is equal (===) to `false`.
342
- */
343
- toBeFalse(): void,
344
-
345
- /**
346
- * Use .toBeDate when checking if a value is a Date.
347
- */
348
- toBeDate(): void,
349
-
350
- /**
351
- * Use `.toBeFunction` when checking if a value is a `Function`.
352
- */
353
- toBeFunction(): void,
354
-
355
- /**
356
- * Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`.
357
- *
358
- * Note: Required Jest version >22
359
- * Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same
360
- *
361
- * @param {Mock} mock
362
- */
363
- toHaveBeenCalledBefore(mock: JestMockFn<any, any>): void,
364
-
365
- /**
366
- * Use `.toBeNumber` when checking if a value is a `Number`.
367
- */
368
- toBeNumber(): void,
369
-
370
- /**
371
- * Use `.toBeNaN` when checking a value is `NaN`.
372
- */
373
- toBeNaN(): void,
374
-
375
- /**
376
- * Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`.
377
- */
378
- toBeFinite(): void,
379
-
380
- /**
381
- * Use `.toBePositive` when checking if a value is a positive `Number`.
382
- */
383
- toBePositive(): void,
384
-
385
- /**
386
- * Use `.toBeNegative` when checking if a value is a negative `Number`.
387
- */
388
- toBeNegative(): void,
389
-
390
- /**
391
- * Use `.toBeEven` when checking if a value is an even `Number`.
392
- */
393
- toBeEven(): void,
394
-
395
- /**
396
- * Use `.toBeOdd` when checking if a value is an odd `Number`.
397
- */
398
- toBeOdd(): void,
399
-
400
- /**
401
- * Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive).
402
- *
403
- * @param {Number} start
404
- * @param {Number} end
405
- */
406
- toBeWithin(start: number, end: number): void,
407
-
408
- /**
409
- * Use `.toBeObject` when checking if a value is an `Object`.
410
- */
411
- toBeObject(): void,
412
-
413
- /**
414
- * Use `.toContainKey` when checking if an object contains the provided key.
415
- *
416
- * @param {String} key
417
- */
418
- toContainKey(key: string): void,
419
-
420
- /**
421
- * Use `.toContainKeys` when checking if an object has all of the provided keys.
422
- *
423
- * @param {Array.<String>} keys
424
- */
425
- toContainKeys(keys: string[]): void,
426
-
427
- /**
428
- * Use `.toContainAllKeys` when checking if an object only contains all of the provided keys.
429
- *
430
- * @param {Array.<String>} keys
431
- */
432
- toContainAllKeys(keys: string[]): void,
433
-
434
- /**
435
- * Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys.
436
- *
437
- * @param {Array.<String>} keys
438
- */
439
- toContainAnyKeys(keys: string[]): void,
440
-
441
- /**
442
- * Use `.toContainValue` when checking if an object contains the provided value.
443
- *
444
- * @param {*} value
445
- */
446
- toContainValue(value: any): void,
447
-
448
- /**
449
- * Use `.toContainValues` when checking if an object contains all of the provided values.
450
- *
451
- * @param {Array.<*>} values
452
- */
453
- toContainValues(values: any[]): void,
454
-
455
- /**
456
- * Use `.toContainAllValues` when checking if an object only contains all of the provided values.
457
- *
458
- * @param {Array.<*>} values
459
- */
460
- toContainAllValues(values: any[]): void,
461
-
462
- /**
463
- * Use `.toContainAnyValues` when checking if an object contains at least one of the provided values.
464
- *
465
- * @param {Array.<*>} values
466
- */
467
- toContainAnyValues(values: any[]): void,
468
-
469
- /**
470
- * Use `.toContainEntry` when checking if an object contains the provided entry.
471
- *
472
- * @param {Array.<String, String>} entry
473
- */
474
- toContainEntry(entry: [string, string]): void,
475
-
476
- /**
477
- * Use `.toContainEntries` when checking if an object contains all of the provided entries.
478
- *
479
- * @param {Array.<Array.<String, String>>} entries
480
- */
481
- toContainEntries(entries: [string, string][]): void,
482
-
483
- /**
484
- * Use `.toContainAllEntries` when checking if an object only contains all of the provided entries.
485
- *
486
- * @param {Array.<Array.<String, String>>} entries
487
- */
488
- toContainAllEntries(entries: [string, string][]): void,
489
-
490
- /**
491
- * Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries.
492
- *
493
- * @param {Array.<Array.<String, String>>} entries
494
- */
495
- toContainAnyEntries(entries: [string, string][]): void,
496
-
497
- /**
498
- * Use `.toBeExtensible` when checking if an object is extensible.
499
- */
500
- toBeExtensible(): void,
501
-
502
- /**
503
- * Use `.toBeFrozen` when checking if an object is frozen.
504
- */
505
- toBeFrozen(): void,
506
-
507
- /**
508
- * Use `.toBeSealed` when checking if an object is sealed.
509
- */
510
- toBeSealed(): void,
511
-
512
- /**
513
- * Use `.toBeString` when checking if a value is a `String`.
514
- */
515
- toBeString(): void,
516
-
517
- /**
518
- * Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings.
519
- *
520
- * @param {String} string
521
- */
522
- toEqualCaseInsensitive(string: string): void,
523
-
524
- /**
525
- * Use `.toStartWith` when checking if a `String` starts with a given `String` prefix.
526
- *
527
- * @param {String} prefix
528
- */
529
- toStartWith(prefix: string): void,
530
-
531
- /**
532
- * Use `.toEndWith` when checking if a `String` ends with a given `String` suffix.
533
- *
534
- * @param {String} suffix
535
- */
536
- toEndWith(suffix: string): void,
537
-
538
- /**
539
- * Use `.toInclude` when checking if a `String` includes the given `String` substring.
540
- *
541
- * @param {String} substring
542
- */
543
- toInclude(substring: string): void,
544
-
545
- /**
546
- * Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times.
547
- *
548
- * @param {String} substring
549
- * @param {Number} times
550
- */
551
- toIncludeRepeated(substring: string, times: number): void,
552
-
553
- /**
554
- * Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings.
555
- *
556
- * @param {Array.<String>} substring
557
- */
558
- toIncludeMultiple(substring: string[]): void,
559
- };
560
-
561
- interface JestExpectType {
562
- not: JestExpectType &
563
- EnzymeMatchersType &
564
- DomTestingLibraryType &
565
- JestJQueryMatchersType &
566
- JestStyledComponentsMatchersType &
567
- JestExtendedMatchersType;
568
- /**
569
- * If you have a mock function, you can use .lastCalledWith to test what
570
- * arguments it was last called with.
571
- */
572
- lastCalledWith(...args: Array<any>): void;
573
- /**
574
- * toBe just checks that a value is what you expect. It uses === to check
575
- * strict equality.
576
- */
577
- toBe(value: any): void;
578
- /**
579
- * Use .toBeCalledWith to ensure that a mock function was called with
580
- * specific arguments.
581
- */
582
- toBeCalledWith(...args: Array<any>): void;
583
- /**
584
- * Using exact equality with floating point numbers is a bad idea. Rounding
585
- * means that intuitive things fail.
586
- */
587
- toBeCloseTo(num: number, delta: any): void;
588
- /**
589
- * Use .toBeDefined to check that a variable is not undefined.
590
- */
591
- toBeDefined(): void;
592
- /**
593
- * Use .toBeFalsy when you don't care what a value is, you just want to
594
- * ensure a value is false in a boolean context.
595
- */
596
- toBeFalsy(): void;
597
- /**
598
- * To compare floating point numbers, you can use toBeGreaterThan.
599
- */
600
- toBeGreaterThan(number: number): void;
601
- /**
602
- * To compare floating point numbers, you can use toBeGreaterThanOrEqual.
603
- */
604
- toBeGreaterThanOrEqual(number: number): void;
605
- /**
606
- * To compare floating point numbers, you can use toBeLessThan.
607
- */
608
- toBeLessThan(number: number): void;
609
- /**
610
- * To compare floating point numbers, you can use toBeLessThanOrEqual.
611
- */
612
- toBeLessThanOrEqual(number: number): void;
613
- /**
614
- * Use .toBeInstanceOf(Class) to check that an object is an instance of a
615
- * class.
616
- */
617
- toBeInstanceOf(cls: Class<*>): void;
618
- /**
619
- * .toBeNull() is the same as .toBe(null) but the error messages are a bit
620
- * nicer.
621
- */
622
- toBeNull(): void;
623
- /**
624
- * Use .toBeTruthy when you don't care what a value is, you just want to
625
- * ensure a value is true in a boolean context.
626
- */
627
- toBeTruthy(): void;
628
- /**
629
- * Use .toBeUndefined to check that a variable is undefined.
630
- */
631
- toBeUndefined(): void;
632
- /**
633
- * Use .toContain when you want to check that an item is in a list. For
634
- * testing the items in the list, this uses ===, a strict equality check.
635
- */
636
- toContain(item: any): void;
637
- /**
638
- * Use .toContainEqual when you want to check that an item is in a list. For
639
- * testing the items in the list, this matcher recursively checks the
640
- * equality of all fields, rather than checking for object identity.
641
- */
642
- toContainEqual(item: any): void;
643
- /**
644
- * Use .toEqual when you want to check that two objects have the same value.
645
- * This matcher recursively checks the equality of all fields, rather than
646
- * checking for object identity.
647
- */
648
- toEqual(value: any): void;
649
- /**
650
- * Use .toHaveBeenCalled to ensure that a mock function got called.
651
- */
652
- toHaveBeenCalled(): void;
653
- toBeCalled(): void;
654
- /**
655
- * Use .toHaveBeenCalledTimes to ensure that a mock function got called exact
656
- * number of times.
657
- */
658
- toHaveBeenCalledTimes(number: number): void;
659
- toBeCalledTimes(number: number): void;
660
- /**
661
- *
662
- */
663
- toHaveBeenNthCalledWith(nthCall: number, ...args: Array<any>): void;
664
- nthCalledWith(nthCall: number, ...args: Array<any>): void;
665
- /**
666
- *
667
- */
668
- toHaveReturned(): void;
669
- toReturn(): void;
670
- /**
671
- *
672
- */
673
- toHaveReturnedTimes(number: number): void;
674
- toReturnTimes(number: number): void;
675
- /**
676
- *
677
- */
678
- toHaveReturnedWith(value: any): void;
679
- toReturnWith(value: any): void;
680
- /**
681
- *
682
- */
683
- toHaveLastReturnedWith(value: any): void;
684
- lastReturnedWith(value: any): void;
685
- /**
686
- *
687
- */
688
- toHaveNthReturnedWith(nthCall: number, value: any): void;
689
- nthReturnedWith(nthCall: number, value: any): void;
690
- /**
691
- * Use .toHaveBeenCalledWith to ensure that a mock function was called with
692
- * specific arguments.
693
- */
694
- toHaveBeenCalledWith(...args: Array<any>): void;
695
- toBeCalledWith(...args: Array<any>): void;
696
- /**
697
- * Use .toHaveBeenLastCalledWith to ensure that a mock function was last called
698
- * with specific arguments.
699
- */
700
- toHaveBeenLastCalledWith(...args: Array<any>): void;
701
- lastCalledWith(...args: Array<any>): void;
702
- /**
703
- * Check that an object has a .length property and it is set to a certain
704
- * numeric value.
705
- */
706
- toHaveLength(number: number): void;
707
- /**
708
- *
709
- */
710
- toHaveProperty(propPath: string, value?: any): void;
711
- /**
712
- * Use .toMatch to check that a string matches a regular expression or string.
713
- */
714
- toMatch(regexpOrString: RegExp | string): void;
715
- /**
716
- * Use .toMatchObject to check that a javascript object matches a subset of the properties of an object.
717
- */
718
- toMatchObject(object: Object | Array<Object>): void;
719
- /**
720
- * Use .toStrictEqual to check that a javascript object matches a subset of the properties of an object.
721
- */
722
- toStrictEqual(value: any): void;
723
- /**
724
- * This ensures that an Object matches the most recent snapshot.
725
- */
726
- toMatchSnapshot(propertyMatchers?: any, name?: string): void;
727
- /**
728
- * This ensures that an Object matches the most recent snapshot.
729
- */
730
- toMatchSnapshot(name: string): void;
731
-
732
- toMatchInlineSnapshot(snapshot?: string): void;
733
- toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void;
734
- /**
735
- * Use .toThrow to test that a function throws when it is called.
736
- * If you want to test that a specific error gets thrown, you can provide an
737
- * argument to toThrow. The argument can be a string for the error message,
738
- * a class for the error, or a regex that should match the error.
739
- *
740
- * Alias: .toThrowError
741
- */
742
- toThrow(message?: string | Error | Class<Error> | RegExp): void;
743
- toThrowError(message?: string | Error | Class<Error> | RegExp): void;
744
- /**
745
- * Use .toThrowErrorMatchingSnapshot to test that a function throws a error
746
- * matching the most recent snapshot when it is called.
747
- */
748
- toThrowErrorMatchingSnapshot(): void;
749
- toThrowErrorMatchingInlineSnapshot(snapshot?: string): void;
750
- }
751
-
752
- type JestObjectType = {
753
- /**
754
- * Disables automatic mocking in the module loader.
755
- *
756
- * After this method is called, all `require()`s will return the real
757
- * versions of each module (rather than a mocked version).
758
- */
759
- disableAutomock(): JestObjectType,
760
- /**
761
- * An un-hoisted version of disableAutomock
762
- */
763
- autoMockOff(): JestObjectType,
764
- /**
765
- * Enables automatic mocking in the module loader.
766
- */
767
- enableAutomock(): JestObjectType,
768
- /**
769
- * An un-hoisted version of enableAutomock
770
- */
771
- autoMockOn(): JestObjectType,
772
- /**
773
- * Clears the mock.calls and mock.instances properties of all mocks.
774
- * Equivalent to calling .mockClear() on every mocked function.
775
- */
776
- clearAllMocks(): JestObjectType,
777
- /**
778
- * Resets the state of all mocks. Equivalent to calling .mockReset() on every
779
- * mocked function.
780
- */
781
- resetAllMocks(): JestObjectType,
782
- /**
783
- * Restores all mocks back to their original value.
784
- */
785
- restoreAllMocks(): JestObjectType,
786
- /**
787
- * Removes any pending timers from the timer system.
788
- */
789
- clearAllTimers(): void,
790
- /**
791
- * Returns the number of fake timers still left to run.
792
- */
793
- getTimerCount(): number,
794
- /**
795
- * The same as `mock` but not moved to the top of the expectation by
796
- * babel-jest.
797
- */
798
- doMock(moduleName: string, moduleFactory?: any): JestObjectType,
799
- /**
800
- * The same as `unmock` but not moved to the top of the expectation by
801
- * babel-jest.
802
- */
803
- dontMock(moduleName: string): JestObjectType,
804
- /**
805
- * Returns a new, unused mock function. Optionally takes a mock
806
- * implementation.
807
- */
808
- fn<TArguments: $ReadOnlyArray<*>, TReturn>(
809
- implementation?: (...args: TArguments) => TReturn
810
- ): JestMockFn<TArguments, TReturn>,
811
- /**
812
- * Determines if the given function is a mocked function.
813
- */
814
- isMockFunction(fn: Function): boolean,
815
- /**
816
- * Given the name of a module, use the automatic mocking system to generate a
817
- * mocked version of the module for you.
818
- */
819
- genMockFromModule(moduleName: string): any,
820
- /**
821
- * Mocks a module with an auto-mocked version when it is being required.
822
- *
823
- * The second argument can be used to specify an explicit module factory that
824
- * is being run instead of using Jest's automocking feature.
825
- *
826
- * The third argument can be used to create virtual mocks -- mocks of modules
827
- * that don't exist anywhere in the system.
828
- */
829
- mock(
830
- moduleName: string,
831
- moduleFactory?: any,
832
- options?: Object
833
- ): JestObjectType,
834
- /**
835
- * Returns the actual module instead of a mock, bypassing all checks on
836
- * whether the module should receive a mock implementation or not.
837
- */
838
- requireActual(moduleName: string): any,
839
- /**
840
- * Returns a mock module instead of the actual module, bypassing all checks
841
- * on whether the module should be required normally or not.
842
- */
843
- requireMock(moduleName: string): any,
844
- /**
845
- * Resets the module registry - the cache of all required modules. This is
846
- * useful to isolate modules where local state might conflict between tests.
847
- */
848
- resetModules(): JestObjectType,
849
-
850
- /**
851
- * Creates a sandbox registry for the modules that are loaded inside the
852
- * callback function. This is useful to isolate specific modules for every
853
- * test so that local module state doesn't conflict between tests.
854
- */
855
- isolateModules(fn: () => void): JestObjectType,
856
-
857
- /**
858
- * Exhausts the micro-task queue (usually interfaced in node via
859
- * process.nextTick).
860
- */
861
- runAllTicks(): void,
862
- /**
863
- * Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(),
864
- * setInterval(), and setImmediate()).
865
- */
866
- runAllTimers(): void,
867
- /**
868
- * Exhausts all tasks queued by setImmediate().
869
- */
870
- runAllImmediates(): void,
871
- /**
872
- * Executes only the macro task queue (i.e. all tasks queued by setTimeout()
873
- * or setInterval() and setImmediate()).
874
- */
875
- advanceTimersByTime(msToRun: number): void,
876
- /**
877
- * Executes only the macro task queue (i.e. all tasks queued by setTimeout()
878
- * or setInterval() and setImmediate()).
879
- *
880
- * Renamed to `advanceTimersByTime`.
881
- */
882
- runTimersToTime(msToRun: number): void,
883
- /**
884
- * Executes only the macro-tasks that are currently pending (i.e., only the
885
- * tasks that have been queued by setTimeout() or setInterval() up to this
886
- * point)
887
- */
888
- runOnlyPendingTimers(): void,
889
- /**
890
- * Explicitly supplies the mock object that the module system should return
891
- * for the specified module. Note: It is recommended to use jest.mock()
892
- * instead.
893
- */
894
- setMock(moduleName: string, moduleExports: any): JestObjectType,
895
- /**
896
- * Indicates that the module system should never return a mocked version of
897
- * the specified module from require() (e.g. that it should always return the
898
- * real module).
899
- */
900
- unmock(moduleName: string): JestObjectType,
901
- /**
902
- * Instructs Jest to use fake versions of the standard timer functions
903
- * (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
904
- * setImmediate and clearImmediate).
905
- */
906
- useFakeTimers(): JestObjectType,
907
- /**
908
- * Instructs Jest to use the real versions of the standard timer functions.
909
- */
910
- useRealTimers(): JestObjectType,
911
- /**
912
- * Creates a mock function similar to jest.fn but also tracks calls to
913
- * object[methodName].
914
- */
915
- spyOn(
916
- object: Object,
917
- methodName: string,
918
- accessType?: 'get' | 'set'
919
- ): JestMockFn<any, any>,
920
- /**
921
- * Set the default timeout interval for tests and before/after hooks in milliseconds.
922
- * Note: The default timeout interval is 5 seconds if this method is not called.
923
- */
924
- setTimeout(timeout: number): JestObjectType,
925
- };
926
-
927
- type JestSpyType = {
928
- calls: JestCallsType,
929
- };
930
-
931
- /** Runs this function after every test inside this context */
932
- declare function afterEach(
933
- fn: (done: () => void) => ?Promise<mixed>,
934
- timeout?: number
935
- ): void;
936
- /** Runs this function before every test inside this context */
937
- declare function beforeEach(
938
- fn: (done: () => void) => ?Promise<mixed>,
939
- timeout?: number
940
- ): void;
941
- /** Runs this function after all tests have finished inside this context */
942
- declare function afterAll(
943
- fn: (done: () => void) => ?Promise<mixed>,
944
- timeout?: number
945
- ): void;
946
- /** Runs this function before any tests have started inside this context */
947
- declare function beforeAll(
948
- fn: (done: () => void) => ?Promise<mixed>,
949
- timeout?: number
950
- ): void;
951
-
952
- /** A context for grouping tests together */
953
- declare var describe: {
954
- /**
955
- * Creates a block that groups together several related tests in one "test suite"
956
- */
957
- (name: JestTestName, fn: () => void): void,
958
-
959
- /**
960
- * Only run this describe block
961
- */
962
- only(name: JestTestName, fn: () => void): void,
963
-
964
- /**
965
- * Skip running this describe block
966
- */
967
- skip(name: JestTestName, fn: () => void): void,
968
-
969
- /**
970
- * each runs this test against array of argument arrays per each run
971
- *
972
- * @param {table} table of Test
973
- */
974
- each(
975
- ...table: Array<Array<mixed> | mixed> | [Array<string>, string]
976
- ): (
977
- name: JestTestName,
978
- fn?: (...args: Array<any>) => ?Promise<mixed>,
979
- timeout?: number
980
- ) => void,
981
- };
982
-
983
- /** An individual test unit */
984
- declare var it: {
985
- /**
986
- * An individual test unit
987
- *
988
- * @param {JestTestName} Name of Test
989
- * @param {Function} Test
990
- * @param {number} Timeout for the test, in milliseconds.
991
- */
992
- (
993
- name: JestTestName,
994
- fn?: (done: () => void) => ?Promise<mixed>,
995
- timeout?: number
996
- ): void,
997
-
998
- /**
999
- * Only run this test
1000
- *
1001
- * @param {JestTestName} Name of Test
1002
- * @param {Function} Test
1003
- * @param {number} Timeout for the test, in milliseconds.
1004
- */
1005
- only(
1006
- name: JestTestName,
1007
- fn?: (done: () => void) => ?Promise<mixed>,
1008
- timeout?: number
1009
- ): {
1010
- each(
1011
- ...table: Array<Array<mixed> | mixed> | [Array<string>, string]
1012
- ): (
1013
- name: JestTestName,
1014
- fn?: (...args: Array<any>) => ?Promise<mixed>,
1015
- timeout?: number
1016
- ) => void,
1017
- },
1018
-
1019
- /**
1020
- * Skip running this test
1021
- *
1022
- * @param {JestTestName} Name of Test
1023
- * @param {Function} Test
1024
- * @param {number} Timeout for the test, in milliseconds.
1025
- */
1026
- skip(
1027
- name: JestTestName,
1028
- fn?: (done: () => void) => ?Promise<mixed>,
1029
- timeout?: number
1030
- ): void,
1031
-
1032
- /**
1033
- * Highlight planned tests in the summary output
1034
- *
1035
- * @param {String} Name of Test to do
1036
- */
1037
- todo(name: string): void,
1038
-
1039
- /**
1040
- * Run the test concurrently
1041
- *
1042
- * @param {JestTestName} Name of Test
1043
- * @param {Function} Test
1044
- * @param {number} Timeout for the test, in milliseconds.
1045
- */
1046
- concurrent(
1047
- name: JestTestName,
1048
- fn?: (done: () => void) => ?Promise<mixed>,
1049
- timeout?: number
1050
- ): void,
1051
-
1052
- /**
1053
- * each runs this test against array of argument arrays per each run
1054
- *
1055
- * @param {table} table of Test
1056
- */
1057
- each(
1058
- ...table: Array<Array<mixed> | mixed> | [Array<string>, string]
1059
- ): (
1060
- name: JestTestName,
1061
- fn?: (...args: Array<any>) => ?Promise<mixed>,
1062
- timeout?: number
1063
- ) => void,
1064
- };
1065
-
1066
- declare function fit(
1067
- name: JestTestName,
1068
- fn: (done: () => void) => ?Promise<mixed>,
1069
- timeout?: number
1070
- ): void;
1071
- /** An individual test unit */
1072
- declare var test: typeof it;
1073
- /** A disabled group of tests */
1074
- declare var xdescribe: typeof describe;
1075
- /** A focused group of tests */
1076
- declare var fdescribe: typeof describe;
1077
- /** A disabled individual test */
1078
- declare var xit: typeof it;
1079
- /** A disabled individual test */
1080
- declare var xtest: typeof it;
1081
-
1082
- type JestPrettyFormatColors = {
1083
- comment: { close: string, open: string },
1084
- content: { close: string, open: string },
1085
- prop: { close: string, open: string },
1086
- tag: { close: string, open: string },
1087
- value: { close: string, open: string },
1088
- };
1089
-
1090
- type JestPrettyFormatIndent = string => string;
1091
- type JestPrettyFormatRefs = Array<any>;
1092
- type JestPrettyFormatPrint = any => string;
1093
- type JestPrettyFormatStringOrNull = string | null;
1094
-
1095
- type JestPrettyFormatOptions = {|
1096
- callToJSON: boolean,
1097
- edgeSpacing: string,
1098
- escapeRegex: boolean,
1099
- highlight: boolean,
1100
- indent: number,
1101
- maxDepth: number,
1102
- min: boolean,
1103
- plugins: JestPrettyFormatPlugins,
1104
- printFunctionName: boolean,
1105
- spacing: string,
1106
- theme: {|
1107
- comment: string,
1108
- content: string,
1109
- prop: string,
1110
- tag: string,
1111
- value: string,
1112
- |},
1113
- |};
1114
-
1115
- type JestPrettyFormatPlugin = {
1116
- print: (
1117
- val: any,
1118
- serialize: JestPrettyFormatPrint,
1119
- indent: JestPrettyFormatIndent,
1120
- opts: JestPrettyFormatOptions,
1121
- colors: JestPrettyFormatColors
1122
- ) => string,
1123
- test: any => boolean,
1124
- };
1125
-
1126
- type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
1127
-
1128
- /** The expect function is used every time you want to test a value */
1129
- declare var expect: {
1130
- /** The object that you want to make assertions against */
1131
- (
1132
- value: any
1133
- ): JestExpectType &
1134
- JestPromiseType &
1135
- EnzymeMatchersType &
1136
- DomTestingLibraryType &
1137
- JestJQueryMatchersType &
1138
- JestStyledComponentsMatchersType &
1139
- JestExtendedMatchersType,
1140
-
1141
- /** Add additional Jasmine matchers to Jest's roster */
1142
- extend(matchers: { [name: string]: JestMatcher }): void,
1143
- /** Add a module that formats application-specific data structures. */
1144
- addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void,
1145
- assertions(expectedAssertions: number): void,
1146
- hasAssertions(): void,
1147
- any(value: mixed): JestAsymmetricEqualityType,
1148
- anything(): any,
1149
- arrayContaining(value: Array<mixed>): Array<mixed>,
1150
- objectContaining(value: Object): Object,
1151
- /** Matches any received string that contains the exact expected string. */
1152
- stringContaining(value: string): string,
1153
- stringMatching(value: string | RegExp): string,
1154
- not: {
1155
- arrayContaining: (value: $ReadOnlyArray<mixed>) => Array<mixed>,
1156
- objectContaining: (value: {}) => Object,
1157
- stringContaining: (value: string) => string,
1158
- stringMatching: (value: string | RegExp) => string,
1159
- },
1160
- };
1161
-
1162
- // TODO handle return type
1163
- // http://jasmine.github.io/2.4/introduction.html#section-Spies
1164
- declare function spyOn(value: mixed, method: string): Object;
1165
-
1166
- /** Holds all functions related to manipulating test runner */
1167
- declare var jest: JestObjectType;
1168
-
1169
- /**
1170
- * The global Jasmine object, this is generally not exposed as the public API,
1171
- * using features inside here could break in later versions of Jest.
1172
- */
1173
- declare var jasmine: {
1174
- DEFAULT_TIMEOUT_INTERVAL: number,
1175
- any(value: mixed): JestAsymmetricEqualityType,
1176
- anything(): any,
1177
- arrayContaining(value: Array<mixed>): Array<mixed>,
1178
- clock(): JestClockType,
1179
- createSpy(name: string): JestSpyType,
1180
- createSpyObj(
1181
- baseName: string,
1182
- methodNames: Array<string>
1183
- ): { [methodName: string]: JestSpyType },
1184
- objectContaining(value: Object): Object,
1185
- stringMatching(value: string): string,
1186
- };