hein 2.0.0-alpha.1 → 2.0.0-alpha.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.
- package/dist/{assert-CsN7srt-.d.ts → assert-CJsbhtgi.d.ts} +44 -3
- package/dist/assert-CJsbhtgi.d.ts.map +1 -0
- package/dist/{assert-ChQPKP5C.d.cts → assert-itrfuDRd.d.cts} +43 -5
- package/dist/assert-itrfuDRd.d.cts.map +1 -0
- package/dist/assert.d.cts +1 -2
- package/dist/assert.d.ts +1 -2
- package/dist/expect.types.d.cts +457 -3
- package/dist/expect.types.d.cts.map +1 -0
- package/dist/expect.types.d.ts +459 -3
- package/dist/expect.types.d.ts.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +458 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +458 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assert-ChQPKP5C.d.cts.map +0 -1
- package/dist/assert-CsN7srt-.d.ts.map +0 -1
- package/dist/expect.types-CHYPdbCW.d.cts +0 -454
- package/dist/expect.types-CHYPdbCW.d.cts.map +0 -1
- package/dist/expect.types-nBq4Rg8e.d.ts +0 -454
- package/dist/expect.types-nBq4Rg8e.d.ts.map +0 -1
- package/dist/throws-BlzO4xvg.d.ts +0 -45
- package/dist/throws-BlzO4xvg.d.ts.map +0 -1
- package/dist/throws-CYLYG7gu.d.cts +0 -43
- package/dist/throws-CYLYG7gu.d.cts.map +0 -1
package/dist/expect.types.d.ts
CHANGED
|
@@ -1,3 +1,459 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import "hein-assertion-utils";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/process-error.d.ts
|
|
4
|
+
interface Constructor<T = any> {
|
|
5
|
+
new (...args: any[]): T;
|
|
6
|
+
}
|
|
7
|
+
type ErrorPredicate = (error: Error) => boolean;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/assert/throws.d.ts
|
|
10
|
+
type ThrowsCallback = () => unknown;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/utils/fail.d.ts
|
|
13
|
+
/**
|
|
14
|
+
* Throw an AssertionError
|
|
15
|
+
* @param {string} message - The message to pass to the AssertionError
|
|
16
|
+
*/
|
|
17
|
+
declare const fail: (message?: string) => never;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/utils/types.d.ts
|
|
20
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] | (T[P] extends Array<infer U> ? Array<DeepPartial<U>> : DeepPartial<T[P]>) };
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/utils/get-type.d.ts
|
|
23
|
+
type ValueType = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function' | 'null' | 'NaN' | 'array';
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/mixins.d.ts
|
|
26
|
+
interface State<T> {
|
|
27
|
+
inverted?: boolean;
|
|
28
|
+
value?: T;
|
|
29
|
+
getProperty?: (value: T) => any;
|
|
30
|
+
deep?: boolean;
|
|
31
|
+
same?: boolean;
|
|
32
|
+
ordered?: boolean;
|
|
33
|
+
partial?: boolean;
|
|
34
|
+
every?: boolean;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/expect.types.d.ts
|
|
38
|
+
interface ValueExpect<T> {
|
|
39
|
+
to: this;
|
|
40
|
+
be: this;
|
|
41
|
+
a: this;
|
|
42
|
+
an: this;
|
|
43
|
+
not: this;
|
|
44
|
+
and: this;
|
|
45
|
+
have: this;
|
|
46
|
+
in: this;
|
|
47
|
+
of: this;
|
|
48
|
+
/**
|
|
49
|
+
* Use deep equality for object checks
|
|
50
|
+
*/
|
|
51
|
+
deep: this;
|
|
52
|
+
/**
|
|
53
|
+
* check for deep equality
|
|
54
|
+
*/
|
|
55
|
+
eql(value: T, message?: string): this;
|
|
56
|
+
partially: ValueExpect<DeepPartial<T>>;
|
|
57
|
+
/**
|
|
58
|
+
* check for === equality, NaN is considered equal to NaN
|
|
59
|
+
*/
|
|
60
|
+
equal(value: T, message?: string): this;
|
|
61
|
+
/**
|
|
62
|
+
* check for === equality, NaN is considered equal to NaN
|
|
63
|
+
*/
|
|
64
|
+
eq(value: T, message?: string): this;
|
|
65
|
+
/**
|
|
66
|
+
* check if value has a property
|
|
67
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
68
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
69
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
70
|
+
*/
|
|
71
|
+
property<K extends keyof T>(property: K): this;
|
|
72
|
+
/**
|
|
73
|
+
* check if value has a property
|
|
74
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
75
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
76
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
77
|
+
*/
|
|
78
|
+
property(property: string): this;
|
|
79
|
+
/**
|
|
80
|
+
* check if value has a property
|
|
81
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
82
|
+
* @param value
|
|
83
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
84
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
85
|
+
*/
|
|
86
|
+
property<K extends keyof T>(property: K, value?: any): this;
|
|
87
|
+
/**
|
|
88
|
+
* check if value has a property
|
|
89
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
90
|
+
* @param value
|
|
91
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
92
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
93
|
+
*/
|
|
94
|
+
property(property: string, value?: any): this;
|
|
95
|
+
/**
|
|
96
|
+
* check if instance of value
|
|
97
|
+
* @param constructor - The constructor function to check against
|
|
98
|
+
*/
|
|
99
|
+
instanceOf(constructor: Constructor): this;
|
|
100
|
+
/**
|
|
101
|
+
* check if value is null
|
|
102
|
+
*/
|
|
103
|
+
null(): this;
|
|
104
|
+
/**
|
|
105
|
+
* check if value is undefined
|
|
106
|
+
*/
|
|
107
|
+
undefined(): this;
|
|
108
|
+
/**
|
|
109
|
+
* check if value is of certain type
|
|
110
|
+
*/
|
|
111
|
+
type(type: ValueType): this;
|
|
112
|
+
}
|
|
113
|
+
type ArrayType<T, DT = never> = T extends (infer U)[] ? U : DT;
|
|
114
|
+
interface ArrayExpect<T> extends ValueExpect<T>, ObjectExpect<T> {
|
|
115
|
+
length: NumberExpect<number> & this;
|
|
116
|
+
array(): this;
|
|
117
|
+
every: GetExpectType<ArrayType<T>>;
|
|
118
|
+
/**
|
|
119
|
+
* check if array includes element(s)
|
|
120
|
+
*/
|
|
121
|
+
include(...elements: ArrayType<T>[]): this;
|
|
122
|
+
/**
|
|
123
|
+
* check if array includes element(s)
|
|
124
|
+
*/
|
|
125
|
+
contain(...elements: ArrayType<T>[]): this;
|
|
126
|
+
/**
|
|
127
|
+
* check for array length
|
|
128
|
+
*/
|
|
129
|
+
lengthOf(length: number, message?: string): this;
|
|
130
|
+
/**
|
|
131
|
+
* check that the members in second array are present in the first one
|
|
132
|
+
*/
|
|
133
|
+
members(value: ArrayType<T, any>[], message?: string): this;
|
|
134
|
+
same: ArrayExpect<T>;
|
|
135
|
+
ordered: ArrayExpect<T>;
|
|
136
|
+
/**
|
|
137
|
+
* Use partial matching for objects
|
|
138
|
+
* @example
|
|
139
|
+
* expect({ a: 1, b: 2 }).to.partially.eql({ a: 1 });
|
|
140
|
+
*/
|
|
141
|
+
partially: ArrayExpect<DeepPartial<T>>;
|
|
142
|
+
/**
|
|
143
|
+
* check if value is an array
|
|
144
|
+
*/
|
|
145
|
+
array(): this;
|
|
146
|
+
}
|
|
147
|
+
interface BigIntExpect<T = bigint> extends NumberExpect<T> {
|
|
148
|
+
/**
|
|
149
|
+
* check if value is a bigint
|
|
150
|
+
*/
|
|
151
|
+
bigint(): this;
|
|
152
|
+
}
|
|
153
|
+
interface BooleanExpect<T = boolean> extends ValueExpect<T> {
|
|
154
|
+
/**
|
|
155
|
+
* check if value is a boolean
|
|
156
|
+
*/
|
|
157
|
+
boolean(): this;
|
|
158
|
+
/**
|
|
159
|
+
* check if value is true
|
|
160
|
+
*/
|
|
161
|
+
true(): this;
|
|
162
|
+
/**
|
|
163
|
+
* check if value is false
|
|
164
|
+
*/
|
|
165
|
+
false(): this;
|
|
166
|
+
}
|
|
167
|
+
interface DateExpect<T = Date> extends ValueExpect<T>, ObjectExpect<T> {
|
|
168
|
+
/**
|
|
169
|
+
* check if date is after other date
|
|
170
|
+
* @param date
|
|
171
|
+
*/
|
|
172
|
+
after(date: Date): this;
|
|
173
|
+
/**
|
|
174
|
+
* check if date is before other date
|
|
175
|
+
* @param date
|
|
176
|
+
*/
|
|
177
|
+
before(date: Date): this;
|
|
178
|
+
/**
|
|
179
|
+
* check if date is between other dates
|
|
180
|
+
* @param start
|
|
181
|
+
* @param end
|
|
182
|
+
*/
|
|
183
|
+
between(start: Date, end: Date, inclusive?: boolean): this;
|
|
184
|
+
/**
|
|
185
|
+
* check if actual is greater than or equal to expected
|
|
186
|
+
*/
|
|
187
|
+
greaterThanOrEqual(value: T): this;
|
|
188
|
+
/**
|
|
189
|
+
* check if actual is greater than or equal to expected
|
|
190
|
+
*/
|
|
191
|
+
gte(value: T): this;
|
|
192
|
+
/**
|
|
193
|
+
* check if actual is greater than or equal to expected
|
|
194
|
+
*/
|
|
195
|
+
atLeast(value: T): this;
|
|
196
|
+
/**
|
|
197
|
+
* check if actual is greater than expected
|
|
198
|
+
*/
|
|
199
|
+
greaterThan(value: T): this;
|
|
200
|
+
/**
|
|
201
|
+
* check if actual is greater than expected
|
|
202
|
+
*/
|
|
203
|
+
gt(value: T): this;
|
|
204
|
+
/**
|
|
205
|
+
* check if actual is greater than expected
|
|
206
|
+
*/
|
|
207
|
+
above(value: T): this;
|
|
208
|
+
/**
|
|
209
|
+
* check if value is an instance of Date
|
|
210
|
+
*/
|
|
211
|
+
Date(): this;
|
|
212
|
+
/**
|
|
213
|
+
* check if actual is less than or equal to expected
|
|
214
|
+
*/
|
|
215
|
+
lessThanOrEqual(value: T): this;
|
|
216
|
+
/**
|
|
217
|
+
* check if actual is less than or equal to expected
|
|
218
|
+
*/
|
|
219
|
+
lte(value: T): this;
|
|
220
|
+
/**
|
|
221
|
+
* check if actual is less than or equal to expected
|
|
222
|
+
*/
|
|
223
|
+
atMost(value: T): this;
|
|
224
|
+
/**
|
|
225
|
+
* check if actual is less than expected
|
|
226
|
+
*/
|
|
227
|
+
lessThan(value: T): this;
|
|
228
|
+
/**
|
|
229
|
+
* check if actual is less than expected
|
|
230
|
+
*/
|
|
231
|
+
lt(value: T): this;
|
|
232
|
+
/**
|
|
233
|
+
* check if actual is less than expected
|
|
234
|
+
*/
|
|
235
|
+
below(value: T): this;
|
|
236
|
+
}
|
|
237
|
+
interface FunctionExpect<T> extends ValueExpect<T> {
|
|
238
|
+
/**
|
|
239
|
+
* check if function throws
|
|
240
|
+
* @param message
|
|
241
|
+
*/
|
|
242
|
+
throw(message?: string): this;
|
|
243
|
+
throw(matcher: RegExp | Constructor<Error> | ErrorPredicate, message?: string): this;
|
|
244
|
+
/**
|
|
245
|
+
* check if value is a function
|
|
246
|
+
*/
|
|
247
|
+
function(): this;
|
|
248
|
+
}
|
|
249
|
+
interface NumberExpect<T = number> extends ValueExpect<T> {
|
|
250
|
+
/**
|
|
251
|
+
* check if number close enough (default 10%)
|
|
252
|
+
* @param ballpark
|
|
253
|
+
* @param [multiplier=10] - a number between 0 and 1 (exclusive). 0.1 (default) means 10% difference is allowed.
|
|
254
|
+
*/
|
|
255
|
+
ballpark(ballpark: number, multiplier?: number): this;
|
|
256
|
+
/**
|
|
257
|
+
* check if number is between other numbers
|
|
258
|
+
* @param start
|
|
259
|
+
* @param end
|
|
260
|
+
* @param inclusive
|
|
261
|
+
*/
|
|
262
|
+
between(start: number, end: number, inclusive?: boolean): this;
|
|
263
|
+
/**
|
|
264
|
+
* check if actual is greater than or equal to expected
|
|
265
|
+
*/
|
|
266
|
+
greaterThanOrEqual(value: T): this;
|
|
267
|
+
/**
|
|
268
|
+
* check if actual is greater than or equal to expected
|
|
269
|
+
*/
|
|
270
|
+
gte(value: T): this;
|
|
271
|
+
/**
|
|
272
|
+
* check if actual is greater than or equal to expected
|
|
273
|
+
*/
|
|
274
|
+
atLeast(value: T): this;
|
|
275
|
+
/**
|
|
276
|
+
* check if actual is greater than expected
|
|
277
|
+
*/
|
|
278
|
+
greaterThan(value: T): this;
|
|
279
|
+
/**
|
|
280
|
+
* check if actual is greater than expected
|
|
281
|
+
*/
|
|
282
|
+
gt(value: T): this;
|
|
283
|
+
/**
|
|
284
|
+
* check if actual is greater than expected
|
|
285
|
+
*/
|
|
286
|
+
above(value: T): this;
|
|
287
|
+
/**
|
|
288
|
+
* check if actual is less than or equal to expected
|
|
289
|
+
*/
|
|
290
|
+
lessThanOrEqual(value: T): this;
|
|
291
|
+
/**
|
|
292
|
+
* check if actual is less than or equal to expected
|
|
293
|
+
*/
|
|
294
|
+
lte(value: T): this;
|
|
295
|
+
/**
|
|
296
|
+
* check if actual is less than or equal to expected
|
|
297
|
+
*/
|
|
298
|
+
atMost(value: T): this;
|
|
299
|
+
/**
|
|
300
|
+
* check if actual is less than expected
|
|
301
|
+
*/
|
|
302
|
+
lessThan(value: T): this;
|
|
303
|
+
/**
|
|
304
|
+
* check if actual is less than expected
|
|
305
|
+
*/
|
|
306
|
+
lt(value: T): this;
|
|
307
|
+
/**
|
|
308
|
+
* check if actual is less than expected
|
|
309
|
+
*/
|
|
310
|
+
below(value: T): this;
|
|
311
|
+
/**
|
|
312
|
+
* check if number close enough (default 10%)
|
|
313
|
+
* @param target
|
|
314
|
+
* @param decimal defaults to 0, can be negative if trying to round down to nearest 10, 100, etc
|
|
315
|
+
*/
|
|
316
|
+
roundTo(target: number, decimal?: number): this;
|
|
317
|
+
/**
|
|
318
|
+
* check if value is a number
|
|
319
|
+
*/
|
|
320
|
+
number(): this;
|
|
321
|
+
/**
|
|
322
|
+
* check if value is a NaN
|
|
323
|
+
*/
|
|
324
|
+
NaN(): this;
|
|
325
|
+
}
|
|
326
|
+
type InferMapKeys<T> = T extends Map<infer K, any> ? K : never;
|
|
327
|
+
interface MapExpect<T> extends ValueExpect<T> {
|
|
328
|
+
size: NumberExpect<number>;
|
|
329
|
+
/**
|
|
330
|
+
* check if Map is empty
|
|
331
|
+
*/
|
|
332
|
+
empty(message?: string): this;
|
|
333
|
+
/**
|
|
334
|
+
* check if value is an instance of Map
|
|
335
|
+
*/
|
|
336
|
+
Map(): this;
|
|
337
|
+
/**
|
|
338
|
+
* Check if value has keys
|
|
339
|
+
*/
|
|
340
|
+
keys<K extends InferMapKeys<T>>(keys: K[] | K): this;
|
|
341
|
+
/**
|
|
342
|
+
* check for Map to have a certain size
|
|
343
|
+
*/
|
|
344
|
+
sizeOf(size: number, message?: string): this;
|
|
345
|
+
}
|
|
346
|
+
interface ObjectExpect<T> extends ValueExpect<T> {
|
|
347
|
+
size: NumberExpect<number>;
|
|
348
|
+
/**
|
|
349
|
+
* check if object/array/Map/Set is empty
|
|
350
|
+
*/
|
|
351
|
+
empty(message?: string): this;
|
|
352
|
+
/**
|
|
353
|
+
* exclude keys from object to be compared further down the chain
|
|
354
|
+
* @param keys
|
|
355
|
+
*/
|
|
356
|
+
excluding<K extends keyof T>(...keys: K[]): ObjectExpect<Omit<T, K>>;
|
|
357
|
+
/**
|
|
358
|
+
* check if value is an instance of Map
|
|
359
|
+
*/
|
|
360
|
+
Map(): this;
|
|
361
|
+
/**
|
|
362
|
+
* check if value is an instance of Set
|
|
363
|
+
*/
|
|
364
|
+
Set(): this;
|
|
365
|
+
/**
|
|
366
|
+
* check if value is an instance of WeakMap
|
|
367
|
+
*/
|
|
368
|
+
WeakMap(): this;
|
|
369
|
+
/**
|
|
370
|
+
* check if value is an instance of WeakSet
|
|
371
|
+
*/
|
|
372
|
+
WeakSet(): this;
|
|
373
|
+
/**
|
|
374
|
+
* Check if value has keys
|
|
375
|
+
*/
|
|
376
|
+
keys<K extends keyof T>(keys: K[] | K): this;
|
|
377
|
+
/**
|
|
378
|
+
* check for object/array/Map/Set/string to have a certain size
|
|
379
|
+
*/
|
|
380
|
+
sizeOf(size: number, message?: string): this;
|
|
381
|
+
/**
|
|
382
|
+
* check if value is a plain object
|
|
383
|
+
*/
|
|
384
|
+
object(): this;
|
|
385
|
+
}
|
|
386
|
+
interface PromiseExpect<T> extends ValueExpect<T> {
|
|
387
|
+
/**
|
|
388
|
+
* check if promise rejects
|
|
389
|
+
* @param message
|
|
390
|
+
*/
|
|
391
|
+
reject(message?: string): Promise<void>;
|
|
392
|
+
reject(matcher: RegExp | Constructor<Error> | ErrorPredicate): Promise<void>;
|
|
393
|
+
}
|
|
394
|
+
interface StringExpect<T = string> extends ValueExpect<T> {
|
|
395
|
+
/**
|
|
396
|
+
* check if string ends with other string
|
|
397
|
+
* @param start
|
|
398
|
+
* @example endsWith('foo', 'o');
|
|
399
|
+
*/
|
|
400
|
+
endWith(end: string): this;
|
|
401
|
+
/**
|
|
402
|
+
* check if string includes substring(s)
|
|
403
|
+
*/
|
|
404
|
+
include(...substrings: string[]): this;
|
|
405
|
+
/**
|
|
406
|
+
* check if string includes substring(s)
|
|
407
|
+
*/
|
|
408
|
+
contain(...substrings: string[]): this;
|
|
409
|
+
/**
|
|
410
|
+
* check for string to have a certain size
|
|
411
|
+
*/
|
|
412
|
+
lengthOf(length: number, message?: string): this;
|
|
413
|
+
/**
|
|
414
|
+
* check if string matches regex
|
|
415
|
+
*/
|
|
416
|
+
match(regex: RegExp): this;
|
|
417
|
+
/**
|
|
418
|
+
* check if string starts with other string
|
|
419
|
+
* @param start
|
|
420
|
+
* @example startsWith('foo', 'f');
|
|
421
|
+
*/
|
|
422
|
+
startWith(start: string): this;
|
|
423
|
+
/**
|
|
424
|
+
* check if value is a string
|
|
425
|
+
*/
|
|
426
|
+
string(): this;
|
|
427
|
+
}
|
|
428
|
+
interface SymbolExpect<T> extends ValueExpect<T> {
|
|
429
|
+
/**
|
|
430
|
+
* check if value is a symbol
|
|
431
|
+
*/
|
|
432
|
+
symbol(): this;
|
|
433
|
+
}
|
|
434
|
+
declare const LooseSymbol: unique symbol;
|
|
435
|
+
interface Loose {
|
|
436
|
+
[LooseSymbol]: true;
|
|
437
|
+
}
|
|
438
|
+
type AllExpects<T> = ArrayExpect<T> & BigIntExpect<T> & BooleanExpect<T> & DateExpect<T> & FunctionExpect<T> & NumberExpect<T> & MapExpect<T> & ObjectExpect<T> & PromiseExpect<T> & StringExpect<T> & SymbolExpect<T> & ValueExpect<T>;
|
|
439
|
+
interface Expect {
|
|
440
|
+
<T extends Loose>(actual: T): AllExpects<T>;
|
|
441
|
+
<T extends ThrowsCallback>(actual: T): FunctionExpect<T>;
|
|
442
|
+
<T extends Promise<any>>(actual: T): PromiseExpect<T>;
|
|
443
|
+
<T extends any[]>(actual: T): ArrayExpect<T>;
|
|
444
|
+
<T extends Date>(actual: T): DateExpect<T>;
|
|
445
|
+
<T extends Map<any, any>>(actual: T): MapExpect<T>;
|
|
446
|
+
<T extends Record<string, any>>(actual: T): ObjectExpect<T>;
|
|
447
|
+
<T extends number>(actual: T): NumberExpect;
|
|
448
|
+
<T extends bigint>(actual: T): BigIntExpect;
|
|
449
|
+
<T extends boolean>(actual: T): BooleanExpect;
|
|
450
|
+
<T extends string>(actual: T): StringExpect;
|
|
451
|
+
<T extends symbol>(actual: T): SymbolExpect<T>;
|
|
452
|
+
<T>(actual: T): ValueExpect<T>;
|
|
453
|
+
fail: typeof fail;
|
|
454
|
+
}
|
|
455
|
+
type GetExpectType<T> = T extends number ? NumberExpect<T> : AllExpects<T>;
|
|
456
|
+
//# sourceMappingURL=expect.types.d.ts.map
|
|
457
|
+
//#endregion
|
|
458
|
+
export { ArrayExpect, BigIntExpect, BooleanExpect, DateExpect, Expect, FunctionExpect, Loose, MapExpect, NumberExpect, ObjectExpect, PromiseExpect, type State, StringExpect, SymbolExpect, ValueExpect };
|
|
459
|
+
//# sourceMappingURL=expect.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.types.d.ts","names":[],"sources":["../src/utils/process-error.ts","../src/assert/throws.ts","../src/utils/fail.ts","../src/utils/types.ts","../src/utils/get-type.ts","../src/mixins.ts","../src/expect.types.ts"],"sourcesContent":[],"mappings":";;;UAEiB;wBACS;AAD1B;AAIY,KAAA,cAAA,GAAc,CAAA,KAAW,EAAA,KAAK,EAAA,GAAA,OAAA;;;KCF9B,cAAA;;;;;;ADFZ;AAIY,cEAC,IFAa,EAAA,CAAA,OAAgB,CAAL,EAAK,MAAA,EAAA,GAAA,KAAA;;;KGN9B,+BACI,KAAK,EAAE,MAAM,EAAE,WAAW,iBAAiB,MAAM,YAAY,MAAM,YAAY,EAAE;;;KCDrF,SAAA;;;UCAK;;UAEL;ELAK,WAAA,CAAA,EAAW,CAAA,KAAA,EKCF,CLDE,EACF,GAAC,GAAA;EAGf,IAAA,CAAA,EAAA,OAAA;;;;ECFA,KAAA,CAAA,EAAA,OAAA;;;;UKGK;;ELHL,EAAA,EAAA,IAAA;;;;ECEC,GAAA,EAAA,IAEZ;;;;ECRW;;;MACS,EAAA,IAAA;;;;KAAqB,CAAA,KAAA,EGuB3B,CHvB2B,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;WAAmC,EGwB9D,WHxB8D,CGwBlD,WHxBkD,CGwBtC,CHxBsC,CAAA,CAAA;;;;OAAoB,CAAA,KAAA,EG4BhF,CH5BgF,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;YGgCnF;;AFjCd;;;;ACAA;EAAsB,QAA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aAAa,KACb,aAAa,KACb,YAAY;UAEC,MAAA;aACF,eAAe,IAAI,WAAW;aAC9B,wBAAwB,IAAI,eAAe;aAC3C,sBAAsB,IAAI,cAAc;4BACzB,IAAI,YAAY;aAC/B,cAAc,IAAI,WAAW;aAC7B,uBAAuB,IAAI,UAAU;aACrC,6BAA6B,IAAI,aAAa;6BAC9B,IAAI;6BACJ,IAAI;8BACH,IAAI;6BACL,IAAI;6BACJ,IAAI,aAAa;cAChC,IAAI,YAAY;eACf;;KAGZ,mBAAmB,mBAAmB,aAAa,KAAK,WAAW"}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["mixins: Record<string, Property | Method | Alias>","deepNotHasProperty","deepHasProperty","notHasProperty","hasProperty","notRejects","rejects","notThrows","throws","AssertionError"],"sources":["../src/mixins.ts","../src/utils/chain.ts","../src/utils/get-size.ts","../src/expect/after.ts","../src/expect/ballpark.ts","../src/expect/before.ts","../src/expect/between.ts","../src/expect/empty.ts","../src/expect/end-with.ts","../src/expect/eql.ts","../src/expect/equal-shorthand.ts","../src/expect/equal.ts","../src/expect/excluding.ts","../src/expect/greater-than-equal.ts","../src/expect/greater-than.ts","../src/expect/has-property.ts","../src/expect/include.ts","../src/expect/instance-of-shorthand.ts","../src/expect/instance-of.ts","../src/expect/keys.ts","../src/expect/length.ts","../src/expect/less-than-equal.ts","../src/expect/less-than.ts","../src/expect/match.ts","../src/expect/members.ts","../src/expect/reject.ts","../src/expect/round-to.ts","../src/expect/start-with.ts","../src/expect/throw.ts","../src/expect/type-shorthand.ts","../src/expect/type.ts","../src/utils/fail.ts","../src/expect.ts"],"sourcesContent":["export interface State<T> {\n inverted?: boolean;\n value?: T;\n getProperty?: (value: T) => any;\n deep?: boolean;\n same?: boolean;\n ordered?: boolean;\n partial?: boolean;\n\n every?: boolean;\n}\n\nexport interface Property {\n type: 'property';\n value: (state: State<any>) => Partial<State<any>> | null;\n}\n\ntype MethodCallback = (state: State<any>) => (...args: any[]) => void;\n\nexport interface Method {\n type: 'method';\n value: MethodCallback;\n}\n\nexport interface Alias {\n type: 'alias';\n value: string;\n}\n\nexport const mixins: Record<string, Property | Method | Alias> = {};\n\nexport const use = (plugins: Record<string, Property | Method | Alias>) => {\n Object.assign(mixins, plugins);\n};\n","export const registerProperty = <T, U extends string, V extends () => any>(object: T, name: U, value: V) => {\n Object.defineProperty(object, name, {\n enumerable: true,\n get() {\n return value();\n }\n });\n return object as T & Record<U, V>;\n};\n\nexport const registerMethod = <T, U extends string, V>(object: T, name: U, value: V) => {\n Object.defineProperty(object, name, {\n value\n });\n return object as T & Record<U, V>;\n};\n","import isPlainObject from 'lodash/isPlainObject.js';\n\nexport const getSize = (value: any) => {\n if (Array.isArray(value)) {\n return value.length;\n }\n if (isPlainObject(value)) {\n return Object.keys(value).length;\n }\n if (value instanceof Map) {\n return value.size;\n }\n if (value instanceof Set) {\n return value.size;\n }\n if (typeof value === 'string') {\n return value.length;\n }\n return 0;\n};\n","import { isAfter, notAfter } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n after: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (date: Date) => {\n if (inverted) {\n notAfter(value, date);\n } else {\n isAfter(value, date);\n }\n }\n }\n});\n","import { inBallpark, notInBallpark } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n ballpark: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (ballpark, multiplier = 0.1) => {\n if (inverted) {\n notInBallpark(value, ballpark, multiplier);\n } else {\n inBallpark(value, ballpark, multiplier);\n }\n }\n }\n});\n","import { isBefore, notBefore } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n before: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (date: Date) => {\n if (inverted) {\n notBefore(value, date);\n } else {\n isBefore(value, date);\n }\n }\n }\n});\n","import { isBetween, notBetween } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n between: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (start: Date, end: Date, inclusive = true) => {\n if (inverted) {\n notBetween(value, start, end, { inclusive });\n } else {\n isBetween(value, start, end, { inclusive });\n }\n }\n }\n});\n","import { isEmpty, notIsEmpty } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n empty: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (message?: string) => {\n if (inverted) {\n notIsEmpty(value, message);\n } else {\n isEmpty(value, message);\n }\n }\n }\n});\n","import { endsWith, notEndsWith } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n endWith: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (end: string) => {\n if (inverted) {\n notEndsWith(value, end);\n } else {\n endsWith(value, end);\n }\n }\n }\n});\n","import { deepEqual, notDeepEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n partially: {\n type: 'property',\n value: () => ({ partial: true })\n },\n eql: {\n type: 'method',\n value:\n ({ value, inverted, partial }) =>\n (other: any, message) => {\n if (inverted) {\n notDeepEqual(value, other, partial, message);\n } else {\n deepEqual(value, other, partial, message);\n }\n }\n }\n});\n","import { equal, notEqual } from '../assert.js';\nimport { type State, use } from '../mixins.js';\nimport { format } from 'hein-assertion-utils';\n\ndeclare module '../expect.types' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface BooleanExpect<T> {\n /**\n * check if value is true\n */\n true(): this;\n /**\n * check if value is false\n */\n false(): this;\n }\n}\n\nconst values = {\n false: false,\n true: true\n};\n\nuse(\n Object.fromEntries(\n Object.entries(values).map(([key, expectValue]) => {\n return [\n key,\n {\n type: 'method',\n value:\n ({ inverted, value }: State<any>) =>\n () => {\n if (inverted) {\n const message = format(\n 'Expected {{= it.value }} to not be {{= it.key }}',\n {\n key,\n value\n },\n true\n );\n notEqual(value, expectValue, message);\n } else {\n const message = format(\n 'Expected {{= it.value }} to be {{= it.key }}',\n {\n key,\n value\n },\n true\n );\n equal(value, expectValue, message);\n }\n }\n }\n ];\n })\n )\n);\n","import { deepEqual, equal, notDeepEqual, notEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n equal: {\n type: 'method',\n value:\n ({ value, inverted, deep }) =>\n (other: any, message?: string) => {\n if (deep) {\n if (inverted) {\n notDeepEqual(value, other, message);\n } else {\n deepEqual(value, other, message);\n }\n return;\n }\n if (inverted) {\n notEqual(value, other, message);\n } else {\n equal(value, other, message);\n }\n }\n },\n eq: { type: 'alias', value: 'equal' }\n});\n","import omit from 'lodash/omit.js';\nimport { use } from '../mixins.js';\nimport { expectChain } from '../expect.js';\n\nuse({\n excluding: {\n type: 'method',\n value:\n (state) =>\n (...keys: string[]) => {\n return expectChain({ ...state, value: omit(state.value, keys) });\n }\n }\n});\n","import { greaterThanEqual, notGreaterThanEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n greaterThanOrEqual: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notGreaterThanEqual(value, other);\n } else {\n greaterThanEqual(value, other);\n }\n }\n },\n gte: { type: 'alias', value: 'greaterThanOrEqual' },\n atLeast: { type: 'alias', value: 'greaterThanOrEqual' }\n});\n","import { greaterThan, notGreaterThan } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n greaterThan: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notGreaterThan(value, other);\n } else {\n greaterThan(value, other);\n }\n }\n },\n gt: { type: 'alias', value: 'greaterThan' },\n above: { type: 'alias', value: 'greaterThan' }\n});\n","import { deepHasProperty, deepNotHasProperty, hasProperty, notHasProperty } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n property: {\n type: 'method',\n value:\n ({ value, inverted, deep }) =>\n (...args: [any, any]) => {\n if (deep) {\n if (inverted) {\n return deepNotHasProperty(value, ...args);\n }\n return deepHasProperty(value, ...args);\n }\n if (inverted) {\n return notHasProperty(value, ...args);\n }\n return hasProperty(value, ...args);\n }\n }\n});\n","import { includes, notIncludes } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n include: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (...elements: any[]) => {\n if (inverted) {\n notIncludes(value, ...elements);\n } else {\n includes(value, ...elements);\n }\n }\n },\n contain: {\n type: 'alias',\n value: 'include'\n }\n});\n","import { instanceOf, notInstanceOf } from '../assert.js';\nimport { use } from '../mixins.js';\n\nconst constructors = [Date, Map, Set, WeakMap, WeakSet];\n\nuse(\n Object.fromEntries(\n constructors.map((constructor) => {\n return [\n constructor.name,\n {\n type: 'method',\n value:\n ({ inverted, value }) =>\n () => {\n if (inverted) {\n notInstanceOf(value, constructor);\n } else {\n instanceOf(value, constructor);\n }\n }\n }\n ];\n })\n )\n);\n","import { notInstanceOf, instanceOf } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type Constructor } from '../utils/process-error.js';\n\nuse({\n instanceOf: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (constructor: Constructor) => {\n if (inverted) {\n notInstanceOf(value, constructor);\n } else {\n instanceOf(value, constructor);\n }\n }\n }\n});\n","import { hasKeys, notHasKeys } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n keys: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (keys) => {\n if (inverted) {\n notHasKeys(value, keys);\n } else {\n hasKeys(value, keys);\n }\n }\n }\n});\n","import { hasSize, notHasSize } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n sizeOf: { type: 'alias', value: 'lengthOf' },\n lengthOf: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (length: number, message?: string) => {\n if (inverted) {\n notHasSize(value, length, message);\n } else {\n hasSize(value, length, message);\n }\n }\n }\n});\n","import { lessThanEqual, notLessThanEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n lessThanOrEqual: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notLessThanEqual(value, other);\n } else {\n lessThanEqual(value, other);\n }\n }\n },\n lte: { type: 'alias', value: 'lessThanOrEqual' },\n atMost: { type: 'alias', value: 'lessThanOrEqual' }\n});\n","import { lessThan, notLessThan } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n lessThan: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notLessThan(value, other);\n } else {\n lessThan(value, other);\n }\n }\n },\n lt: { type: 'alias', value: 'lessThan' },\n below: { type: 'alias', value: 'lessThan' }\n});\n","import { match, notMatch } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n match: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (regex: RegExp) => {\n if (inverted) {\n notMatch(value, regex);\n } else {\n match(value, regex);\n }\n }\n }\n});\n","import { hasMembers, notHasMembers } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n members: {\n type: 'method',\n value:\n ({ value, inverted, same, deep, ordered, partial }) =>\n (other: any, message?: string) => {\n if (inverted) {\n notHasMembers(value, other, { deep, same, ordered, partial }, message);\n } else {\n hasMembers(value, other, { deep, same, ordered, partial }, message);\n }\n }\n },\n same: {\n type: 'property',\n value: (state) => {\n state.same = true;\n return state;\n }\n },\n ordered: {\n type: 'property',\n value: (state) => {\n state.ordered = true;\n return state;\n }\n }\n});\n","import { notRejects, rejects } from '../assert.js';\nimport { type State, use } from '../mixins.js';\n\nuse({\n reject: {\n type: 'method',\n value:\n ({ value, inverted }: State<any>) =>\n (...args: any[]) => {\n return inverted ? notRejects(value, ...args) : rejects(value, ...args);\n }\n }\n});\n","import { notRoundTo, roundTo } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n roundTo: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (target, decimal = 0) => {\n if (inverted) {\n notRoundTo(value, target, decimal);\n } else {\n roundTo(value, target, decimal);\n }\n }\n }\n});\n","import { startsWith, notStartsWith } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n startWith: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (start: string) => {\n if (inverted) {\n notStartsWith(value, start);\n } else {\n startsWith(value, start);\n }\n }\n }\n});\n","import { notThrows, throws } from '../assert.js';\nimport { type State, use } from '../mixins.js';\n\nuse({\n throw: {\n type: 'method',\n value:\n ({ value, inverted }: State<any>) =>\n (...args: any[]) => {\n return inverted ? notThrows(value, ...args) : throws(value, ...args);\n }\n }\n});\n","import { isType, notIsType } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type ValueType } from '../utils/get-type.js';\n\nconst types: ValueType[] = [\n 'NaN',\n 'array',\n 'bigint',\n 'boolean',\n 'function',\n 'null',\n 'number',\n 'object',\n 'string',\n 'symbol',\n 'undefined'\n];\n\nuse(\n Object.fromEntries(\n types.map((type) => {\n return [\n type,\n {\n type: 'method',\n value:\n ({ value, inverted }) =>\n () => {\n if (inverted) {\n notIsType(value, type);\n } else {\n isType(value, type);\n }\n }\n }\n ];\n })\n )\n);\n","import { notIsType, isType } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type ValueType } from '../utils/get-type.js';\n\nuse({\n type: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (type: ValueType) => {\n if (inverted) {\n notIsType(value, type);\n } else {\n isType(value, type);\n }\n }\n }\n});\n","import { AssertionError } from 'hein-assertion-utils';\n\n/**\n * Throw an AssertionError\n * @param {string} message - The message to pass to the AssertionError\n */\nexport const fail = (message: string = 'Fail') => {\n throw new AssertionError(undefined, undefined, message);\n};\n","import { mixins, State, use } from './mixins.js';\nimport { registerMethod, registerProperty } from './utils/chain.js';\nimport { getSize } from './utils/get-size.js';\nimport { Expect } from './expect.types.js';\nimport './expect/after.js';\nimport './expect/ballpark.js';\nimport './expect/before.js';\nimport './expect/between.js';\nimport './expect/empty.js';\nimport './expect/end-with.js';\nimport './expect/eql.js';\nimport './expect/equal-shorthand.js';\nimport './expect/equal.js';\nimport './expect/excluding.js';\nimport './expect/greater-than-equal.js';\nimport './expect/greater-than.js';\nimport './expect/has-property.js';\nimport './expect/include.js';\nimport './expect/instance-of-shorthand.js';\nimport './expect/instance-of.js';\nimport './expect/keys.js';\nimport './expect/length.js';\nimport './expect/less-than-equal.js';\nimport './expect/less-than.js';\nimport './expect/match.js';\nimport './expect/members.js';\nimport './expect/reject.js';\nimport './expect/round-to.js';\nimport './expect/start-with.js';\nimport './expect/throw.js';\nimport './expect/type-shorthand.js';\nimport './expect/type.js';\nimport mapValues from 'lodash/mapValues.js';\nimport { fail } from './utils/fail.js';\n\nuse({\n to: { type: 'property', value: () => null },\n be: { type: 'property', value: () => null },\n a: { type: 'property', value: () => null },\n an: { type: 'property', value: () => null },\n and: {\n type: 'property',\n value: ({ value, every, ...rest }) => {\n const values = mapValues(rest, () => {}) as any;\n return { value, every, ...values };\n }\n },\n have: { type: 'property', value: () => null },\n in: { type: 'property', value: () => null },\n not: { type: 'property', value: (state) => ({ ...state, inverted: !state.inverted }) },\n of: { type: 'property', value: () => null },\n\n length: { type: 'property', value: (state) => ({ ...state, getProperty: getSize }) },\n deep: { type: 'property', value: (state) => ({ ...state, deep: true }) },\n\n every: { type: 'property', value: (state) => ({ ...state, every: true }) }\n});\n\nexport const expectChain = <T>(state: State<T>) => {\n const chain = {} as any;\n for (const [key, v] of Object.entries(mixins)) {\n const definition = v.type === 'alias' ? mixins[v.value] : v;\n if (definition.type === 'property') {\n registerProperty(chain, key, () => {\n const newState = definition.value(state);\n return expectChain({ ...state, ...newState });\n });\n } else if (definition.type === 'method') {\n registerMethod(chain, key, (...args: any[]) => {\n if (state.getProperty) {\n definition.value({ value: state.getProperty(state.value), inverted: state.inverted })(...args);\n } else if (state.every) {\n for (const value of state.value as any) {\n definition.value({ ...state, value })(...args);\n }\n } else {\n const result = definition.value({ ...state })(...args);\n if (result as any) {\n return result;\n }\n }\n return expectChain(state);\n });\n }\n }\n return chain;\n};\n\nexport const expect = (<T>(actual: T) => {\n return expectChain({ value: actual });\n}) as Expect;\n\nexpect.fail = fail;\n"],"mappings":";;;;;;;;;;;AA6BA,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E,GAAG;GAAO,aAAa;GAAS;EAAG;CACpF,MAAM;EAAE,MAAM;EAAY,QAAQ,WAAW;GAAE,GAAG;GAAO,MAAM;GAAM;EAAG;CAExE,OAAO;EAAE,MAAM;EAAY,QAAQ,WAAW;GAAE,GAAG;GAAO,OAAO;GAAM;EAAG;CAC7E,CAAC;AAEF,MAAa,eAAkB,UAAoB;CAC/C,MAAM,QAAQ,EAAE;AAChB,MAAK,MAAM,CAAC,KAAK,MAAM,OAAO,QAAQ,OAAO,EAAE;EAC3C,MAAM,aAAa,EAAE,SAAS,UAAU,OAAO,EAAE,SAAS;AAC1D,MAAI,WAAW,SAAS,WACpB,kBAAiB,OAAO,WAAW;GAC/B,MAAM,WAAW,WAAW,MAAM,MAAM;AACxC,UAAO,YAAY;IAAE,GAAG;IAAO,GAAG;IAAU,CAAC;IAC/C;WACK,WAAW,SAAS,SAC3B,gBAAe,OAAO,MAAM,GAAG,SAAgB;AAC3C,OAAI,MAAM,YACN,YAAW,MAAM;IAAE,OAAO,MAAM,YAAY,MAAM,MAAM;IAAE,UAAU,MAAM;IAAU,CAAC,CAAC,GAAG,KAAK;YACvF,MAAM,MACb,MAAK,MAAM,SAAS,MAAM,MACtB,YAAW,MAAM;IAAE,GAAG;IAAO;IAAO,CAAC,CAAC,GAAG,KAAK;QAE/C;IACH,MAAM,SAAS,WAAW,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,GAAG,KAAK;AACtD,QAAI,OACA,QAAO;;AAGf,UAAO,YAAY,MAAM;IAC3B;;AAGV,QAAO;;AAGX,MAAa,WAAc,WAAc;AACrC,QAAO,YAAY,EAAE,OAAO,QAAQ,CAAC;;AAGzC,OAAO,OAAO"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["mixins: Record<string, Property | Method | Alias>","deepNotHasProperty","deepHasProperty","notHasProperty","hasProperty","notRejects","rejects","notThrows","throws","AssertionError"],"sources":["../src/mixins.ts","../src/utils/chain.ts","../src/utils/get-size.ts","../src/expect/after.ts","../src/expect/ballpark.ts","../src/expect/before.ts","../src/expect/between.ts","../src/expect/empty.ts","../src/expect/end-with.ts","../src/expect/eql.ts","../src/expect/equal-shorthand.ts","../src/expect/equal.ts","../src/expect/excluding.ts","../src/expect/greater-than-equal.ts","../src/expect/greater-than.ts","../src/expect/has-property.ts","../src/expect/include.ts","../src/expect/instance-of-shorthand.ts","../src/expect/instance-of.ts","../src/expect/keys.ts","../src/expect/length.ts","../src/expect/less-than-equal.ts","../src/expect/less-than.ts","../src/expect/match.ts","../src/expect/members.ts","../src/expect/reject.ts","../src/expect/round-to.ts","../src/expect/start-with.ts","../src/expect/throw.ts","../src/expect/type-shorthand.ts","../src/expect/type.ts","../src/utils/fail.ts","../src/expect.ts"],"sourcesContent":["export interface State<T> {\n inverted?: boolean;\n value?: T;\n getProperty?: (value: T) => any;\n deep?: boolean;\n same?: boolean;\n ordered?: boolean;\n partial?: boolean;\n\n every?: boolean;\n}\n\nexport interface Property {\n type: 'property';\n value: (state: State<any>) => Partial<State<any>> | null;\n}\n\ntype MethodCallback = (state: State<any>) => (...args: any[]) => void;\n\nexport interface Method {\n type: 'method';\n value: MethodCallback;\n}\n\nexport interface Alias {\n type: 'alias';\n value: string;\n}\n\nexport const mixins: Record<string, Property | Method | Alias> = {};\n\nexport const use = (plugins: Record<string, Property | Method | Alias>) => {\n Object.assign(mixins, plugins);\n};\n","export const registerProperty = <T, U extends string, V extends () => any>(object: T, name: U, value: V) => {\n Object.defineProperty(object, name, {\n enumerable: true,\n get() {\n return value();\n }\n });\n return object as T & Record<U, V>;\n};\n\nexport const registerMethod = <T, U extends string, V>(object: T, name: U, value: V) => {\n Object.defineProperty(object, name, {\n value\n });\n return object as T & Record<U, V>;\n};\n","import isPlainObject from 'lodash/isPlainObject.js';\n\nexport const getSize = (value: any) => {\n if (Array.isArray(value)) {\n return value.length;\n }\n if (isPlainObject(value)) {\n return Object.keys(value).length;\n }\n if (value instanceof Map) {\n return value.size;\n }\n if (value instanceof Set) {\n return value.size;\n }\n if (typeof value === 'string') {\n return value.length;\n }\n return 0;\n};\n","import { isAfter, notAfter } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n after: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (date: Date) => {\n if (inverted) {\n notAfter(value, date);\n } else {\n isAfter(value, date);\n }\n }\n }\n});\n","import { inBallpark, notInBallpark } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n ballpark: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (ballpark, multiplier = 0.1) => {\n if (inverted) {\n notInBallpark(value, ballpark, multiplier);\n } else {\n inBallpark(value, ballpark, multiplier);\n }\n }\n }\n});\n","import { isBefore, notBefore } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n before: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (date: Date) => {\n if (inverted) {\n notBefore(value, date);\n } else {\n isBefore(value, date);\n }\n }\n }\n});\n","import { isBetween, notBetween } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n between: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (start: Date, end: Date, inclusive = true) => {\n if (inverted) {\n notBetween(value, start, end, { inclusive });\n } else {\n isBetween(value, start, end, { inclusive });\n }\n }\n }\n});\n","import { isEmpty, notIsEmpty } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n empty: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (message?: string) => {\n if (inverted) {\n notIsEmpty(value, message);\n } else {\n isEmpty(value, message);\n }\n }\n }\n});\n","import { endsWith, notEndsWith } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n endWith: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (end: string) => {\n if (inverted) {\n notEndsWith(value, end);\n } else {\n endsWith(value, end);\n }\n }\n }\n});\n","import { deepEqual, notDeepEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n partially: {\n type: 'property',\n value: () => ({ partial: true })\n },\n eql: {\n type: 'method',\n value:\n ({ value, inverted, partial }) =>\n (other: any, message) => {\n if (inverted) {\n notDeepEqual(value, other, partial, message);\n } else {\n deepEqual(value, other, partial, message);\n }\n }\n }\n});\n","import { equal, notEqual } from '../assert.js';\nimport { type State, use } from '../mixins.js';\nimport { format } from 'hein-assertion-utils';\n\nconst values = {\n false: false,\n true: true\n};\n\nuse(\n Object.fromEntries(\n Object.entries(values).map(([key, expectValue]) => {\n return [\n key,\n {\n type: 'method',\n value:\n ({ inverted, value }: State<any>) =>\n () => {\n if (inverted) {\n const message = format(\n 'Expected {{= it.value }} to not be {{= it.key }}',\n {\n key,\n value\n },\n true\n );\n notEqual(value, expectValue, message);\n } else {\n const message = format(\n 'Expected {{= it.value }} to be {{= it.key }}',\n {\n key,\n value\n },\n true\n );\n equal(value, expectValue, message);\n }\n }\n }\n ];\n })\n )\n);\n","import { deepEqual, equal, notDeepEqual, notEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n equal: {\n type: 'method',\n value:\n ({ value, inverted, deep }) =>\n (other: any, message?: string) => {\n if (deep) {\n if (inverted) {\n notDeepEqual(value, other, message);\n } else {\n deepEqual(value, other, message);\n }\n return;\n }\n if (inverted) {\n notEqual(value, other, message);\n } else {\n equal(value, other, message);\n }\n }\n },\n eq: { type: 'alias', value: 'equal' }\n});\n","import omit from 'lodash/omit.js';\nimport { use } from '../mixins.js';\nimport { expectChain } from '../expect.js';\n\nuse({\n excluding: {\n type: 'method',\n value:\n (state) =>\n (...keys: string[]) => {\n return expectChain({ ...state, value: omit(state.value, keys) });\n }\n }\n});\n","import { greaterThanEqual, notGreaterThanEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n greaterThanOrEqual: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notGreaterThanEqual(value, other);\n } else {\n greaterThanEqual(value, other);\n }\n }\n },\n gte: { type: 'alias', value: 'greaterThanOrEqual' },\n atLeast: { type: 'alias', value: 'greaterThanOrEqual' }\n});\n","import { greaterThan, notGreaterThan } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n greaterThan: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notGreaterThan(value, other);\n } else {\n greaterThan(value, other);\n }\n }\n },\n gt: { type: 'alias', value: 'greaterThan' },\n above: { type: 'alias', value: 'greaterThan' }\n});\n","import { deepHasProperty, deepNotHasProperty, hasProperty, notHasProperty } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n property: {\n type: 'method',\n value:\n ({ value, inverted, deep }) =>\n (...args: [any, any]) => {\n if (deep) {\n if (inverted) {\n return deepNotHasProperty(value, ...args);\n }\n return deepHasProperty(value, ...args);\n }\n if (inverted) {\n return notHasProperty(value, ...args);\n }\n return hasProperty(value, ...args);\n }\n }\n});\n","import { includes, notIncludes } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n include: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (...elements: any[]) => {\n if (inverted) {\n notIncludes(value, ...elements);\n } else {\n includes(value, ...elements);\n }\n }\n },\n contain: {\n type: 'alias',\n value: 'include'\n }\n});\n","import { instanceOf, notInstanceOf } from '../assert.js';\nimport { use } from '../mixins.js';\n\nconst constructors = [Date, Map, Set, WeakMap, WeakSet];\n\nuse(\n Object.fromEntries(\n constructors.map((constructor) => {\n return [\n constructor.name,\n {\n type: 'method',\n value:\n ({ inverted, value }) =>\n () => {\n if (inverted) {\n notInstanceOf(value, constructor);\n } else {\n instanceOf(value, constructor);\n }\n }\n }\n ];\n })\n )\n);\n","import { notInstanceOf, instanceOf } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type Constructor } from '../utils/process-error.js';\n\nuse({\n instanceOf: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (constructor: Constructor) => {\n if (inverted) {\n notInstanceOf(value, constructor);\n } else {\n instanceOf(value, constructor);\n }\n }\n }\n});\n","import { hasKeys, notHasKeys } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n keys: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (keys) => {\n if (inverted) {\n notHasKeys(value, keys);\n } else {\n hasKeys(value, keys);\n }\n }\n }\n});\n","import { hasSize, notHasSize } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n sizeOf: { type: 'alias', value: 'lengthOf' },\n lengthOf: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (length: number, message?: string) => {\n if (inverted) {\n notHasSize(value, length, message);\n } else {\n hasSize(value, length, message);\n }\n }\n }\n});\n","import { lessThanEqual, notLessThanEqual } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n lessThanOrEqual: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notLessThanEqual(value, other);\n } else {\n lessThanEqual(value, other);\n }\n }\n },\n lte: { type: 'alias', value: 'lessThanOrEqual' },\n atMost: { type: 'alias', value: 'lessThanOrEqual' }\n});\n","import { lessThan, notLessThan } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n lessThan: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (other: any) => {\n if (inverted) {\n notLessThan(value, other);\n } else {\n lessThan(value, other);\n }\n }\n },\n lt: { type: 'alias', value: 'lessThan' },\n below: { type: 'alias', value: 'lessThan' }\n});\n","import { match, notMatch } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n match: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (regex: RegExp) => {\n if (inverted) {\n notMatch(value, regex);\n } else {\n match(value, regex);\n }\n }\n }\n});\n","import { hasMembers, notHasMembers } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n members: {\n type: 'method',\n value:\n ({ value, inverted, same, deep, ordered, partial }) =>\n (other: any, message?: string) => {\n if (inverted) {\n notHasMembers(value, other, { deep, same, ordered, partial }, message);\n } else {\n hasMembers(value, other, { deep, same, ordered, partial }, message);\n }\n }\n },\n same: {\n type: 'property',\n value: (state) => {\n state.same = true;\n return state;\n }\n },\n ordered: {\n type: 'property',\n value: (state) => {\n state.ordered = true;\n return state;\n }\n }\n});\n","import { notRejects, rejects } from '../assert.js';\nimport { type State, use } from '../mixins.js';\n\nuse({\n reject: {\n type: 'method',\n value:\n ({ value, inverted }: State<any>) =>\n (...args: any[]) => {\n return inverted ? notRejects(value, ...args) : rejects(value, ...args);\n }\n }\n});\n","import { notRoundTo, roundTo } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n roundTo: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (target, decimal = 0) => {\n if (inverted) {\n notRoundTo(value, target, decimal);\n } else {\n roundTo(value, target, decimal);\n }\n }\n }\n});\n","import { startsWith, notStartsWith } from '../assert.js';\nimport { use } from '../mixins.js';\n\nuse({\n startWith: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (start: string) => {\n if (inverted) {\n notStartsWith(value, start);\n } else {\n startsWith(value, start);\n }\n }\n }\n});\n","import { notThrows, throws } from '../assert.js';\nimport { type State, use } from '../mixins.js';\n\nuse({\n throw: {\n type: 'method',\n value:\n ({ value, inverted }: State<any>) =>\n (...args: any[]) => {\n return inverted ? notThrows(value, ...args) : throws(value, ...args);\n }\n }\n});\n","import { isType, notIsType } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type ValueType } from '../utils/get-type.js';\n\nconst types: ValueType[] = [\n 'NaN',\n 'array',\n 'bigint',\n 'boolean',\n 'function',\n 'null',\n 'number',\n 'object',\n 'string',\n 'symbol',\n 'undefined'\n];\n\nuse(\n Object.fromEntries(\n types.map((type) => {\n return [\n type,\n {\n type: 'method',\n value:\n ({ value, inverted }) =>\n () => {\n if (inverted) {\n notIsType(value, type);\n } else {\n isType(value, type);\n }\n }\n }\n ];\n })\n )\n);\n","import { notIsType, isType } from '../assert.js';\nimport { use } from '../mixins.js';\nimport { type ValueType } from '../utils/get-type.js';\n\nuse({\n type: {\n type: 'method',\n value:\n ({ value, inverted }) =>\n (type: ValueType) => {\n if (inverted) {\n notIsType(value, type);\n } else {\n isType(value, type);\n }\n }\n }\n});\n","import { AssertionError } from 'hein-assertion-utils';\n\n/**\n * Throw an AssertionError\n * @param {string} message - The message to pass to the AssertionError\n */\nexport const fail = (message: string = 'Fail') => {\n throw new AssertionError(undefined, undefined, message);\n};\n","import { mixins, State, use } from './mixins.js';\nimport { registerMethod, registerProperty } from './utils/chain.js';\nimport { getSize } from './utils/get-size.js';\nimport { Expect } from './expect.types.js';\nimport './expect/after.js';\nimport './expect/ballpark.js';\nimport './expect/before.js';\nimport './expect/between.js';\nimport './expect/empty.js';\nimport './expect/end-with.js';\nimport './expect/eql.js';\nimport './expect/equal-shorthand.js';\nimport './expect/equal.js';\nimport './expect/excluding.js';\nimport './expect/greater-than-equal.js';\nimport './expect/greater-than.js';\nimport './expect/has-property.js';\nimport './expect/include.js';\nimport './expect/instance-of-shorthand.js';\nimport './expect/instance-of.js';\nimport './expect/keys.js';\nimport './expect/length.js';\nimport './expect/less-than-equal.js';\nimport './expect/less-than.js';\nimport './expect/match.js';\nimport './expect/members.js';\nimport './expect/reject.js';\nimport './expect/round-to.js';\nimport './expect/start-with.js';\nimport './expect/throw.js';\nimport './expect/type-shorthand.js';\nimport './expect/type.js';\nimport mapValues from 'lodash/mapValues.js';\nimport { fail } from './utils/fail.js';\n\nuse({\n to: { type: 'property', value: () => null },\n be: { type: 'property', value: () => null },\n a: { type: 'property', value: () => null },\n an: { type: 'property', value: () => null },\n and: {\n type: 'property',\n value: ({ value, every, ...rest }) => {\n const values = mapValues(rest, () => {}) as any;\n return { value, every, ...values };\n }\n },\n have: { type: 'property', value: () => null },\n in: { type: 'property', value: () => null },\n not: { type: 'property', value: (state) => ({ ...state, inverted: !state.inverted }) },\n of: { type: 'property', value: () => null },\n\n length: { type: 'property', value: (state) => ({ ...state, getProperty: getSize }) },\n deep: { type: 'property', value: (state) => ({ ...state, deep: true }) },\n\n every: { type: 'property', value: (state) => ({ ...state, every: true }) }\n});\n\nexport const expectChain = <T>(state: State<T>) => {\n const chain = {} as any;\n for (const [key, v] of Object.entries(mixins)) {\n const definition = v.type === 'alias' ? mixins[v.value] : v;\n if (definition.type === 'property') {\n registerProperty(chain, key, () => {\n const newState = definition.value(state);\n return expectChain({ ...state, ...newState });\n });\n } else if (definition.type === 'method') {\n registerMethod(chain, key, (...args: any[]) => {\n if (state.getProperty) {\n definition.value({ value: state.getProperty(state.value), inverted: state.inverted })(...args);\n } else if (state.every) {\n for (const value of state.value as any) {\n definition.value({ ...state, value })(...args);\n }\n } else {\n const result = definition.value({ ...state })(...args);\n if (result as any) {\n return result;\n }\n }\n return expectChain(state);\n });\n }\n }\n return chain;\n};\n\nexport const expect = (<T>(actual: T) => {\n return expectChain({ value: actual });\n}) as Expect;\n\nexpect.fail = fail;\n"],"mappings":";;;;;;;;;;;AA6BA,MAAaA,SAAoD,EAAE;AAEnE,MAAa,OAAO,YAAuD;AACvE,QAAO,OAAO,QAAQ,QAAQ;;;;;AChClC,MAAa,oBAA8D,QAAW,MAAS,UAAa;AACxG,QAAO,eAAe,QAAQ,MAAM;EAChC,YAAY;EACZ,MAAM;AACF,UAAO,OAAO;;EAErB,CAAC;AACF,QAAO;;AAGX,MAAa,kBAA0C,QAAW,MAAS,UAAa;AACpF,QAAO,eAAe,QAAQ,MAAM,EAChC,OACH,CAAC;AACF,QAAO;;;;;ACZX,MAAa,WAAW,UAAe;AACnC,KAAI,MAAM,QAAQ,MAAM,CACpB,QAAO,MAAM;AAEjB,0CAAkB,MAAM,CACpB,QAAO,OAAO,KAAK,MAAM,CAAC;AAE9B,KAAI,iBAAiB,IACjB,QAAO,MAAM;AAEjB,KAAI,iBAAiB,IACjB,QAAO,MAAM;AAEjB,KAAI,OAAO,UAAU,SACjB,QAAO,MAAM;AAEjB,QAAO;;;;;ACfX,IAAI,EACA,OAAO;CACH,MAAM;CACN,QACK,EAAE,OAAO,gBACT,SAAe;AACZ,MAAI,SACA,yBAAS,OAAO,KAAK;MAErB,wBAAQ,OAAO,K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