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/index.d.ts
CHANGED
|
@@ -1,10 +1,464 @@
|
|
|
1
|
-
import { assert_d_exports } from "./assert-
|
|
2
|
-
import { ErrorPredicate, ValueType } from "./throws-BlzO4xvg.js";
|
|
3
|
-
import { Alias, Expect, Method, Property, State, fail, use } from "./expect.types-nBq4Rg8e.js";
|
|
1
|
+
import { Constructor, ErrorPredicate, ThrowsCallback, ValueType, assert_d_exports } from "./assert-CJsbhtgi.js";
|
|
4
2
|
import { AssertionError } from "hein-assertion-utils";
|
|
5
3
|
|
|
4
|
+
//#region src/mixins.d.ts
|
|
5
|
+
interface State<T> {
|
|
6
|
+
inverted?: boolean;
|
|
7
|
+
value?: T;
|
|
8
|
+
getProperty?: (value: T) => any;
|
|
9
|
+
deep?: boolean;
|
|
10
|
+
same?: boolean;
|
|
11
|
+
ordered?: boolean;
|
|
12
|
+
partial?: boolean;
|
|
13
|
+
every?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface Property {
|
|
16
|
+
type: 'property';
|
|
17
|
+
value: (state: State<any>) => Partial<State<any>> | null;
|
|
18
|
+
}
|
|
19
|
+
type MethodCallback = (state: State<any>) => (...args: any[]) => void;
|
|
20
|
+
interface Method {
|
|
21
|
+
type: 'method';
|
|
22
|
+
value: MethodCallback;
|
|
23
|
+
}
|
|
24
|
+
interface Alias {
|
|
25
|
+
type: 'alias';
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
declare const use: (plugins: Record<string, Property | Method | Alias>) => void;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/utils/fail.d.ts
|
|
31
|
+
/**
|
|
32
|
+
* Throw an AssertionError
|
|
33
|
+
* @param {string} message - The message to pass to the AssertionError
|
|
34
|
+
*/
|
|
35
|
+
declare const fail: (message?: string) => never;
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/utils/types.d.ts
|
|
38
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] | (T[P] extends Array<infer U> ? Array<DeepPartial<U>> : DeepPartial<T[P]>) };
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/expect.types.d.ts
|
|
41
|
+
interface ValueExpect<T> {
|
|
42
|
+
to: this;
|
|
43
|
+
be: this;
|
|
44
|
+
a: this;
|
|
45
|
+
an: this;
|
|
46
|
+
not: this;
|
|
47
|
+
and: this;
|
|
48
|
+
have: this;
|
|
49
|
+
in: this;
|
|
50
|
+
of: this;
|
|
51
|
+
/**
|
|
52
|
+
* Use deep equality for object checks
|
|
53
|
+
*/
|
|
54
|
+
deep: this;
|
|
55
|
+
/**
|
|
56
|
+
* check for deep equality
|
|
57
|
+
*/
|
|
58
|
+
eql(value: T, message?: string): this;
|
|
59
|
+
partially: ValueExpect<DeepPartial<T>>;
|
|
60
|
+
/**
|
|
61
|
+
* check for === equality, NaN is considered equal to NaN
|
|
62
|
+
*/
|
|
63
|
+
equal(value: T, message?: string): this;
|
|
64
|
+
/**
|
|
65
|
+
* check for === equality, NaN is considered equal to NaN
|
|
66
|
+
*/
|
|
67
|
+
eq(value: T, message?: string): this;
|
|
68
|
+
/**
|
|
69
|
+
* check if value has a property
|
|
70
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
71
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
72
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
73
|
+
*/
|
|
74
|
+
property<K extends keyof T>(property: K): this;
|
|
75
|
+
/**
|
|
76
|
+
* check if value has a property
|
|
77
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
78
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
79
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
80
|
+
*/
|
|
81
|
+
property(property: string): this;
|
|
82
|
+
/**
|
|
83
|
+
* check if value has a property
|
|
84
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
85
|
+
* @param value
|
|
86
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
87
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
88
|
+
*/
|
|
89
|
+
property<K extends keyof T>(property: K, value?: any): this;
|
|
90
|
+
/**
|
|
91
|
+
* check if value has a property
|
|
92
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
93
|
+
* @param value
|
|
94
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
95
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
96
|
+
*/
|
|
97
|
+
property(property: string, value?: any): this;
|
|
98
|
+
/**
|
|
99
|
+
* check if instance of value
|
|
100
|
+
* @param constructor - The constructor function to check against
|
|
101
|
+
*/
|
|
102
|
+
instanceOf(constructor: Constructor): this;
|
|
103
|
+
/**
|
|
104
|
+
* check if value is null
|
|
105
|
+
*/
|
|
106
|
+
null(): this;
|
|
107
|
+
/**
|
|
108
|
+
* check if value is undefined
|
|
109
|
+
*/
|
|
110
|
+
undefined(): this;
|
|
111
|
+
/**
|
|
112
|
+
* check if value is of certain type
|
|
113
|
+
*/
|
|
114
|
+
type(type: ValueType): this;
|
|
115
|
+
}
|
|
116
|
+
type ArrayType<T, DT = never> = T extends (infer U)[] ? U : DT;
|
|
117
|
+
interface ArrayExpect<T> extends ValueExpect<T>, ObjectExpect<T> {
|
|
118
|
+
length: NumberExpect<number> & this;
|
|
119
|
+
array(): this;
|
|
120
|
+
every: GetExpectType<ArrayType<T>>;
|
|
121
|
+
/**
|
|
122
|
+
* check if array includes element(s)
|
|
123
|
+
*/
|
|
124
|
+
include(...elements: ArrayType<T>[]): this;
|
|
125
|
+
/**
|
|
126
|
+
* check if array includes element(s)
|
|
127
|
+
*/
|
|
128
|
+
contain(...elements: ArrayType<T>[]): this;
|
|
129
|
+
/**
|
|
130
|
+
* check for array length
|
|
131
|
+
*/
|
|
132
|
+
lengthOf(length: number, message?: string): this;
|
|
133
|
+
/**
|
|
134
|
+
* check that the members in second array are present in the first one
|
|
135
|
+
*/
|
|
136
|
+
members(value: ArrayType<T, any>[], message?: string): this;
|
|
137
|
+
same: ArrayExpect<T>;
|
|
138
|
+
ordered: ArrayExpect<T>;
|
|
139
|
+
/**
|
|
140
|
+
* Use partial matching for objects
|
|
141
|
+
* @example
|
|
142
|
+
* expect({ a: 1, b: 2 }).to.partially.eql({ a: 1 });
|
|
143
|
+
*/
|
|
144
|
+
partially: ArrayExpect<DeepPartial<T>>;
|
|
145
|
+
/**
|
|
146
|
+
* check if value is an array
|
|
147
|
+
*/
|
|
148
|
+
array(): this;
|
|
149
|
+
}
|
|
150
|
+
interface BigIntExpect<T = bigint> extends NumberExpect<T> {
|
|
151
|
+
/**
|
|
152
|
+
* check if value is a bigint
|
|
153
|
+
*/
|
|
154
|
+
bigint(): this;
|
|
155
|
+
}
|
|
156
|
+
interface BooleanExpect<T = boolean> extends ValueExpect<T> {
|
|
157
|
+
/**
|
|
158
|
+
* check if value is a boolean
|
|
159
|
+
*/
|
|
160
|
+
boolean(): this;
|
|
161
|
+
/**
|
|
162
|
+
* check if value is true
|
|
163
|
+
*/
|
|
164
|
+
true(): this;
|
|
165
|
+
/**
|
|
166
|
+
* check if value is false
|
|
167
|
+
*/
|
|
168
|
+
false(): this;
|
|
169
|
+
}
|
|
170
|
+
interface DateExpect<T = Date> extends ValueExpect<T>, ObjectExpect<T> {
|
|
171
|
+
/**
|
|
172
|
+
* check if date is after other date
|
|
173
|
+
* @param date
|
|
174
|
+
*/
|
|
175
|
+
after(date: Date): this;
|
|
176
|
+
/**
|
|
177
|
+
* check if date is before other date
|
|
178
|
+
* @param date
|
|
179
|
+
*/
|
|
180
|
+
before(date: Date): this;
|
|
181
|
+
/**
|
|
182
|
+
* check if date is between other dates
|
|
183
|
+
* @param start
|
|
184
|
+
* @param end
|
|
185
|
+
*/
|
|
186
|
+
between(start: Date, end: Date, inclusive?: boolean): this;
|
|
187
|
+
/**
|
|
188
|
+
* check if actual is greater than or equal to expected
|
|
189
|
+
*/
|
|
190
|
+
greaterThanOrEqual(value: T): this;
|
|
191
|
+
/**
|
|
192
|
+
* check if actual is greater than or equal to expected
|
|
193
|
+
*/
|
|
194
|
+
gte(value: T): this;
|
|
195
|
+
/**
|
|
196
|
+
* check if actual is greater than or equal to expected
|
|
197
|
+
*/
|
|
198
|
+
atLeast(value: T): this;
|
|
199
|
+
/**
|
|
200
|
+
* check if actual is greater than expected
|
|
201
|
+
*/
|
|
202
|
+
greaterThan(value: T): this;
|
|
203
|
+
/**
|
|
204
|
+
* check if actual is greater than expected
|
|
205
|
+
*/
|
|
206
|
+
gt(value: T): this;
|
|
207
|
+
/**
|
|
208
|
+
* check if actual is greater than expected
|
|
209
|
+
*/
|
|
210
|
+
above(value: T): this;
|
|
211
|
+
/**
|
|
212
|
+
* check if value is an instance of Date
|
|
213
|
+
*/
|
|
214
|
+
Date(): this;
|
|
215
|
+
/**
|
|
216
|
+
* check if actual is less than or equal to expected
|
|
217
|
+
*/
|
|
218
|
+
lessThanOrEqual(value: T): this;
|
|
219
|
+
/**
|
|
220
|
+
* check if actual is less than or equal to expected
|
|
221
|
+
*/
|
|
222
|
+
lte(value: T): this;
|
|
223
|
+
/**
|
|
224
|
+
* check if actual is less than or equal to expected
|
|
225
|
+
*/
|
|
226
|
+
atMost(value: T): this;
|
|
227
|
+
/**
|
|
228
|
+
* check if actual is less than expected
|
|
229
|
+
*/
|
|
230
|
+
lessThan(value: T): this;
|
|
231
|
+
/**
|
|
232
|
+
* check if actual is less than expected
|
|
233
|
+
*/
|
|
234
|
+
lt(value: T): this;
|
|
235
|
+
/**
|
|
236
|
+
* check if actual is less than expected
|
|
237
|
+
*/
|
|
238
|
+
below(value: T): this;
|
|
239
|
+
}
|
|
240
|
+
interface FunctionExpect<T> extends ValueExpect<T> {
|
|
241
|
+
/**
|
|
242
|
+
* check if function throws
|
|
243
|
+
* @param message
|
|
244
|
+
*/
|
|
245
|
+
throw(message?: string): this;
|
|
246
|
+
throw(matcher: RegExp | Constructor<Error> | ErrorPredicate, message?: string): this;
|
|
247
|
+
/**
|
|
248
|
+
* check if value is a function
|
|
249
|
+
*/
|
|
250
|
+
function(): this;
|
|
251
|
+
}
|
|
252
|
+
interface NumberExpect<T = number> extends ValueExpect<T> {
|
|
253
|
+
/**
|
|
254
|
+
* check if number close enough (default 10%)
|
|
255
|
+
* @param ballpark
|
|
256
|
+
* @param [multiplier=10] - a number between 0 and 1 (exclusive). 0.1 (default) means 10% difference is allowed.
|
|
257
|
+
*/
|
|
258
|
+
ballpark(ballpark: number, multiplier?: number): this;
|
|
259
|
+
/**
|
|
260
|
+
* check if number is between other numbers
|
|
261
|
+
* @param start
|
|
262
|
+
* @param end
|
|
263
|
+
* @param inclusive
|
|
264
|
+
*/
|
|
265
|
+
between(start: number, end: number, inclusive?: boolean): this;
|
|
266
|
+
/**
|
|
267
|
+
* check if actual is greater than or equal to expected
|
|
268
|
+
*/
|
|
269
|
+
greaterThanOrEqual(value: T): this;
|
|
270
|
+
/**
|
|
271
|
+
* check if actual is greater than or equal to expected
|
|
272
|
+
*/
|
|
273
|
+
gte(value: T): this;
|
|
274
|
+
/**
|
|
275
|
+
* check if actual is greater than or equal to expected
|
|
276
|
+
*/
|
|
277
|
+
atLeast(value: T): this;
|
|
278
|
+
/**
|
|
279
|
+
* check if actual is greater than expected
|
|
280
|
+
*/
|
|
281
|
+
greaterThan(value: T): this;
|
|
282
|
+
/**
|
|
283
|
+
* check if actual is greater than expected
|
|
284
|
+
*/
|
|
285
|
+
gt(value: T): this;
|
|
286
|
+
/**
|
|
287
|
+
* check if actual is greater than expected
|
|
288
|
+
*/
|
|
289
|
+
above(value: T): this;
|
|
290
|
+
/**
|
|
291
|
+
* check if actual is less than or equal to expected
|
|
292
|
+
*/
|
|
293
|
+
lessThanOrEqual(value: T): this;
|
|
294
|
+
/**
|
|
295
|
+
* check if actual is less than or equal to expected
|
|
296
|
+
*/
|
|
297
|
+
lte(value: T): this;
|
|
298
|
+
/**
|
|
299
|
+
* check if actual is less than or equal to expected
|
|
300
|
+
*/
|
|
301
|
+
atMost(value: T): this;
|
|
302
|
+
/**
|
|
303
|
+
* check if actual is less than expected
|
|
304
|
+
*/
|
|
305
|
+
lessThan(value: T): this;
|
|
306
|
+
/**
|
|
307
|
+
* check if actual is less than expected
|
|
308
|
+
*/
|
|
309
|
+
lt(value: T): this;
|
|
310
|
+
/**
|
|
311
|
+
* check if actual is less than expected
|
|
312
|
+
*/
|
|
313
|
+
below(value: T): this;
|
|
314
|
+
/**
|
|
315
|
+
* check if number close enough (default 10%)
|
|
316
|
+
* @param target
|
|
317
|
+
* @param decimal defaults to 0, can be negative if trying to round down to nearest 10, 100, etc
|
|
318
|
+
*/
|
|
319
|
+
roundTo(target: number, decimal?: number): this;
|
|
320
|
+
/**
|
|
321
|
+
* check if value is a number
|
|
322
|
+
*/
|
|
323
|
+
number(): this;
|
|
324
|
+
/**
|
|
325
|
+
* check if value is a NaN
|
|
326
|
+
*/
|
|
327
|
+
NaN(): this;
|
|
328
|
+
}
|
|
329
|
+
type InferMapKeys<T> = T extends Map<infer K, any> ? K : never;
|
|
330
|
+
interface MapExpect<T> extends ValueExpect<T> {
|
|
331
|
+
size: NumberExpect<number>;
|
|
332
|
+
/**
|
|
333
|
+
* check if Map is empty
|
|
334
|
+
*/
|
|
335
|
+
empty(message?: string): this;
|
|
336
|
+
/**
|
|
337
|
+
* check if value is an instance of Map
|
|
338
|
+
*/
|
|
339
|
+
Map(): this;
|
|
340
|
+
/**
|
|
341
|
+
* Check if value has keys
|
|
342
|
+
*/
|
|
343
|
+
keys<K extends InferMapKeys<T>>(keys: K[] | K): this;
|
|
344
|
+
/**
|
|
345
|
+
* check for Map to have a certain size
|
|
346
|
+
*/
|
|
347
|
+
sizeOf(size: number, message?: string): this;
|
|
348
|
+
}
|
|
349
|
+
interface ObjectExpect<T> extends ValueExpect<T> {
|
|
350
|
+
size: NumberExpect<number>;
|
|
351
|
+
/**
|
|
352
|
+
* check if object/array/Map/Set is empty
|
|
353
|
+
*/
|
|
354
|
+
empty(message?: string): this;
|
|
355
|
+
/**
|
|
356
|
+
* exclude keys from object to be compared further down the chain
|
|
357
|
+
* @param keys
|
|
358
|
+
*/
|
|
359
|
+
excluding<K extends keyof T>(...keys: K[]): ObjectExpect<Omit<T, K>>;
|
|
360
|
+
/**
|
|
361
|
+
* check if value is an instance of Map
|
|
362
|
+
*/
|
|
363
|
+
Map(): this;
|
|
364
|
+
/**
|
|
365
|
+
* check if value is an instance of Set
|
|
366
|
+
*/
|
|
367
|
+
Set(): this;
|
|
368
|
+
/**
|
|
369
|
+
* check if value is an instance of WeakMap
|
|
370
|
+
*/
|
|
371
|
+
WeakMap(): this;
|
|
372
|
+
/**
|
|
373
|
+
* check if value is an instance of WeakSet
|
|
374
|
+
*/
|
|
375
|
+
WeakSet(): this;
|
|
376
|
+
/**
|
|
377
|
+
* Check if value has keys
|
|
378
|
+
*/
|
|
379
|
+
keys<K extends keyof T>(keys: K[] | K): this;
|
|
380
|
+
/**
|
|
381
|
+
* check for object/array/Map/Set/string to have a certain size
|
|
382
|
+
*/
|
|
383
|
+
sizeOf(size: number, message?: string): this;
|
|
384
|
+
/**
|
|
385
|
+
* check if value is a plain object
|
|
386
|
+
*/
|
|
387
|
+
object(): this;
|
|
388
|
+
}
|
|
389
|
+
interface PromiseExpect<T> extends ValueExpect<T> {
|
|
390
|
+
/**
|
|
391
|
+
* check if promise rejects
|
|
392
|
+
* @param message
|
|
393
|
+
*/
|
|
394
|
+
reject(message?: string): Promise<void>;
|
|
395
|
+
reject(matcher: RegExp | Constructor<Error> | ErrorPredicate): Promise<void>;
|
|
396
|
+
}
|
|
397
|
+
interface StringExpect<T = string> extends ValueExpect<T> {
|
|
398
|
+
/**
|
|
399
|
+
* check if string ends with other string
|
|
400
|
+
* @param start
|
|
401
|
+
* @example endsWith('foo', 'o');
|
|
402
|
+
*/
|
|
403
|
+
endWith(end: string): this;
|
|
404
|
+
/**
|
|
405
|
+
* check if string includes substring(s)
|
|
406
|
+
*/
|
|
407
|
+
include(...substrings: string[]): this;
|
|
408
|
+
/**
|
|
409
|
+
* check if string includes substring(s)
|
|
410
|
+
*/
|
|
411
|
+
contain(...substrings: string[]): this;
|
|
412
|
+
/**
|
|
413
|
+
* check for string to have a certain size
|
|
414
|
+
*/
|
|
415
|
+
lengthOf(length: number, message?: string): this;
|
|
416
|
+
/**
|
|
417
|
+
* check if string matches regex
|
|
418
|
+
*/
|
|
419
|
+
match(regex: RegExp): this;
|
|
420
|
+
/**
|
|
421
|
+
* check if string starts with other string
|
|
422
|
+
* @param start
|
|
423
|
+
* @example startsWith('foo', 'f');
|
|
424
|
+
*/
|
|
425
|
+
startWith(start: string): this;
|
|
426
|
+
/**
|
|
427
|
+
* check if value is a string
|
|
428
|
+
*/
|
|
429
|
+
string(): this;
|
|
430
|
+
}
|
|
431
|
+
interface SymbolExpect<T> extends ValueExpect<T> {
|
|
432
|
+
/**
|
|
433
|
+
* check if value is a symbol
|
|
434
|
+
*/
|
|
435
|
+
symbol(): this;
|
|
436
|
+
}
|
|
437
|
+
declare const LooseSymbol: unique symbol;
|
|
438
|
+
interface Loose {
|
|
439
|
+
[LooseSymbol]: true;
|
|
440
|
+
}
|
|
441
|
+
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>;
|
|
442
|
+
interface Expect {
|
|
443
|
+
<T extends Loose>(actual: T): AllExpects<T>;
|
|
444
|
+
<T extends ThrowsCallback>(actual: T): FunctionExpect<T>;
|
|
445
|
+
<T extends Promise<any>>(actual: T): PromiseExpect<T>;
|
|
446
|
+
<T extends any[]>(actual: T): ArrayExpect<T>;
|
|
447
|
+
<T extends Date>(actual: T): DateExpect<T>;
|
|
448
|
+
<T extends Map<any, any>>(actual: T): MapExpect<T>;
|
|
449
|
+
<T extends Record<string, any>>(actual: T): ObjectExpect<T>;
|
|
450
|
+
<T extends number>(actual: T): NumberExpect;
|
|
451
|
+
<T extends bigint>(actual: T): BigIntExpect;
|
|
452
|
+
<T extends boolean>(actual: T): BooleanExpect;
|
|
453
|
+
<T extends string>(actual: T): StringExpect;
|
|
454
|
+
<T extends symbol>(actual: T): SymbolExpect<T>;
|
|
455
|
+
<T>(actual: T): ValueExpect<T>;
|
|
456
|
+
fail: typeof fail;
|
|
457
|
+
}
|
|
458
|
+
type GetExpectType<T> = T extends number ? NumberExpect<T> : AllExpects<T>;
|
|
459
|
+
//# sourceMappingURL=expect.types.d.ts.map
|
|
460
|
+
//#endregion
|
|
6
461
|
//#region src/expect.d.ts
|
|
7
|
-
|
|
8
462
|
declare const expectChain: <T>(state: State<T>) => any;
|
|
9
463
|
declare const expect: Expect;
|
|
10
464
|
//#endregion
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/expect.ts","../src/utils/match.ts"],"sourcesContent":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/mixins.ts","../src/utils/fail.ts","../src/utils/types.ts","../src/expect.types.ts","../src/expect.ts","../src/utils/match.ts"],"sourcesContent":[],"mappings":";;;;UAAiB;;UAEL;wBACc;EAHT,IAAA,CAAA,EAAA,OAAK;EAAA,IAAA,CAAA,EAAA,OAAA;SAEV,CAAA,EAAA,OAAA;SACc,CAAA,EAAA,OAAA;EAAC,KAAA,CAAA,EAAA,OAAA;AAS3B;AAAyB,UAAR,QAAA,CAAQ;MAEN,EAAA,UAAA;OAAuB,EAAA,CAAA,KAAA,EAAvB,KAAuB,CAAA,GAAA,CAAA,EAAA,GAAR,OAAQ,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAA;;KAGrC,cAAA,GAHoC,CAAA,KAAA,EAGX,KAHW,CAAA,GAAA,CAAA,EAAA,GAAA,CAAA,GAAA,IAAA,EAAA,GAAA,EAAA,EAAA,GAAA,IAAA;AAGpC,UAEY,MAAA,CAFE;EAEF,IAAA,EAAA,QAAM;EAKN,KAAA,EAHN,cAGW;AAOtB;AAEC,UATgB,KAAA,CAShB;MAF2C,EAAA,OAAA;OAAW,EAAA,MAAA;;AAApB,cAAtB,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BACzB,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;;;;cClY3D,wBAAyB,MAAM;cA8B/B,QAEP;;;AJ1FgB,cKUT,gBLVS,EAAA,CAAA,QAAA,EAAA,CAAA,KAAA,EAAA,GAAA,EAAA,GAAA,OAAA,EAAA,GAAA,GAAA;AAEV,cKgBC,GLhBD,EAAA,GAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["mixins: Record<string, Property | Method | Alias>","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,MAAa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AM;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.js","names":["mixins: Record<string, Property | Method | Alias>","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,KAAI,cAAc,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,UAAS,OAAO,KAAK;MAErB,SAAQ,OAAO,KAAK;;CAGnC,EACJ,CAAC;;;;ACbF,IAAI,EACA,UAAU;CACN,MAAM;CACN,QACK,EAAE,OAAO,gBACT,UAAU,aAAa,OAAQ;AAC5B,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;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"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assert-ChQPKP5C.d.cts","names":[],"sources":["../src/assert/deep-equal.ts","../src/assert/equal.ts","../src/assert/greater-than.ts","../src/assert/greater-than-equal.ts","../src/assert/has-property.ts","../src/assert/has-size.ts","../src/assert/includes.ts","../src/assert/instance-of.ts","../src/assert/is-empty.ts","../src/assert/is-type.ts","../src/assert/less-than.ts","../src/assert/less-than-equal.ts","../src/assert/match.ts","../src/assert/rejects.ts","../src/assert/deep-has-property.ts","../src/assert/starts-with.ts","../src/assert/ends-with.ts","../src/assert/is-before.ts","../src/assert/is-after.ts","../src/assert/is-between.ts","../src/assert/in-ballpark.ts","../src/assert/round-to.ts","../src/assert/has-members.ts","../src/assert/has-keys.ts","../src/assert.ts"],"sourcesContent":[],"mappings":";;;;;cAIc,uBAOM,aAAa,oGAAb,aAAa;;;UCTvB,KAAA;;;;cAIM,aAAa;;cAGf,OAAK,iBAAU;;;UCNnB,WAAA;;;;+BAIuB,cAAc,aAAa;;cAG9C,aAAW,6BAAgB;;;UCP/B,gBAAA;;;;+BAIuB,cAAc,aAAa;;cAG9C,kBAAgB,uCAAqB;;;UCRzC,WAAA;;;;;;;sBAOc,WAAW,aAAa;;;;;;;;EJLlC,CAAA,CAAA,EAAA,UAOkF,MIMxE,CJNwE,CAAA,CAAA,MAAA,EIM7D,CJN6D,EAAA,QAAA,EIMhD,CJNgD,EAAA,KAAA,EIMtC,CJNsC,CIMpC,CJNoC,CAAA,CAAA,EAAA,IAAA;;AAA5E,cISN,WJTM,EISK,WJTL,EAAA,cAAA,EISqB,WJTrB;;;UKRV,OAAA;;;;;;;;;;;;;;WAcG;ELbC;;;;;;EAOoB,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