ai-tests 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +3 -0
  3. package/README.md +214 -0
  4. package/dist/assertions.d.ts +132 -0
  5. package/dist/assertions.d.ts.map +1 -0
  6. package/dist/assertions.js +384 -0
  7. package/dist/assertions.js.map +1 -0
  8. package/dist/cli.d.ts +13 -0
  9. package/dist/cli.d.ts.map +1 -0
  10. package/dist/cli.js +77 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/index.d.ts +16 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +19 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/local.d.ts +31 -0
  17. package/dist/local.d.ts.map +1 -0
  18. package/dist/local.js +63 -0
  19. package/dist/local.js.map +1 -0
  20. package/dist/runner.d.ts +68 -0
  21. package/dist/runner.d.ts.map +1 -0
  22. package/dist/runner.js +215 -0
  23. package/dist/runner.js.map +1 -0
  24. package/dist/types.d.ts +62 -0
  25. package/dist/types.d.ts.map +1 -0
  26. package/dist/types.js +5 -0
  27. package/dist/types.js.map +1 -0
  28. package/dist/worker.d.ts +55 -0
  29. package/dist/worker.d.ts.map +1 -0
  30. package/dist/worker.js +92 -0
  31. package/dist/worker.js.map +1 -0
  32. package/package.json +58 -0
  33. package/src/assertions.ts +465 -0
  34. package/src/cli.ts +87 -0
  35. package/src/index.ts +33 -0
  36. package/src/local.ts +76 -0
  37. package/src/runner.ts +238 -0
  38. package/src/types.ts +68 -0
  39. package/src/worker.ts +112 -0
  40. package/test/assertions.test.ts +607 -0
  41. package/test/index.test.ts +51 -0
  42. package/test/local.test.ts +31 -0
  43. package/test/runner.test.ts +379 -0
  44. package/test/worker.test.ts +198 -0
  45. package/tsconfig.json +23 -0
  46. package/vitest.config.ts +11 -0
  47. package/wrangler.toml +6 -0
