@trackunit/react-core-contexts-test 0.1.73 → 0.1.74
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/index2.cjs +155 -0
- package/index2.js +155 -0
- package/package.json +1 -1
- package/src/TrackunitProvidersMockBuilder.d.ts +155 -0
package/index2.cjs
CHANGED
|
@@ -345,6 +345,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
345
345
|
* Defaults to mockAnalyticsContext.
|
|
346
346
|
*
|
|
347
347
|
* @see mockAnalyticsContext
|
|
348
|
+
* @example
|
|
349
|
+
* ...
|
|
350
|
+
* it("should allow render", async () => {
|
|
351
|
+
* await trackunitProviders().analytics(yourPartialAnalyticsMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
352
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
353
|
+
* });
|
|
354
|
+
* ...
|
|
355
|
+
* @example
|
|
356
|
+
* ...
|
|
357
|
+
* it("should allow renderHook", async () => {
|
|
358
|
+
* const { result } = await trackunitProviders().analytics(yourPartialAnalyticsMock).renderHook(() => useYourTestHook());
|
|
359
|
+
* expect(result.current).toEqual(anything());
|
|
360
|
+
* });
|
|
361
|
+
* ...
|
|
348
362
|
* @param analyticsContext - The analytics context to use.
|
|
349
363
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
350
364
|
*/
|
|
@@ -358,6 +372,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
358
372
|
* Defaults to mockEnvironmentContext.
|
|
359
373
|
*
|
|
360
374
|
* @see mockEnvironmentContext
|
|
375
|
+
* @example
|
|
376
|
+
* ...
|
|
377
|
+
* it("should allow render", async () => {
|
|
378
|
+
* await trackunitProviders().environment(yourPartialEnvironmentsMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
379
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
380
|
+
* });
|
|
381
|
+
* ...
|
|
382
|
+
* @example
|
|
383
|
+
* ...
|
|
384
|
+
* it("should allow renderHook", async () => {
|
|
385
|
+
* const { result } = await trackunitProviders().environment(yourPartialEnvironmentMock).renderHook(() => useYourTestHook());
|
|
386
|
+
* expect(result.current).toEqual(anything());
|
|
387
|
+
* });
|
|
388
|
+
* ...
|
|
361
389
|
* @param environmentContext - The environment context to use.
|
|
362
390
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
363
391
|
*/
|
|
@@ -370,6 +398,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
370
398
|
* Defaults to mockCurrentUserContext.
|
|
371
399
|
*
|
|
372
400
|
* @see mockCurrentUserContext
|
|
401
|
+
* @example
|
|
402
|
+
* ...
|
|
403
|
+
* it("should allow render", async () => {
|
|
404
|
+
* await trackunitProviders().currentUser(yourPartialCurrentUserMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
405
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
406
|
+
* });
|
|
407
|
+
* ...
|
|
408
|
+
* @example
|
|
409
|
+
* ...
|
|
410
|
+
* it("should allow renderHook", async () => {
|
|
411
|
+
* const { result } = await trackunitProviders().currentUser(yourPartialCurrentUserMock).renderHook(() => useYourTestHook());
|
|
412
|
+
* expect(result.current).toEqual(anything());
|
|
413
|
+
* });
|
|
414
|
+
* ...
|
|
373
415
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
374
416
|
*/
|
|
375
417
|
currentUser(currentUserContext) {
|
|
@@ -381,6 +423,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
381
423
|
* Defaults to mockUserSubscriptionContext.
|
|
382
424
|
*
|
|
383
425
|
* @see mockUserSubscriptionContext
|
|
426
|
+
* @example
|
|
427
|
+
* ...
|
|
428
|
+
* it("should allow render", async () => {
|
|
429
|
+
* await trackunitProviders().userSubscription(yourPartialUserSubscriptionMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
430
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
431
|
+
* });
|
|
432
|
+
* ...
|
|
433
|
+
* @example
|
|
434
|
+
* ...
|
|
435
|
+
* it("should allow renderHook", async () => {
|
|
436
|
+
* const { result } = await trackunitProviders().userSubscription(yourPartialUserSubscriptionMock).renderHook(() => useYourTestHook());
|
|
437
|
+
* expect(result.current).toEqual(anything());
|
|
438
|
+
* });
|
|
439
|
+
* ...
|
|
384
440
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
385
441
|
*/
|
|
386
442
|
userSubscription(userSubscription) {
|
|
@@ -400,6 +456,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
400
456
|
* Defaults to mockAssetSortingContext.
|
|
401
457
|
*
|
|
402
458
|
* @see mockAssetSortingContext
|
|
459
|
+
* @example
|
|
460
|
+
* ...
|
|
461
|
+
* it("should allow render", async () => {
|
|
462
|
+
* await trackunitProviders().assetSorting(yourPartialAssetSortingMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
463
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
464
|
+
* });
|
|
465
|
+
* ...
|
|
466
|
+
* @example
|
|
467
|
+
* ...
|
|
468
|
+
* it("should allow renderHook", async () => {
|
|
469
|
+
* const { result } = await trackunitProviders().assetSorting(yourPartialAssetSortingMock).renderHook(() => useYourTestHook());
|
|
470
|
+
* expect(result.current).toEqual(anything());
|
|
471
|
+
* });
|
|
472
|
+
* ...
|
|
403
473
|
* @param assetSortingContext - Override the default context.
|
|
404
474
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
405
475
|
*/
|
|
@@ -412,6 +482,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
412
482
|
* Defaults to mockOemBrandingContext.
|
|
413
483
|
*
|
|
414
484
|
* @see mockOemBrandingContext
|
|
485
|
+
* @example
|
|
486
|
+
* ...
|
|
487
|
+
* it("should allow render", async () => {
|
|
488
|
+
* await trackunitProviders().oemBrandingContext(yourPartialOemBrandingMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
489
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
490
|
+
* });
|
|
491
|
+
* ...
|
|
492
|
+
* @example
|
|
493
|
+
* ...
|
|
494
|
+
* it("should allow renderHook", async () => {
|
|
495
|
+
* const { result } = await trackunitProviders().oemBrandingContext(yourPartialOemBrandingMock).renderHook(() => useYourTestHook());
|
|
496
|
+
* expect(result.current).toEqual(anything());
|
|
497
|
+
* });
|
|
498
|
+
* ...
|
|
415
499
|
* @param oemBrandingContext - Override the default context.
|
|
416
500
|
*/
|
|
417
501
|
oemBrandingContext(oemBrandingContext) {
|
|
@@ -423,6 +507,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
423
507
|
* Defaults to mockToastContext.
|
|
424
508
|
*
|
|
425
509
|
* @see mockToastContext
|
|
510
|
+
* @example
|
|
511
|
+
* ...
|
|
512
|
+
* it("should allow render", async () => {
|
|
513
|
+
* await trackunitProviders().toast(yourPartialToastMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
514
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
515
|
+
* });
|
|
516
|
+
* ...
|
|
517
|
+
* @example
|
|
518
|
+
* ...
|
|
519
|
+
* it("should allow renderHook", async () => {
|
|
520
|
+
* const { result } = await trackunitProviders().toast(yourPartialToastMock).renderHook(() => useYourTestHook());
|
|
521
|
+
* expect(result.current).toEqual(anything());
|
|
522
|
+
* });
|
|
523
|
+
* ...
|
|
426
524
|
* @param toastContext - Override the default toast context.
|
|
427
525
|
*/
|
|
428
526
|
toast(toastContext) {
|
|
@@ -433,6 +531,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
433
531
|
* Use this global selection.
|
|
434
532
|
* Defaults to null.
|
|
435
533
|
*
|
|
534
|
+
* @example
|
|
535
|
+
* ...
|
|
536
|
+
* it("should allow render", async () => {
|
|
537
|
+
* await trackunitProviders().globalSelection(yourGlobalSelectionMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
538
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
539
|
+
* });
|
|
540
|
+
* ...
|
|
541
|
+
* @example
|
|
542
|
+
* ...
|
|
543
|
+
* it("should allow renderHook", async () => {
|
|
544
|
+
* const { result } = await trackunitProviders().globalSelection(yourGlobalSelectionMock).renderHook(() => useYourTestHook());
|
|
545
|
+
* expect(result.current).toEqual(anything());
|
|
546
|
+
* });
|
|
547
|
+
* ...
|
|
436
548
|
* @param globalSelection - The global selection to use.
|
|
437
549
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
438
550
|
*/
|
|
@@ -443,6 +555,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
443
555
|
/**
|
|
444
556
|
* Use this token.
|
|
445
557
|
*
|
|
558
|
+
* @example
|
|
559
|
+
* ...
|
|
560
|
+
* it("should allow render", async () => {
|
|
561
|
+
* await trackunitProviders().token(yourMockedToken).render(<YourTestComponent data-testid="yourTestId" />);
|
|
562
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
563
|
+
* });
|
|
564
|
+
* ...
|
|
565
|
+
* @example
|
|
566
|
+
* ...
|
|
567
|
+
* it("should allow renderHook", async () => {
|
|
568
|
+
* const { result } = await trackunitProviders().token(yourMockedToken).renderHook(() => useYourTestHook());
|
|
569
|
+
* expect(result.current).toEqual(anything());
|
|
570
|
+
* });
|
|
571
|
+
* ...
|
|
446
572
|
* @param token - The token to use.
|
|
447
573
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
448
574
|
*/
|
|
@@ -453,6 +579,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
453
579
|
/**
|
|
454
580
|
* Use this Router Props with the given mocks.
|
|
455
581
|
*
|
|
582
|
+
* @example
|
|
583
|
+
* ...
|
|
584
|
+
* it("should allow render", async () => {
|
|
585
|
+
* await trackunitProviders().routerProps(yourRouterPropsMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
586
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
587
|
+
* });
|
|
588
|
+
* ...
|
|
589
|
+
* @example
|
|
590
|
+
* ...
|
|
591
|
+
* it("should allow renderHook", async () => {
|
|
592
|
+
* const { result } = await trackunitProviders().routerProps(yourRouterPropsMock).renderHook(() => useYourTestHook());
|
|
593
|
+
* expect(result.current).toEqual(anything());
|
|
594
|
+
* });
|
|
595
|
+
* ...
|
|
456
596
|
* @param routerProps - The router props to use.
|
|
457
597
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
458
598
|
*/
|
|
@@ -463,6 +603,21 @@ class TrackunitProvidersMockBuilder {
|
|
|
463
603
|
/**
|
|
464
604
|
* Use this Manager Apollo Context Provider with the given mocks.
|
|
465
605
|
*
|
|
606
|
+
* @see https://www.apollographql.com/docs/react/development-testing/testing
|
|
607
|
+
* @example
|
|
608
|
+
* ...
|
|
609
|
+
* it("should allow render", async () => {
|
|
610
|
+
* await trackunitProviders().apollo([yourApolloMocks]).render(<YourTestComponent data-testid="yourTestId" />);
|
|
611
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
612
|
+
* });
|
|
613
|
+
* ...
|
|
614
|
+
* @example
|
|
615
|
+
* ...
|
|
616
|
+
* it("should allow renderHook", async () => {
|
|
617
|
+
* const { result } = await trackunitProviders().apollo([yourApolloMocks]).renderHook(() => useYourTestHook());
|
|
618
|
+
* expect(result.current).toEqual(anything());
|
|
619
|
+
* });
|
|
620
|
+
* ...
|
|
466
621
|
* @param apolloMocks - The mocks to use for the ApolloProvider.
|
|
467
622
|
*/
|
|
468
623
|
apollo(apolloMocks) {
|
package/index2.js
CHANGED
|
@@ -339,6 +339,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
339
339
|
* Defaults to mockAnalyticsContext.
|
|
340
340
|
*
|
|
341
341
|
* @see mockAnalyticsContext
|
|
342
|
+
* @example
|
|
343
|
+
* ...
|
|
344
|
+
* it("should allow render", async () => {
|
|
345
|
+
* await trackunitProviders().analytics(yourPartialAnalyticsMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
346
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
347
|
+
* });
|
|
348
|
+
* ...
|
|
349
|
+
* @example
|
|
350
|
+
* ...
|
|
351
|
+
* it("should allow renderHook", async () => {
|
|
352
|
+
* const { result } = await trackunitProviders().analytics(yourPartialAnalyticsMock).renderHook(() => useYourTestHook());
|
|
353
|
+
* expect(result.current).toEqual(anything());
|
|
354
|
+
* });
|
|
355
|
+
* ...
|
|
342
356
|
* @param analyticsContext - The analytics context to use.
|
|
343
357
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
344
358
|
*/
|
|
@@ -352,6 +366,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
352
366
|
* Defaults to mockEnvironmentContext.
|
|
353
367
|
*
|
|
354
368
|
* @see mockEnvironmentContext
|
|
369
|
+
* @example
|
|
370
|
+
* ...
|
|
371
|
+
* it("should allow render", async () => {
|
|
372
|
+
* await trackunitProviders().environment(yourPartialEnvironmentsMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
373
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
374
|
+
* });
|
|
375
|
+
* ...
|
|
376
|
+
* @example
|
|
377
|
+
* ...
|
|
378
|
+
* it("should allow renderHook", async () => {
|
|
379
|
+
* const { result } = await trackunitProviders().environment(yourPartialEnvironmentMock).renderHook(() => useYourTestHook());
|
|
380
|
+
* expect(result.current).toEqual(anything());
|
|
381
|
+
* });
|
|
382
|
+
* ...
|
|
355
383
|
* @param environmentContext - The environment context to use.
|
|
356
384
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
357
385
|
*/
|
|
@@ -364,6 +392,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
364
392
|
* Defaults to mockCurrentUserContext.
|
|
365
393
|
*
|
|
366
394
|
* @see mockCurrentUserContext
|
|
395
|
+
* @example
|
|
396
|
+
* ...
|
|
397
|
+
* it("should allow render", async () => {
|
|
398
|
+
* await trackunitProviders().currentUser(yourPartialCurrentUserMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
399
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
400
|
+
* });
|
|
401
|
+
* ...
|
|
402
|
+
* @example
|
|
403
|
+
* ...
|
|
404
|
+
* it("should allow renderHook", async () => {
|
|
405
|
+
* const { result } = await trackunitProviders().currentUser(yourPartialCurrentUserMock).renderHook(() => useYourTestHook());
|
|
406
|
+
* expect(result.current).toEqual(anything());
|
|
407
|
+
* });
|
|
408
|
+
* ...
|
|
367
409
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
368
410
|
*/
|
|
369
411
|
currentUser(currentUserContext) {
|
|
@@ -375,6 +417,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
375
417
|
* Defaults to mockUserSubscriptionContext.
|
|
376
418
|
*
|
|
377
419
|
* @see mockUserSubscriptionContext
|
|
420
|
+
* @example
|
|
421
|
+
* ...
|
|
422
|
+
* it("should allow render", async () => {
|
|
423
|
+
* await trackunitProviders().userSubscription(yourPartialUserSubscriptionMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
424
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
425
|
+
* });
|
|
426
|
+
* ...
|
|
427
|
+
* @example
|
|
428
|
+
* ...
|
|
429
|
+
* it("should allow renderHook", async () => {
|
|
430
|
+
* const { result } = await trackunitProviders().userSubscription(yourPartialUserSubscriptionMock).renderHook(() => useYourTestHook());
|
|
431
|
+
* expect(result.current).toEqual(anything());
|
|
432
|
+
* });
|
|
433
|
+
* ...
|
|
378
434
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
379
435
|
*/
|
|
380
436
|
userSubscription(userSubscription) {
|
|
@@ -394,6 +450,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
394
450
|
* Defaults to mockAssetSortingContext.
|
|
395
451
|
*
|
|
396
452
|
* @see mockAssetSortingContext
|
|
453
|
+
* @example
|
|
454
|
+
* ...
|
|
455
|
+
* it("should allow render", async () => {
|
|
456
|
+
* await trackunitProviders().assetSorting(yourPartialAssetSortingMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
457
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
458
|
+
* });
|
|
459
|
+
* ...
|
|
460
|
+
* @example
|
|
461
|
+
* ...
|
|
462
|
+
* it("should allow renderHook", async () => {
|
|
463
|
+
* const { result } = await trackunitProviders().assetSorting(yourPartialAssetSortingMock).renderHook(() => useYourTestHook());
|
|
464
|
+
* expect(result.current).toEqual(anything());
|
|
465
|
+
* });
|
|
466
|
+
* ...
|
|
397
467
|
* @param assetSortingContext - Override the default context.
|
|
398
468
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
399
469
|
*/
|
|
@@ -406,6 +476,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
406
476
|
* Defaults to mockOemBrandingContext.
|
|
407
477
|
*
|
|
408
478
|
* @see mockOemBrandingContext
|
|
479
|
+
* @example
|
|
480
|
+
* ...
|
|
481
|
+
* it("should allow render", async () => {
|
|
482
|
+
* await trackunitProviders().oemBrandingContext(yourPartialOemBrandingMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
483
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
484
|
+
* });
|
|
485
|
+
* ...
|
|
486
|
+
* @example
|
|
487
|
+
* ...
|
|
488
|
+
* it("should allow renderHook", async () => {
|
|
489
|
+
* const { result } = await trackunitProviders().oemBrandingContext(yourPartialOemBrandingMock).renderHook(() => useYourTestHook());
|
|
490
|
+
* expect(result.current).toEqual(anything());
|
|
491
|
+
* });
|
|
492
|
+
* ...
|
|
409
493
|
* @param oemBrandingContext - Override the default context.
|
|
410
494
|
*/
|
|
411
495
|
oemBrandingContext(oemBrandingContext) {
|
|
@@ -417,6 +501,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
417
501
|
* Defaults to mockToastContext.
|
|
418
502
|
*
|
|
419
503
|
* @see mockToastContext
|
|
504
|
+
* @example
|
|
505
|
+
* ...
|
|
506
|
+
* it("should allow render", async () => {
|
|
507
|
+
* await trackunitProviders().toast(yourPartialToastMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
508
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
509
|
+
* });
|
|
510
|
+
* ...
|
|
511
|
+
* @example
|
|
512
|
+
* ...
|
|
513
|
+
* it("should allow renderHook", async () => {
|
|
514
|
+
* const { result } = await trackunitProviders().toast(yourPartialToastMock).renderHook(() => useYourTestHook());
|
|
515
|
+
* expect(result.current).toEqual(anything());
|
|
516
|
+
* });
|
|
517
|
+
* ...
|
|
420
518
|
* @param toastContext - Override the default toast context.
|
|
421
519
|
*/
|
|
422
520
|
toast(toastContext) {
|
|
@@ -427,6 +525,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
427
525
|
* Use this global selection.
|
|
428
526
|
* Defaults to null.
|
|
429
527
|
*
|
|
528
|
+
* @example
|
|
529
|
+
* ...
|
|
530
|
+
* it("should allow render", async () => {
|
|
531
|
+
* await trackunitProviders().globalSelection(yourGlobalSelectionMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
532
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
533
|
+
* });
|
|
534
|
+
* ...
|
|
535
|
+
* @example
|
|
536
|
+
* ...
|
|
537
|
+
* it("should allow renderHook", async () => {
|
|
538
|
+
* const { result } = await trackunitProviders().globalSelection(yourGlobalSelectionMock).renderHook(() => useYourTestHook());
|
|
539
|
+
* expect(result.current).toEqual(anything());
|
|
540
|
+
* });
|
|
541
|
+
* ...
|
|
430
542
|
* @param globalSelection - The global selection to use.
|
|
431
543
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
432
544
|
*/
|
|
@@ -437,6 +549,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
437
549
|
/**
|
|
438
550
|
* Use this token.
|
|
439
551
|
*
|
|
552
|
+
* @example
|
|
553
|
+
* ...
|
|
554
|
+
* it("should allow render", async () => {
|
|
555
|
+
* await trackunitProviders().token(yourMockedToken).render(<YourTestComponent data-testid="yourTestId" />);
|
|
556
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
557
|
+
* });
|
|
558
|
+
* ...
|
|
559
|
+
* @example
|
|
560
|
+
* ...
|
|
561
|
+
* it("should allow renderHook", async () => {
|
|
562
|
+
* const { result } = await trackunitProviders().token(yourMockedToken).renderHook(() => useYourTestHook());
|
|
563
|
+
* expect(result.current).toEqual(anything());
|
|
564
|
+
* });
|
|
565
|
+
* ...
|
|
440
566
|
* @param token - The token to use.
|
|
441
567
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
442
568
|
*/
|
|
@@ -447,6 +573,20 @@ class TrackunitProvidersMockBuilder {
|
|
|
447
573
|
/**
|
|
448
574
|
* Use this Router Props with the given mocks.
|
|
449
575
|
*
|
|
576
|
+
* @example
|
|
577
|
+
* ...
|
|
578
|
+
* it("should allow render", async () => {
|
|
579
|
+
* await trackunitProviders().routerProps(yourRouterPropsMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
580
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
581
|
+
* });
|
|
582
|
+
* ...
|
|
583
|
+
* @example
|
|
584
|
+
* ...
|
|
585
|
+
* it("should allow renderHook", async () => {
|
|
586
|
+
* const { result } = await trackunitProviders().routerProps(yourRouterPropsMock).renderHook(() => useYourTestHook());
|
|
587
|
+
* expect(result.current).toEqual(anything());
|
|
588
|
+
* });
|
|
589
|
+
* ...
|
|
450
590
|
* @param routerProps - The router props to use.
|
|
451
591
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
452
592
|
*/
|
|
@@ -457,6 +597,21 @@ class TrackunitProvidersMockBuilder {
|
|
|
457
597
|
/**
|
|
458
598
|
* Use this Manager Apollo Context Provider with the given mocks.
|
|
459
599
|
*
|
|
600
|
+
* @see https://www.apollographql.com/docs/react/development-testing/testing
|
|
601
|
+
* @example
|
|
602
|
+
* ...
|
|
603
|
+
* it("should allow render", async () => {
|
|
604
|
+
* await trackunitProviders().apollo([yourApolloMocks]).render(<YourTestComponent data-testid="yourTestId" />);
|
|
605
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
606
|
+
* });
|
|
607
|
+
* ...
|
|
608
|
+
* @example
|
|
609
|
+
* ...
|
|
610
|
+
* it("should allow renderHook", async () => {
|
|
611
|
+
* const { result } = await trackunitProviders().apollo([yourApolloMocks]).renderHook(() => useYourTestHook());
|
|
612
|
+
* expect(result.current).toEqual(anything());
|
|
613
|
+
* });
|
|
614
|
+
* ...
|
|
460
615
|
* @param apolloMocks - The mocks to use for the ApolloProvider.
|
|
461
616
|
*/
|
|
462
617
|
apollo(apolloMocks) {
|
package/package.json
CHANGED
|
@@ -29,6 +29,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
29
29
|
* Defaults to mockAnalyticsContext.
|
|
30
30
|
*
|
|
31
31
|
* @see mockAnalyticsContext
|
|
32
|
+
* @example
|
|
33
|
+
* ...
|
|
34
|
+
* it("should allow render", async () => {
|
|
35
|
+
* await trackunitProviders().analytics(yourPartialAnalyticsMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
36
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
37
|
+
* });
|
|
38
|
+
* ...
|
|
39
|
+
* @example
|
|
40
|
+
* ...
|
|
41
|
+
* it("should allow renderHook", async () => {
|
|
42
|
+
* const { result } = await trackunitProviders().analytics(yourPartialAnalyticsMock).renderHook(() => useYourTestHook());
|
|
43
|
+
* expect(result.current).toEqual(anything());
|
|
44
|
+
* });
|
|
45
|
+
* ...
|
|
32
46
|
* @param analyticsContext - The analytics context to use.
|
|
33
47
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
34
48
|
*/
|
|
@@ -38,6 +52,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
38
52
|
* Defaults to mockEnvironmentContext.
|
|
39
53
|
*
|
|
40
54
|
* @see mockEnvironmentContext
|
|
55
|
+
* @example
|
|
56
|
+
* ...
|
|
57
|
+
* it("should allow render", async () => {
|
|
58
|
+
* await trackunitProviders().environment(yourPartialEnvironmentsMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
59
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
60
|
+
* });
|
|
61
|
+
* ...
|
|
62
|
+
* @example
|
|
63
|
+
* ...
|
|
64
|
+
* it("should allow renderHook", async () => {
|
|
65
|
+
* const { result } = await trackunitProviders().environment(yourPartialEnvironmentMock).renderHook(() => useYourTestHook());
|
|
66
|
+
* expect(result.current).toEqual(anything());
|
|
67
|
+
* });
|
|
68
|
+
* ...
|
|
41
69
|
* @param environmentContext - The environment context to use.
|
|
42
70
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
43
71
|
*/
|
|
@@ -47,6 +75,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
47
75
|
* Defaults to mockCurrentUserContext.
|
|
48
76
|
*
|
|
49
77
|
* @see mockCurrentUserContext
|
|
78
|
+
* @example
|
|
79
|
+
* ...
|
|
80
|
+
* it("should allow render", async () => {
|
|
81
|
+
* await trackunitProviders().currentUser(yourPartialCurrentUserMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
82
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
83
|
+
* });
|
|
84
|
+
* ...
|
|
85
|
+
* @example
|
|
86
|
+
* ...
|
|
87
|
+
* it("should allow renderHook", async () => {
|
|
88
|
+
* const { result } = await trackunitProviders().currentUser(yourPartialCurrentUserMock).renderHook(() => useYourTestHook());
|
|
89
|
+
* expect(result.current).toEqual(anything());
|
|
90
|
+
* });
|
|
91
|
+
* ...
|
|
50
92
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
51
93
|
*/
|
|
52
94
|
currentUser(currentUserContext: Partial<ICurrentUserContext>): this;
|
|
@@ -55,6 +97,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
55
97
|
* Defaults to mockUserSubscriptionContext.
|
|
56
98
|
*
|
|
57
99
|
* @see mockUserSubscriptionContext
|
|
100
|
+
* @example
|
|
101
|
+
* ...
|
|
102
|
+
* it("should allow render", async () => {
|
|
103
|
+
* await trackunitProviders().userSubscription(yourPartialUserSubscriptionMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
104
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
105
|
+
* });
|
|
106
|
+
* ...
|
|
107
|
+
* @example
|
|
108
|
+
* ...
|
|
109
|
+
* it("should allow renderHook", async () => {
|
|
110
|
+
* const { result } = await trackunitProviders().userSubscription(yourPartialUserSubscriptionMock).renderHook(() => useYourTestHook());
|
|
111
|
+
* expect(result.current).toEqual(anything());
|
|
112
|
+
* });
|
|
113
|
+
* ...
|
|
58
114
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
59
115
|
*/
|
|
60
116
|
userSubscription(userSubscription: Partial<IUserSubscriptionContext> | {
|
|
@@ -65,6 +121,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
65
121
|
* Defaults to mockAssetSortingContext.
|
|
66
122
|
*
|
|
67
123
|
* @see mockAssetSortingContext
|
|
124
|
+
* @example
|
|
125
|
+
* ...
|
|
126
|
+
* it("should allow render", async () => {
|
|
127
|
+
* await trackunitProviders().assetSorting(yourPartialAssetSortingMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
128
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
129
|
+
* });
|
|
130
|
+
* ...
|
|
131
|
+
* @example
|
|
132
|
+
* ...
|
|
133
|
+
* it("should allow renderHook", async () => {
|
|
134
|
+
* const { result } = await trackunitProviders().assetSorting(yourPartialAssetSortingMock).renderHook(() => useYourTestHook());
|
|
135
|
+
* expect(result.current).toEqual(anything());
|
|
136
|
+
* });
|
|
137
|
+
* ...
|
|
68
138
|
* @param assetSortingContext - Override the default context.
|
|
69
139
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
70
140
|
*/
|
|
@@ -74,6 +144,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
74
144
|
* Defaults to mockOemBrandingContext.
|
|
75
145
|
*
|
|
76
146
|
* @see mockOemBrandingContext
|
|
147
|
+
* @example
|
|
148
|
+
* ...
|
|
149
|
+
* it("should allow render", async () => {
|
|
150
|
+
* await trackunitProviders().oemBrandingContext(yourPartialOemBrandingMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
151
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
152
|
+
* });
|
|
153
|
+
* ...
|
|
154
|
+
* @example
|
|
155
|
+
* ...
|
|
156
|
+
* it("should allow renderHook", async () => {
|
|
157
|
+
* const { result } = await trackunitProviders().oemBrandingContext(yourPartialOemBrandingMock).renderHook(() => useYourTestHook());
|
|
158
|
+
* expect(result.current).toEqual(anything());
|
|
159
|
+
* });
|
|
160
|
+
* ...
|
|
77
161
|
* @param oemBrandingContext - Override the default context.
|
|
78
162
|
*/
|
|
79
163
|
oemBrandingContext(oemBrandingContext: Partial<IOemBrandingContext>): this;
|
|
@@ -82,6 +166,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
82
166
|
* Defaults to mockToastContext.
|
|
83
167
|
*
|
|
84
168
|
* @see mockToastContext
|
|
169
|
+
* @example
|
|
170
|
+
* ...
|
|
171
|
+
* it("should allow render", async () => {
|
|
172
|
+
* await trackunitProviders().toast(yourPartialToastMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
173
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
174
|
+
* });
|
|
175
|
+
* ...
|
|
176
|
+
* @example
|
|
177
|
+
* ...
|
|
178
|
+
* it("should allow renderHook", async () => {
|
|
179
|
+
* const { result } = await trackunitProviders().toast(yourPartialToastMock).renderHook(() => useYourTestHook());
|
|
180
|
+
* expect(result.current).toEqual(anything());
|
|
181
|
+
* });
|
|
182
|
+
* ...
|
|
85
183
|
* @param toastContext - Override the default toast context.
|
|
86
184
|
*/
|
|
87
185
|
toast(toastContext: Partial<IToastContext>): this;
|
|
@@ -89,6 +187,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
89
187
|
* Use this global selection.
|
|
90
188
|
* Defaults to null.
|
|
91
189
|
*
|
|
190
|
+
* @example
|
|
191
|
+
* ...
|
|
192
|
+
* it("should allow render", async () => {
|
|
193
|
+
* await trackunitProviders().globalSelection(yourGlobalSelectionMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
194
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
195
|
+
* });
|
|
196
|
+
* ...
|
|
197
|
+
* @example
|
|
198
|
+
* ...
|
|
199
|
+
* it("should allow renderHook", async () => {
|
|
200
|
+
* const { result } = await trackunitProviders().globalSelection(yourGlobalSelectionMock).renderHook(() => useYourTestHook());
|
|
201
|
+
* expect(result.current).toEqual(anything());
|
|
202
|
+
* });
|
|
203
|
+
* ...
|
|
92
204
|
* @param globalSelection - The global selection to use.
|
|
93
205
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
94
206
|
*/
|
|
@@ -96,6 +208,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
96
208
|
/**
|
|
97
209
|
* Use this token.
|
|
98
210
|
*
|
|
211
|
+
* @example
|
|
212
|
+
* ...
|
|
213
|
+
* it("should allow render", async () => {
|
|
214
|
+
* await trackunitProviders().token(yourMockedToken).render(<YourTestComponent data-testid="yourTestId" />);
|
|
215
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
216
|
+
* });
|
|
217
|
+
* ...
|
|
218
|
+
* @example
|
|
219
|
+
* ...
|
|
220
|
+
* it("should allow renderHook", async () => {
|
|
221
|
+
* const { result } = await trackunitProviders().token(yourMockedToken).renderHook(() => useYourTestHook());
|
|
222
|
+
* expect(result.current).toEqual(anything());
|
|
223
|
+
* });
|
|
224
|
+
* ...
|
|
99
225
|
* @param token - The token to use.
|
|
100
226
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
101
227
|
*/
|
|
@@ -103,6 +229,20 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
103
229
|
/**
|
|
104
230
|
* Use this Router Props with the given mocks.
|
|
105
231
|
*
|
|
232
|
+
* @example
|
|
233
|
+
* ...
|
|
234
|
+
* it("should allow render", async () => {
|
|
235
|
+
* await trackunitProviders().routerProps(yourRouterPropsMock).render(<YourTestComponent data-testid="yourTestId" />);
|
|
236
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
237
|
+
* });
|
|
238
|
+
* ...
|
|
239
|
+
* @example
|
|
240
|
+
* ...
|
|
241
|
+
* it("should allow renderHook", async () => {
|
|
242
|
+
* const { result } = await trackunitProviders().routerProps(yourRouterPropsMock).renderHook(() => useYourTestHook());
|
|
243
|
+
* expect(result.current).toEqual(anything());
|
|
244
|
+
* });
|
|
245
|
+
* ...
|
|
106
246
|
* @param routerProps - The router props to use.
|
|
107
247
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
108
248
|
*/
|
|
@@ -110,6 +250,21 @@ export declare class TrackunitProvidersMockBuilder {
|
|
|
110
250
|
/**
|
|
111
251
|
* Use this Manager Apollo Context Provider with the given mocks.
|
|
112
252
|
*
|
|
253
|
+
* @see https://www.apollographql.com/docs/react/development-testing/testing
|
|
254
|
+
* @example
|
|
255
|
+
* ...
|
|
256
|
+
* it("should allow render", async () => {
|
|
257
|
+
* await trackunitProviders().apollo([yourApolloMocks]).render(<YourTestComponent data-testid="yourTestId" />);
|
|
258
|
+
* expect(screen.getByTestId("yourTestId")).toBeInTheDocument();
|
|
259
|
+
* });
|
|
260
|
+
* ...
|
|
261
|
+
* @example
|
|
262
|
+
* ...
|
|
263
|
+
* it("should allow renderHook", async () => {
|
|
264
|
+
* const { result } = await trackunitProviders().apollo([yourApolloMocks]).renderHook(() => useYourTestHook());
|
|
265
|
+
* expect(result.current).toEqual(anything());
|
|
266
|
+
* });
|
|
267
|
+
* ...
|
|
113
268
|
* @param apolloMocks - The mocks to use for the ApolloProvider.
|
|
114
269
|
*/
|
|
115
270
|
apollo(apolloMocks?: MockedResponse[]): this;
|