@@ -0,0 +1,607 @@
1
+ import { describe, it, expect as vitestExpect } from 'vitest'
2
+ import { expect, should, assert, Assertion } from '../src/assertions.js'
3
+
4
+ describe('Assertion', () => {
5
+ describe('expect()', () => {
6
+ it('creates an Assertion instance', () => {
7
+ const assertion = expect(42)
8
+ vitestExpect(assertion).toBeInstanceOf(Assertion)
9
+ })
10
+
11
+ it('accepts an optional message', () => {
12
+ const assertion = expect(42, 'custom message')
13
+ vitestExpect(assertion).toBeInstanceOf(Assertion)
14
+ })
15
+ })
16
+
17
+ describe('should()', () => {
18
+ it('creates an Assertion instance', () => {
19
+ const assertion = should(42)
20
+ vitestExpect(assertion).toBeInstanceOf(Assertion)
21
+ })
22
+ })
23
+
24
+ describe('assert', () => {
25
+ it('exports chai assert object', () => {
26
+ vitestExpect(assert).toBeDefined()
27
+ vitestExpect(typeof assert.equal).toBe('function')
28
+ vitestExpect(typeof assert.strictEqual).toBe('function')
29
+ vitestExpect(typeof assert.deepEqual).toBe('function')
30
+ })
31
+ })
32
+ })
33
+
34
+ describe('Assertion chains', () => {
35
+ describe('language chains', () => {
36
+ it('to returns this', () => {
37
+ const a = expect(42)
38
+ vitestExpect(a.to).toBe(a)
39
+ })
40
+
41
+ it('be returns this', () => {
42
+ const a = expect(42)
43
+ vitestExpect(a.be).toBe(a)
44
+ })
45
+
46
+ it('been returns this', () => {
47
+ const a = expect(42)
48
+ vitestExpect(a.been).toBe(a)
49
+ })
50
+
51
+ it('is returns this', () => {
52
+ const a = expect(42)
53
+ vitestExpect(a.is).toBe(a)
54
+ })
55
+
56
+ it('that returns this', () => {
57
+ const a = expect(42)
58
+ vitestExpect(a.that).toBe(a)
59
+ })
60
+
61
+ it('which returns this', () => {
62
+ const a = expect(42)
63
+ vitestExpect(a.which).toBe(a)
64
+ })
65
+
66
+ it('and returns this', () => {
67
+ const a = expect(42)
68
+ vitestExpect(a.and).toBe(a)
69
+ })
70
+
71
+ it('has returns this', () => {
72
+ const a = expect(42)
73
+ vitestExpect(a.has).toBe(a)
74
+ })
75
+
76
+ it('have returns this', () => {
77
+ const a = expect(42)
78
+ vitestExpect(a.have).toBe(a)
79
+ })
80
+
81
+ it('with returns this', () => {
82
+ const a = expect(42)
83
+ vitestExpect(a.with).toBe(a)
84
+ })
85
+
86
+ it('at returns this', () => {
87
+ const a = expect(42)
88
+ vitestExpect(a.at).toBe(a)
89
+ })
90
+
91
+ it('of returns this', () => {
92
+ const a = expect(42)
93
+ vitestExpect(a.of).toBe(a)
94
+ })
95
+
96
+ it('same returns this', () => {
97
+ const a = expect(42)
98
+ vitestExpect(a.same).toBe(a)
99
+ })
100
+
101
+ it('but returns this', () => {
102
+ const a = expect(42)
103
+ vitestExpect(a.but).toBe(a)
104
+ })
105
+
106
+ it('does returns this', () => {
107
+ const a = expect(42)
108
+ vitestExpect(a.does).toBe(a)
109
+ })
110
+
111
+ it('still returns this', () => {
112
+ const a = expect(42)
113
+ vitestExpect(a.still).toBe(a)
114
+ })
115
+
116
+ it('also returns this', () => {
117
+ const a = expect(42)
118
+ vitestExpect(a.also).toBe(a)
119
+ })
120
+ })
121
+
122
+ describe('flags', () => {
123
+ it('not sets negation flag', () => {
124
+ const a = expect(42)
125
+ vitestExpect(a.not).toBe(a)
126
+ })
127
+
128
+ it('deep sets deep flag', () => {
129
+ const a = expect({ a: 1 })
130
+ vitestExpect(a.deep).toBe(a)
131
+ })
132
+
133
+ it('nested sets nested flag', () => {
134
+ const a = expect({ a: { b: 1 } })
135
+ vitestExpect(a.nested).toBe(a)
136
+ })
137
+
138
+ it('own sets own flag', () => {
139
+ const a = expect({ a: 1 })
140
+ vitestExpect(a.own).toBe(a)
141
+ })
142
+
143
+ it('ordered sets ordered flag', () => {
144
+ const a = expect([1, 2, 3])
145
+ vitestExpect(a.ordered).toBe(a)
146
+ })
147
+
148
+ it('any sets any flag', () => {
149
+ const a = expect({ a: 1 })
150
+ vitestExpect(a.any).toBe(a)
151
+ })
152
+
153
+ it('all sets all flag', () => {
154
+ const a = expect({ a: 1 })
155
+ vitestExpect(a.all).toBe(a)
156
+ })
157
+
158
+ it('length returns this', () => {
159
+ const a = expect([1, 2, 3])
160
+ vitestExpect(a.length).toBe(a)
161
+ })
162
+ })
163
+ })
164
+
165
+ describe('Assertion methods', () => {
166
+ describe('type assertions', () => {
167
+ it('ok passes for truthy values', () => {
168
+ vitestExpect(() => expect(1).ok).not.toThrow()
169
+ vitestExpect(() => expect('a').ok).not.toThrow()
170
+ vitestExpect(() => expect({}).ok).not.toThrow()
171
+ })
172
+
173
+ it('true passes for true', () => {
174
+ vitestExpect(() => expect(true).true).not.toThrow()
175
+ })
176
+
177
+ it('false passes for false', () => {
178
+ vitestExpect(() => expect(false).false).not.toThrow()
179
+ })
180
+
181
+ it('null passes for null', () => {
182
+ vitestExpect(() => expect(null).null).not.toThrow()
183
+ })
184
+
185
+ it('undefined passes for undefined', () => {
186
+ vitestExpect(() => expect(undefined).undefined).not.toThrow()
187
+ })
188
+
189
+ it('NaN passes for NaN', () => {
190
+ vitestExpect(() => expect(NaN).NaN).not.toThrow()
191
+ })
192
+
193
+ it('exist passes for non-null/undefined', () => {
194
+ vitestExpect(() => expect(0).exist).not.toThrow()
195
+ vitestExpect(() => expect('').exist).not.toThrow()
196
+ })
197
+
198
+ it('empty passes for empty values', () => {
199
+ vitestExpect(() => expect([]).empty).not.toThrow()
200
+ vitestExpect(() => expect('').empty).not.toThrow()
201
+ vitestExpect(() => expect({}).empty).not.toThrow()
202
+ })
203
+ })
204
+
205
+ describe('equal', () => {
206
+ it('passes for equal values', () => {
207
+ vitestExpect(() => expect(42).equal(42)).not.toThrow()
208
+ vitestExpect(() => expect('a').equal('a')).not.toThrow()
209
+ })
210
+
211
+ it('fails for unequal values', () => {
212
+ vitestExpect(() => expect(42).equal(43)).toThrow()
213
+ })
214
+
215
+ it('equals is alias', () => {
216
+ vitestExpect(() => expect(42).equals(42)).not.toThrow()
217
+ })
218
+
219
+ it('eq is alias', () => {
220
+ vitestExpect(() => expect(42).eq(42)).not.toThrow()
221
+ })
222
+ })
223
+
224
+ describe('eql (deep equal)', () => {
225
+ it('passes for deeply equal objects', () => {
226
+ vitestExpect(() => expect({ a: 1 }).eql({ a: 1 })).not.toThrow()
227
+ vitestExpect(() => expect([1, 2]).eql([1, 2])).not.toThrow()
228
+ })
229
+
230
+ it('fails for non-equal objects', () => {
231
+ vitestExpect(() => expect({ a: 1 }).eql({ a: 2 })).toThrow()
232
+ })
233
+
234
+ it('eqls is alias', () => {
235
+ vitestExpect(() => expect({ a: 1 }).eqls({ a: 1 })).not.toThrow()
236
+ })
237
+ })
238
+
239
+ describe('above/below/within', () => {
240
+ it('above passes when value is greater', () => {
241
+ vitestExpect(() => expect(10).above(5)).not.toThrow()
242
+ })
243
+
244
+ it('above fails when value is not greater', () => {
245
+ vitestExpect(() => expect(5).above(10)).toThrow()
246
+ })
247
+
248
+ it('gt is alias for above', () => {
249
+ vitestExpect(() => expect(10).gt(5)).not.toThrow()
250
+ })
251
+
252
+ it('greaterThan is alias for above', () => {
253
+ vitestExpect(() => expect(10).greaterThan(5)).not.toThrow()
254
+ })
255
+
256
+ it('least passes when value is >= ', () => {
257
+ vitestExpect(() => expect(10).least(10)).not.toThrow()
258
+ vitestExpect(() => expect(10).least(5)).not.toThrow()
259
+ })
260
+
261
+ it('gte is alias for least', () => {
262
+ vitestExpect(() => expect(10).gte(10)).not.toThrow()
263
+ })
264
+
265
+ it('below passes when value is less', () => {
266
+ vitestExpect(() => expect(5).below(10)).not.toThrow()
267
+ })
268
+
269
+ it('lt is alias for below', () => {
270
+ vitestExpect(() => expect(5).lt(10)).not.toThrow()
271
+ })
272
+
273
+ it('most passes when value is <=', () => {
274
+ vitestExpect(() => expect(10).most(10)).not.toThrow()
275
+ vitestExpect(() => expect(5).most(10)).not.toThrow()
276
+ })
277
+
278
+ it('lte is alias for most', () => {
279
+ vitestExpect(() => expect(10).lte(10)).not.toThrow()
280
+ })
281
+
282
+ it('within passes when value is in range', () => {
283
+ vitestExpect(() => expect(5).within(1, 10)).not.toThrow()
284
+ })
285
+ })
286
+
287
+ describe('instanceof', () => {
288
+ it('passes for correct instance', () => {
289
+ vitestExpect(() => expect(new Error()).instanceof(Error)).not.toThrow()
290
+ })
291
+
292
+ it('instanceOf is alias', () => {
293
+ vitestExpect(() => expect(new Error()).instanceOf(Error)).not.toThrow()
294
+ })
295
+ })
296
+
297
+ describe('property', () => {
298
+ it('passes when property exists', () => {
299
+ vitestExpect(() => expect({ a: 1 }).property('a')).not.toThrow()
300
+ })
301
+
302
+ it('passes when property has expected value', () => {
303
+ vitestExpect(() => expect({ a: 1 }).property('a', 1)).not.toThrow()
304
+ })
305
+
306
+ it('fails when property does not exist', () => {
307
+ vitestExpect(() => expect({}).property('a')).toThrow()
308
+ })
309
+ })
310
+
311
+ describe('ownProperty', () => {
312
+ it('passes for own property with value', () => {
313
+ vitestExpect(() => expect({ a: 1 }).ownProperty('a', 1)).not.toThrow()
314
+ })
315
+
316
+ it('haveOwnProperty is alias', () => {
317
+ vitestExpect(() => expect({ a: 1 }).haveOwnProperty('a', 1)).not.toThrow()
318
+ })
319
+ })
320
+
321
+ describe('lengthOf', () => {
322
+ it('passes for correct length', () => {
323
+ vitestExpect(() => expect([1, 2, 3]).lengthOf(3)).not.toThrow()
324
+ vitestExpect(() => expect('abc').lengthOf(3)).not.toThrow()
325
+ })
326
+ })
327
+
328
+ describe('match', () => {
329
+ it('passes when string matches regex', () => {
330
+ vitestExpect(() => expect('hello').match(/ell/)).not.toThrow()
331
+ })
332
+
333
+ it('matches is alias', () => {
334
+ vitestExpect(() => expect('hello').matches(/ell/)).not.toThrow()
335
+ })
336
+ })
337
+
338
+ describe('string', () => {
339
+ it('passes when string contains substring', () => {
340
+ vitestExpect(() => expect('hello world').string('world')).not.toThrow()
341
+ })
342
+ })
343
+
344
+ describe('keys', () => {
345
+ it('passes when object has keys', () => {
346
+ vitestExpect(() => expect({ a: 1, b: 2 }).keys('a', 'b')).not.toThrow()
347
+ })
348
+
349
+ it('key is alias', () => {
350
+ vitestExpect(() => expect({ a: 1 }).key('a')).not.toThrow()
351
+ })
352
+ })
353
+
354
+ describe('throw', () => {
355
+ it('passes when function throws', () => {
356
+ vitestExpect(() => expect(() => { throw new Error() }).throw()).not.toThrow()
357
+ })
358
+
359
+ it('throws is alias', () => {
360
+ vitestExpect(() => expect(() => { throw new Error() }).throws()).not.toThrow()
361
+ })
362
+
363
+ it('Throw is alias', () => {
364
+ vitestExpect(() => expect(() => { throw new Error() }).Throw()).not.toThrow()
365
+ })
366
+ })
367
+
368
+ describe('respondTo', () => {
369
+ it('passes when object has method', () => {
370
+ vitestExpect(() => expect({ foo: () => {} }).respondTo('foo')).not.toThrow()
371
+ })
372
+
373
+ it('respondsTo is alias', () => {
374
+ vitestExpect(() => expect({ foo: () => {} }).respondsTo('foo')).not.toThrow()
375
+ })
376
+ })
377
+
378
+ describe('satisfy', () => {
379
+ it('passes when matcher returns true', () => {
380
+ vitestExpect(() => expect(10).satisfy((n: number) => n > 5)).not.toThrow()
381
+ })
382
+
383
+ it('satisfies is alias', () => {
384
+ vitestExpect(() => expect(10).satisfies((n: number) => n > 5)).not.toThrow()
385
+ })
386
+ })
387
+
388
+ describe('closeTo', () => {
389
+ it('passes when value is close', () => {
390
+ vitestExpect(() => expect(1.5).closeTo(1.5, 0.01)).not.toThrow()
391
+ })
392
+
393
+ it('approximately is alias', () => {
394
+ vitestExpect(() => expect(1.5).approximately(1.5, 0.01)).not.toThrow()
395
+ })
396
+ })
397
+
398
+ describe('members', () => {
399
+ it('passes when array has members', () => {
400
+ vitestExpect(() => expect([1, 2, 3]).members([1, 2, 3])).not.toThrow()
401
+ })
402
+ })
403
+
404
+ describe('oneOf', () => {
405
+ it('passes when value is in list', () => {
406
+ vitestExpect(() => expect(2).oneOf([1, 2, 3])).not.toThrow()
407
+ })
408
+ })
409
+
410
+ describe('include', () => {
411
+ it('passes when array includes value', () => {
412
+ vitestExpect(() => expect([1, 2, 3]).include(2)).not.toThrow()
413
+ })
414
+
415
+ it('includes is alias', () => {
416
+ vitestExpect(() => expect([1, 2, 3]).includes(2)).not.toThrow()
417
+ })
418
+
419
+ it('contain is alias', () => {
420
+ vitestExpect(() => expect([1, 2, 3]).contain(2)).not.toThrow()
421
+ })
422
+
423
+ it('contains is alias', () => {
424
+ vitestExpect(() => expect([1, 2, 3]).contains(2)).not.toThrow()
425
+ })
426
+ })
427
+
428
+ describe('a/an', () => {
429
+ it('passes for correct type', () => {
430
+ vitestExpect(() => expect('hello').a('string')).not.toThrow()
431
+ vitestExpect(() => expect([]).an('array')).not.toThrow()
432
+ })
433
+ })
434
+ })
435
+
436
+ describe('Vitest-compatible matchers', () => {
437
+ describe('toBe', () => {
438
+ it('passes for strictly equal values', () => {
439
+ vitestExpect(() => expect(42).toBe(42)).not.toThrow()
440
+ })
441
+
442
+ it('fails for different values', () => {
443
+ vitestExpect(() => expect(42).toBe(43)).toThrow()
444
+ })
445
+ })
446
+
447
+ describe('toEqual', () => {
448
+ it('passes for deeply equal objects', () => {
449
+ vitestExpect(() => expect({ a: 1 }).toEqual({ a: 1 })).not.toThrow()
450
+ })
451
+ })
452
+
453
+ describe('toStrictEqual', () => {
454
+ it('passes for deeply equal objects', () => {
455
+ vitestExpect(() => expect({ a: 1 }).toStrictEqual({ a: 1 })).not.toThrow()
456
+ })
457
+ })
458
+
459
+ describe('toBeTruthy', () => {
460
+ it('passes for truthy values', () => {
461
+ vitestExpect(() => expect(1).toBeTruthy()).not.toThrow()
462
+ vitestExpect(() => expect('a').toBeTruthy()).not.toThrow()
463
+ })
464
+ })
465
+
466
+ describe('toBeFalsy', () => {
467
+ it('passes for falsy values', () => {
468
+ vitestExpect(() => expect(0).toBeFalsy()).not.toThrow()
469
+ vitestExpect(() => expect('').toBeFalsy()).not.toThrow()
470
+ })
471
+ })
472
+
473
+ describe('toBeNull', () => {
474
+ it('passes for null', () => {
475
+ vitestExpect(() => expect(null).toBeNull()).not.toThrow()
476
+ })
477
+ })
478
+
479
+ describe('toBeUndefined', () => {
480
+ it('passes for undefined', () => {
481
+ vitestExpect(() => expect(undefined).toBeUndefined()).not.toThrow()
482
+ })
483
+ })
484
+
485
+ describe('toBeDefined', () => {
486
+ it('passes for defined values', () => {
487
+ vitestExpect(() => expect(0).toBeDefined()).not.toThrow()
488
+ })
489
+ })
490
+
491
+ describe('toBeNaN', () => {
492
+ it('passes for NaN', () => {
493
+ vitestExpect(() => expect(NaN).toBeNaN()).not.toThrow()
494
+ })
495
+ })
496
+
497
+ describe('toContain', () => {
498
+ it('passes when array contains value', () => {
499
+ vitestExpect(() => expect([1, 2, 3]).toContain(2)).not.toThrow()
500
+ })
501
+ })
502
+
503
+ describe('toHaveLength', () => {
504
+ it('passes for correct length', () => {
505
+ vitestExpect(() => expect([1, 2, 3]).toHaveLength(3)).not.toThrow()
506
+ })
507
+ })
508
+
509
+ describe('toHaveProperty', () => {
510
+ it('passes when property exists', () => {
511
+ vitestExpect(() => expect({ a: { b: 1 } }).toHaveProperty('a.b')).not.toThrow()
512
+ })
513
+
514
+ it('passes when property has value', () => {
515
+ vitestExpect(() => expect({ a: { b: 1 } }).toHaveProperty('a.b', 1)).not.toThrow()
516
+ })
517
+ })
518
+
519
+ describe('toMatch', () => {
520
+ it('passes when string matches pattern', () => {
521
+ vitestExpect(() => expect('hello').toMatch(/ell/)).not.toThrow()
522
+ })
523
+
524
+ it('passes when string contains substring', () => {
525
+ vitestExpect(() => expect('hello').toMatch('ell')).not.toThrow()
526
+ })
527
+ })
528
+
529
+ describe('toMatchObject', () => {
530
+ it('passes when object matches subset', () => {
531
+ vitestExpect(() => expect({ a: 1, b: 2 }).toMatchObject({ a: 1 })).not.toThrow()
532
+ })
533
+ })
534
+
535
+ describe('toThrow', () => {
536
+ it('passes when function throws', () => {
537
+ vitestExpect(() => expect(() => { throw new Error('test') }).toThrow()).not.toThrow()
538
+ })
539
+
540
+ it('passes when error matches string', () => {
541
+ vitestExpect(() => expect(() => { throw new Error('test') }).toThrow('test')).not.toThrow()
542
+ })
543
+
544
+ it('passes when error matches regex', () => {
545
+ vitestExpect(() => expect(() => { throw new Error('test') }).toThrow(/test/)).not.toThrow()
546
+ })
547
+ })
548
+
549
+ describe('toBeGreaterThan', () => {
550
+ it('passes when value is greater', () => {
551
+ vitestExpect(() => expect(10).toBeGreaterThan(5)).not.toThrow()
552
+ })
553
+ })
554
+
555
+ describe('toBeLessThan', () => {
556
+ it('passes when value is less', () => {
557
+ vitestExpect(() => expect(5).toBeLessThan(10)).not.toThrow()
558
+ })
559
+ })
560
+
561
+ describe('toBeGreaterThanOrEqual', () => {
562
+ it('passes when value is >=', () => {
563
+ vitestExpect(() => expect(10).toBeGreaterThanOrEqual(10)).not.toThrow()
564
+ })
565
+ })
566
+
567
+ describe('toBeLessThanOrEqual', () => {
568
+ it('passes when value is <=', () => {
569
+ vitestExpect(() => expect(10).toBeLessThanOrEqual(10)).not.toThrow()
570
+ })
571
+ })
572
+
573
+ describe('toBeCloseTo', () => {
574
+ it('passes when value is close', () => {
575
+ vitestExpect(() => expect(0.1 + 0.2).toBeCloseTo(0.3)).not.toThrow()
576
+ })
577
+ })
578
+
579
+ describe('toBeInstanceOf', () => {
580
+ it('passes for correct instance', () => {
581
+ vitestExpect(() => expect(new Error()).toBeInstanceOf(Error)).not.toThrow()
582
+ })
583
+ })
584
+
585
+ describe('toBeTypeOf', () => {
586
+ it('passes for correct type', () => {
587
+ vitestExpect(() => expect('hello').toBeTypeOf('string')).not.toThrow()
588
+ vitestExpect(() => expect(42).toBeTypeOf('number')).not.toThrow()
589
+ })
590
+ })
591
+ })
592
+
593
+ describe('Chained assertions', () => {
594
+ it('supports chaining multiple checks', () => {
595
+ vitestExpect(() => {
596
+ expect(42).to.be.a('number').and.equal(42).and.above(40)
597
+ }).not.toThrow()
598
+ })
599
+
600
+ it('supports not negation', () => {
601
+ vitestExpect(() => expect(42).to.not.equal(43)).not.toThrow()
602
+ })
603
+
604
+ it('supports deep comparison', () => {
605
+ vitestExpect(() => expect({ a: 1 }).to.deep.equal({ a: 1 })).not.toThrow()
606
+ })
607
+ })
@@ -0,0 +1,51 @@
1
+ import { describe, it, expect } from 'vitest'
2
+
3
+ describe('index exports', () => {
4
+ it('exports Assertion', async () => {
5
+ const { Assertion } = await import('../src/index.js')
6
+ expect(Assertion).toBeDefined()
7
+ })
8
+
9
+ it('exports expect', async () => {
10
+ const { expect: expectFn } = await import('../src/index.js')
11
+ expect(expectFn).toBeDefined()
12
+ expect(typeof expectFn).toBe('function')
13
+ })
14
+
15
+ it('exports should', async () => {
16
+ const { should } = await import('../src/index.js')
17
+ expect(should).toBeDefined()
18
+ expect(typeof should).toBe('function')
19
+ })
20
+
21
+ it('exports assert', async () => {
22
+ const { assert } = await import('../src/index.js')
23
+ expect(assert).toBeDefined()
24
+ })
25
+
26
+ it('exports TestRunner', async () => {
27
+ const { TestRunner } = await import('../src/index.js')
28
+ expect(TestRunner).toBeDefined()
29
+ })
30
+
31
+ it('exports createRunner', async () => {
32
+ const { createRunner } = await import('../src/index.js')
33
+ expect(createRunner).toBeDefined()
34
+ expect(typeof createRunner).toBe('function')
35
+ })
36
+
37
+ it('exports TestService', async () => {
38
+ const { TestService } = await import('../src/index.js')
39
+ expect(TestService).toBeDefined()
40
+ })
41
+
42
+ it('exports TestWorker as alias', async () => {
43
+ const { TestWorker, TestService } = await import('../src/index.js')
44
+ expect(TestWorker).toBe(TestService)
45
+ })
46
+
47
+ it('exports TestServiceCore', async () => {
48
+ const { TestServiceCore } = await import('../src/index.js')
49
+ expect(TestServiceCore).toBeDefined()
50
+ })
51
+ })
@@ -0,0 +1,31 @@
1
+ import { describe, it, expect, beforeEach } from 'vitest'
2
+ import { getLocalTestService, createTestServiceBinding } from '../src/local.js'
3
+ import { TestServiceCore } from '../src/worker.js'
4
+
5
+ describe('local', () => {
6
+ describe('getLocalTestService()', () => {
7
+ it('returns a TestServiceCore instance', () => {
8
+ const service = getLocalTestService()
9
+ expect(service).toBeInstanceOf(TestServiceCore)
10
+ })
11
+
12
+ it('returns the same instance on subsequent calls', () => {
13
+ const service1 = getLocalTestService()
14
+ const service2 = getLocalTestService()
15
+ expect(service1).toBe(service2)
16
+ })
17
+ })
18
+
19
+ describe('createTestServiceBinding()', () => {
20
+ it('returns a TestServiceCore instance', () => {
21
+ const service = createTestServiceBinding()
22
+ expect(service).toBeInstanceOf(TestServiceCore)
23
+ })
24
+
25
+ it('returns a new instance each time', () => {
26
+ const service1 = createTestServiceBinding()
27
+ const service2 = createTestServiceBinding()
28
+ expect(service1).not.toBe(service2)
29
+ })
30
+ })
31
+ })