@genesislcap/foundation-testing 10.3.1 → 11.3.0
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/README.md +1 -1
- package/dist/dts/playwright/setup.d.ts.map +1 -1
- package/dist/dts/playwright/test.d.ts +32 -5
- package/dist/dts/playwright/test.d.ts.map +1 -1
- package/dist/dts/suite/suite.d.ts +8 -1
- package/dist/dts/suite/suite.d.ts.map +1 -1
- package/dist/dts/utils/harness.d.ts +75 -0
- package/dist/dts/utils/harness.d.ts.map +1 -0
- package/dist/dts/utils/index.d.ts +2 -0
- package/dist/dts/utils/index.d.ts.map +1 -1
- package/dist/dts/utils/types.d.ts +11 -0
- package/dist/dts/utils/types.d.ts.map +1 -0
- package/dist/esm/component/fixture.js +0 -1
- package/dist/esm/component/index.js +0 -1
- package/dist/esm/index.federated.js +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/jsdom/setup.js +0 -1
- package/dist/esm/playwright/index.js +0 -1
- package/dist/esm/playwright/setup.js +5 -1
- package/dist/esm/playwright/test.js +42 -13
- package/dist/esm/suite/index.js +0 -1
- package/dist/esm/suite/suite.js +1 -2
- package/dist/esm/utils/harness.js +55 -0
- package/dist/esm/utils/index.js +2 -1
- package/dist/esm/utils/logger.js +0 -1
- package/dist/esm/utils/types.js +2 -0
- package/dist/esm/uvu/index.js +0 -1
- package/dist/esm/uvu/uvu.js +0 -1
- package/dist/foundation-testing.api.json +506 -0
- package/dist/foundation-testing.d.ts +100 -0
- package/docs/api/foundation-testing.equal.md +13 -0
- package/docs/api/foundation-testing.expect.md +13 -0
- package/docs/api/foundation-testing.filterconditionally.md +15 -0
- package/docs/api/foundation-testing.md +9 -0
- package/docs/api/foundation-testing.resettestharness.md +24 -0
- package/docs/api/foundation-testing.sinonwrapper.md +17 -0
- package/docs/api/foundation-testing.spiedfunctions.md +15 -0
- package/docs/api/foundation-testing.suitecallback.md +15 -0
- package/docs/api/foundation-testing.testspy.md +38 -0
- package/docs/api/foundation-testing.withtestharness.md +17 -0
- package/docs/api-report.md +123 -87
- package/package.json +12 -7
- package/dist/1.0.0.remoteEntry.js +0 -1
- package/dist/191.0099ca6c24422254d51d36c222dc6023.js.map +0 -1
- package/dist/191.191.613504f8a55556ba573c.js +0 -2
- package/dist/259.1ff0e7689abdc0527a57f2eb20369ada.js.map +0 -1
- package/dist/259.259.724449a74ba114ef0d82.js +0 -2
- package/dist/415.32cf4cabeed75f5d759d12434a4de5c7.js.map +0 -1
- package/dist/415.415.ee8e35767118401bccab.js +0 -3
- package/dist/415.415.ee8e35767118401bccab.js.LICENSE.txt +0 -4
- package/dist/623.1b885cabcffad0807eeb0de7ad5dd497.js.map +0 -1
- package/dist/623.623.148af50848667bfda381.js +0 -3
- package/dist/623.623.148af50848667bfda381.js.LICENSE.txt +0 -4
- package/dist/755.497b49c90948bc3e157823cb2632c52a.js.map +0 -1
- package/dist/755.755.5f9603173373118bd373.js +0 -2
- package/dist/772.1d442e2541aac79f2c1091cc41a66926.js.map +0 -1
- package/dist/772.772.76d81e3af1ce835f1f47.js +0 -2
- package/dist/dashboard.json +0 -1
- package/dist/esm/component/fixture.js.map +0 -1
- package/dist/esm/component/index.js.map +0 -1
- package/dist/esm/index.federated.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/jsdom/setup.js.map +0 -1
- package/dist/esm/playwright/index.js.map +0 -1
- package/dist/esm/playwright/setup.js.map +0 -1
- package/dist/esm/playwright/test.js.map +0 -1
- package/dist/esm/suite/index.js.map +0 -1
- package/dist/esm/suite/suite.js.map +0 -1
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/logger.js.map +0 -1
- package/dist/esm/uvu/index.js.map +0 -1
- package/dist/esm/uvu/uvu.js.map +0 -1
- package/dist/favicon.ico +0 -0
- package/dist/foundation-testing.iife.min.js +0 -15
- package/dist/foundation-testing.js +0 -6991
- package/dist/foundation-testing.min.js +0 -15
- package/dist/foundationTesting.f38614af33c4c4be86b1918f8d126cd9.js.map +0 -1
- package/dist/index.ejs +0 -23
- package/dist/index.html +0 -14
- package/dist/info.ejs +0 -13
- package/dist/main.484382eb648d01b1b33d.js +0 -2
- package/dist/main.f58a8d7f17348e63bf4abb67acf3e598.js.map +0 -1
- package/dist/npm.consola.713.2f64f3cac7864c3b4057.js +0 -2
- package/dist/npm.consola.8813a44257414a02ed3be5608793f087.js.map +0 -1
- package/dist/npm.diff.83d06b572c2ee1bd4957fc9f121bf65a.js.map +0 -1
- package/dist/npm.diff.852.9166591dbfda57fefcc7.js +0 -2
- package/dist/npm.microsoft.127.8c2d0309b2c5ee49f9ed.js +0 -1469
- package/dist/npm.microsoft.127.8c2d0309b2c5ee49f9ed.js.LICENSE.txt +0 -14
- package/dist/npm.microsoft.53571229b0cfc6a6b1b069cfe9a8483d.js.map +0 -1
- package/dist/remoteEntry.js +0 -2
- package/dist/serve.json +0 -3
|
@@ -580,6 +580,158 @@
|
|
|
580
580
|
"endIndex": 8
|
|
581
581
|
}
|
|
582
582
|
},
|
|
583
|
+
{
|
|
584
|
+
"kind": "TypeAlias",
|
|
585
|
+
"canonicalReference": "@genesislcap/foundation-testing!Equal:type",
|
|
586
|
+
"docComment": "/**\n * Expects that the type parameter X is equal to Y, returning true or false\n *\n * @public\n */\n",
|
|
587
|
+
"excerptTokens": [
|
|
588
|
+
{
|
|
589
|
+
"kind": "Content",
|
|
590
|
+
"text": "export type Equal<X, Y> = "
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
"kind": "Content",
|
|
594
|
+
"text": "(<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"kind": "Content",
|
|
598
|
+
"text": ";"
|
|
599
|
+
}
|
|
600
|
+
],
|
|
601
|
+
"fileUrlPath": "src/utils/types.ts",
|
|
602
|
+
"releaseTag": "Public",
|
|
603
|
+
"name": "Equal",
|
|
604
|
+
"typeParameters": [
|
|
605
|
+
{
|
|
606
|
+
"typeParameterName": "X",
|
|
607
|
+
"constraintTokenRange": {
|
|
608
|
+
"startIndex": 0,
|
|
609
|
+
"endIndex": 0
|
|
610
|
+
},
|
|
611
|
+
"defaultTypeTokenRange": {
|
|
612
|
+
"startIndex": 0,
|
|
613
|
+
"endIndex": 0
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"typeParameterName": "Y",
|
|
618
|
+
"constraintTokenRange": {
|
|
619
|
+
"startIndex": 0,
|
|
620
|
+
"endIndex": 0
|
|
621
|
+
},
|
|
622
|
+
"defaultTypeTokenRange": {
|
|
623
|
+
"startIndex": 0,
|
|
624
|
+
"endIndex": 0
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
],
|
|
628
|
+
"typeTokenRange": {
|
|
629
|
+
"startIndex": 1,
|
|
630
|
+
"endIndex": 2
|
|
631
|
+
}
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
"kind": "TypeAlias",
|
|
635
|
+
"canonicalReference": "@genesislcap/foundation-testing!Expect:type",
|
|
636
|
+
"docComment": "/**\n * Expects that the type parameter T resolves to true, or will be a typescript error\n *\n * @public\n */\n",
|
|
637
|
+
"excerptTokens": [
|
|
638
|
+
{
|
|
639
|
+
"kind": "Content",
|
|
640
|
+
"text": "export type Expect<T extends "
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
"kind": "Content",
|
|
644
|
+
"text": "true"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
"kind": "Content",
|
|
648
|
+
"text": "> = "
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
"kind": "Content",
|
|
652
|
+
"text": "T"
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"kind": "Content",
|
|
656
|
+
"text": ";"
|
|
657
|
+
}
|
|
658
|
+
],
|
|
659
|
+
"fileUrlPath": "src/utils/types.ts",
|
|
660
|
+
"releaseTag": "Public",
|
|
661
|
+
"name": "Expect",
|
|
662
|
+
"typeParameters": [
|
|
663
|
+
{
|
|
664
|
+
"typeParameterName": "T",
|
|
665
|
+
"constraintTokenRange": {
|
|
666
|
+
"startIndex": 1,
|
|
667
|
+
"endIndex": 2
|
|
668
|
+
},
|
|
669
|
+
"defaultTypeTokenRange": {
|
|
670
|
+
"startIndex": 0,
|
|
671
|
+
"endIndex": 0
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
],
|
|
675
|
+
"typeTokenRange": {
|
|
676
|
+
"startIndex": 3,
|
|
677
|
+
"endIndex": 4
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"kind": "TypeAlias",
|
|
682
|
+
"canonicalReference": "@genesislcap/foundation-testing!FilterConditionally:type",
|
|
683
|
+
"docComment": "/**\n * Filters out key/value pairs from an object where they value does not match a condition\n *\n * @public\n */\n",
|
|
684
|
+
"excerptTokens": [
|
|
685
|
+
{
|
|
686
|
+
"kind": "Content",
|
|
687
|
+
"text": "export type FilterConditionally<Source, Condition> = "
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
"kind": "Reference",
|
|
691
|
+
"text": "Pick",
|
|
692
|
+
"canonicalReference": "!Pick:type"
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
"kind": "Content",
|
|
696
|
+
"text": "<Source, {\n [K in keyof Source]: Source[K] extends Condition ? K : never;\n}[keyof Source]>"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"kind": "Content",
|
|
700
|
+
"text": ";"
|
|
701
|
+
}
|
|
702
|
+
],
|
|
703
|
+
"fileUrlPath": "src/utils/harness.ts",
|
|
704
|
+
"releaseTag": "Public",
|
|
705
|
+
"name": "FilterConditionally",
|
|
706
|
+
"typeParameters": [
|
|
707
|
+
{
|
|
708
|
+
"typeParameterName": "Source",
|
|
709
|
+
"constraintTokenRange": {
|
|
710
|
+
"startIndex": 0,
|
|
711
|
+
"endIndex": 0
|
|
712
|
+
},
|
|
713
|
+
"defaultTypeTokenRange": {
|
|
714
|
+
"startIndex": 0,
|
|
715
|
+
"endIndex": 0
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"typeParameterName": "Condition",
|
|
720
|
+
"constraintTokenRange": {
|
|
721
|
+
"startIndex": 0,
|
|
722
|
+
"endIndex": 0
|
|
723
|
+
},
|
|
724
|
+
"defaultTypeTokenRange": {
|
|
725
|
+
"startIndex": 0,
|
|
726
|
+
"endIndex": 0
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
],
|
|
730
|
+
"typeTokenRange": {
|
|
731
|
+
"startIndex": 1,
|
|
732
|
+
"endIndex": 3
|
|
733
|
+
}
|
|
734
|
+
},
|
|
583
735
|
{
|
|
584
736
|
"kind": "Function",
|
|
585
737
|
"canonicalReference": "@genesislcap/foundation-testing!fixture:function(1)",
|
|
@@ -1281,6 +1433,360 @@
|
|
|
1281
1433
|
}
|
|
1282
1434
|
],
|
|
1283
1435
|
"extendsTokenRanges": []
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
"kind": "Function",
|
|
1439
|
+
"canonicalReference": "@genesislcap/foundation-testing!resetTestHarness:function(1)",
|
|
1440
|
+
"docComment": "/**\n * Resets items tracked during testing such as calls to spied functions. Must be called at the end of every test even if not asserting on the spies.\n *\n * @param wrapper - `WithTestHarness<T>` object to reset\n *\n * @public\n */\n",
|
|
1441
|
+
"excerptTokens": [
|
|
1442
|
+
{
|
|
1443
|
+
"kind": "Content",
|
|
1444
|
+
"text": "export declare function resetTestHarness<T>(wrapper: "
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
"kind": "Reference",
|
|
1448
|
+
"text": "WithTestHarness",
|
|
1449
|
+
"canonicalReference": "@genesislcap/foundation-testing!WithTestHarness:type"
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
"kind": "Content",
|
|
1453
|
+
"text": "<T>"
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
"kind": "Content",
|
|
1457
|
+
"text": "): "
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
"kind": "Content",
|
|
1461
|
+
"text": "void"
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
"kind": "Content",
|
|
1465
|
+
"text": ";"
|
|
1466
|
+
}
|
|
1467
|
+
],
|
|
1468
|
+
"fileUrlPath": "src/utils/harness.ts",
|
|
1469
|
+
"returnTypeTokenRange": {
|
|
1470
|
+
"startIndex": 4,
|
|
1471
|
+
"endIndex": 5
|
|
1472
|
+
},
|
|
1473
|
+
"releaseTag": "Public",
|
|
1474
|
+
"overloadIndex": 1,
|
|
1475
|
+
"parameters": [
|
|
1476
|
+
{
|
|
1477
|
+
"parameterName": "wrapper",
|
|
1478
|
+
"parameterTypeTokenRange": {
|
|
1479
|
+
"startIndex": 1,
|
|
1480
|
+
"endIndex": 3
|
|
1481
|
+
},
|
|
1482
|
+
"isOptional": false
|
|
1483
|
+
}
|
|
1484
|
+
],
|
|
1485
|
+
"typeParameters": [
|
|
1486
|
+
{
|
|
1487
|
+
"typeParameterName": "T",
|
|
1488
|
+
"constraintTokenRange": {
|
|
1489
|
+
"startIndex": 0,
|
|
1490
|
+
"endIndex": 0
|
|
1491
|
+
},
|
|
1492
|
+
"defaultTypeTokenRange": {
|
|
1493
|
+
"startIndex": 0,
|
|
1494
|
+
"endIndex": 0
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
],
|
|
1498
|
+
"name": "resetTestHarness"
|
|
1499
|
+
},
|
|
1500
|
+
{
|
|
1501
|
+
"kind": "TypeAlias",
|
|
1502
|
+
"canonicalReference": "@genesislcap/foundation-testing!SinonWrapper:type",
|
|
1503
|
+
"docComment": "/**\n * Crates an object with a key value pair for each spied function where the key is the function name and the value is the sinon wrapped spy function\n *\n * @typeParam T - object with keys where values are functions\n *\n * @public\n */\n",
|
|
1504
|
+
"excerptTokens": [
|
|
1505
|
+
{
|
|
1506
|
+
"kind": "Content",
|
|
1507
|
+
"text": "export type SinonWrapper<T extends "
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
"kind": "Content",
|
|
1511
|
+
"text": "{\n [K in keyof T]: (...args: any) => any;\n}"
|
|
1512
|
+
},
|
|
1513
|
+
{
|
|
1514
|
+
"kind": "Content",
|
|
1515
|
+
"text": "> = "
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
"kind": "Content",
|
|
1519
|
+
"text": "{\n [K in keyof T]: "
|
|
1520
|
+
},
|
|
1521
|
+
{
|
|
1522
|
+
"kind": "Reference",
|
|
1523
|
+
"text": "sinon.SinonSpy",
|
|
1524
|
+
"canonicalReference": "@types/sinon!Sinon.SinonSpy:interface"
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
"kind": "Content",
|
|
1528
|
+
"text": "<"
|
|
1529
|
+
},
|
|
1530
|
+
{
|
|
1531
|
+
"kind": "Reference",
|
|
1532
|
+
"text": "Parameters",
|
|
1533
|
+
"canonicalReference": "!Parameters:type"
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
"kind": "Content",
|
|
1537
|
+
"text": "<T[K]>, "
|
|
1538
|
+
},
|
|
1539
|
+
{
|
|
1540
|
+
"kind": "Reference",
|
|
1541
|
+
"text": "ReturnType",
|
|
1542
|
+
"canonicalReference": "!ReturnType:type"
|
|
1543
|
+
},
|
|
1544
|
+
{
|
|
1545
|
+
"kind": "Content",
|
|
1546
|
+
"text": "<T[K]>>;\n}"
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
"kind": "Content",
|
|
1550
|
+
"text": ";"
|
|
1551
|
+
}
|
|
1552
|
+
],
|
|
1553
|
+
"fileUrlPath": "src/utils/harness.ts",
|
|
1554
|
+
"releaseTag": "Public",
|
|
1555
|
+
"name": "SinonWrapper",
|
|
1556
|
+
"typeParameters": [
|
|
1557
|
+
{
|
|
1558
|
+
"typeParameterName": "T",
|
|
1559
|
+
"constraintTokenRange": {
|
|
1560
|
+
"startIndex": 1,
|
|
1561
|
+
"endIndex": 2
|
|
1562
|
+
},
|
|
1563
|
+
"defaultTypeTokenRange": {
|
|
1564
|
+
"startIndex": 0,
|
|
1565
|
+
"endIndex": 0
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
],
|
|
1569
|
+
"typeTokenRange": {
|
|
1570
|
+
"startIndex": 3,
|
|
1571
|
+
"endIndex": 10
|
|
1572
|
+
}
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
"kind": "TypeAlias",
|
|
1576
|
+
"canonicalReference": "@genesislcap/foundation-testing!SpiedFunctions:type",
|
|
1577
|
+
"docComment": "/**\n * Filters out all key/value pairs which are not functions, and omits the constructor\n *\n * @public\n */\n",
|
|
1578
|
+
"excerptTokens": [
|
|
1579
|
+
{
|
|
1580
|
+
"kind": "Content",
|
|
1581
|
+
"text": "export type SpiedFunctions<T> = "
|
|
1582
|
+
},
|
|
1583
|
+
{
|
|
1584
|
+
"kind": "Reference",
|
|
1585
|
+
"text": "Omit",
|
|
1586
|
+
"canonicalReference": "!Omit:type"
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
"kind": "Content",
|
|
1590
|
+
"text": "<"
|
|
1591
|
+
},
|
|
1592
|
+
{
|
|
1593
|
+
"kind": "Reference",
|
|
1594
|
+
"text": "FilterConditionally",
|
|
1595
|
+
"canonicalReference": "@genesislcap/foundation-testing!FilterConditionally:type"
|
|
1596
|
+
},
|
|
1597
|
+
{
|
|
1598
|
+
"kind": "Content",
|
|
1599
|
+
"text": "<T, (...args: any[]) => any>, 'constructor'>"
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
"kind": "Content",
|
|
1603
|
+
"text": ";"
|
|
1604
|
+
}
|
|
1605
|
+
],
|
|
1606
|
+
"fileUrlPath": "src/utils/harness.ts",
|
|
1607
|
+
"releaseTag": "Public",
|
|
1608
|
+
"name": "SpiedFunctions",
|
|
1609
|
+
"typeParameters": [
|
|
1610
|
+
{
|
|
1611
|
+
"typeParameterName": "T",
|
|
1612
|
+
"constraintTokenRange": {
|
|
1613
|
+
"startIndex": 0,
|
|
1614
|
+
"endIndex": 0
|
|
1615
|
+
},
|
|
1616
|
+
"defaultTypeTokenRange": {
|
|
1617
|
+
"startIndex": 0,
|
|
1618
|
+
"endIndex": 0
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
],
|
|
1622
|
+
"typeTokenRange": {
|
|
1623
|
+
"startIndex": 1,
|
|
1624
|
+
"endIndex": 5
|
|
1625
|
+
}
|
|
1626
|
+
},
|
|
1627
|
+
{
|
|
1628
|
+
"kind": "TypeAlias",
|
|
1629
|
+
"canonicalReference": "@genesislcap/foundation-testing!SuiteCallback:type",
|
|
1630
|
+
"docComment": "/**\n * Defines the Generic type for a test Suite `T` the callback function required to assert on type `T`.\n *\n * @typeParam T - the top level class we are testing\n *\n * @public\n */\n",
|
|
1631
|
+
"excerptTokens": [
|
|
1632
|
+
{
|
|
1633
|
+
"kind": "Content",
|
|
1634
|
+
"text": "export type SuiteCallback<T> = "
|
|
1635
|
+
},
|
|
1636
|
+
{
|
|
1637
|
+
"kind": "Reference",
|
|
1638
|
+
"text": "uvu.Callback",
|
|
1639
|
+
"canonicalReference": "uvu!uvu.Callback:type"
|
|
1640
|
+
},
|
|
1641
|
+
{
|
|
1642
|
+
"kind": "Content",
|
|
1643
|
+
"text": "<"
|
|
1644
|
+
},
|
|
1645
|
+
{
|
|
1646
|
+
"kind": "Reference",
|
|
1647
|
+
"text": "ComponentContext",
|
|
1648
|
+
"canonicalReference": "@genesislcap/foundation-testing!ComponentContext:interface"
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
"kind": "Content",
|
|
1652
|
+
"text": "<T>>"
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
"kind": "Content",
|
|
1656
|
+
"text": ";"
|
|
1657
|
+
}
|
|
1658
|
+
],
|
|
1659
|
+
"fileUrlPath": "src/suite/suite.ts",
|
|
1660
|
+
"releaseTag": "Public",
|
|
1661
|
+
"name": "SuiteCallback",
|
|
1662
|
+
"typeParameters": [
|
|
1663
|
+
{
|
|
1664
|
+
"typeParameterName": "T",
|
|
1665
|
+
"constraintTokenRange": {
|
|
1666
|
+
"startIndex": 0,
|
|
1667
|
+
"endIndex": 0
|
|
1668
|
+
},
|
|
1669
|
+
"defaultTypeTokenRange": {
|
|
1670
|
+
"startIndex": 0,
|
|
1671
|
+
"endIndex": 0
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
],
|
|
1675
|
+
"typeTokenRange": {
|
|
1676
|
+
"startIndex": 1,
|
|
1677
|
+
"endIndex": 5
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
"kind": "Function",
|
|
1682
|
+
"canonicalReference": "@genesislcap/foundation-testing!testSpy:function(1)",
|
|
1683
|
+
"docComment": "/**\n * Decorator: Used on a test harness class based on a `FoundationElement` to give it extra functionality which can be used during testing. *Important* this is to be used on a parent element compared to the element under test.\n *\n * @remarks\n *\n * Access the test functionality using the type with {@link WithTestHarness}\n *\n * Reset after each test with {@link resetTestHarness}\n *\n * @example\n *\n * // Testing the first function call async (\\{ element \\}) =\\> \\{\n *\n * assert.ok( element.layout.addItemFromChild.calledWith(\\{ type: 'component', componentType: 'test', title: `Item test`, reorderEnabled: true, isClosable: false, size: undefined, \\}) );\n *\n * // Reset the tester at the end of every test even if you don't assert on any of it! resetTestHarness(element.layout); \\}\n *\n * @public\n */\n",
|
|
1684
|
+
"excerptTokens": [
|
|
1685
|
+
{
|
|
1686
|
+
"kind": "Content",
|
|
1687
|
+
"text": "export declare function testSpy(constructor: "
|
|
1688
|
+
},
|
|
1689
|
+
{
|
|
1690
|
+
"kind": "Reference",
|
|
1691
|
+
"text": "Function",
|
|
1692
|
+
"canonicalReference": "!Function:interface"
|
|
1693
|
+
},
|
|
1694
|
+
{
|
|
1695
|
+
"kind": "Content",
|
|
1696
|
+
"text": "): "
|
|
1697
|
+
},
|
|
1698
|
+
{
|
|
1699
|
+
"kind": "Content",
|
|
1700
|
+
"text": "void"
|
|
1701
|
+
},
|
|
1702
|
+
{
|
|
1703
|
+
"kind": "Content",
|
|
1704
|
+
"text": ";"
|
|
1705
|
+
}
|
|
1706
|
+
],
|
|
1707
|
+
"fileUrlPath": "src/utils/harness.ts",
|
|
1708
|
+
"returnTypeTokenRange": {
|
|
1709
|
+
"startIndex": 3,
|
|
1710
|
+
"endIndex": 4
|
|
1711
|
+
},
|
|
1712
|
+
"releaseTag": "Public",
|
|
1713
|
+
"overloadIndex": 1,
|
|
1714
|
+
"parameters": [
|
|
1715
|
+
{
|
|
1716
|
+
"parameterName": "constructor",
|
|
1717
|
+
"parameterTypeTokenRange": {
|
|
1718
|
+
"startIndex": 1,
|
|
1719
|
+
"endIndex": 2
|
|
1720
|
+
},
|
|
1721
|
+
"isOptional": false
|
|
1722
|
+
}
|
|
1723
|
+
],
|
|
1724
|
+
"name": "testSpy"
|
|
1725
|
+
},
|
|
1726
|
+
{
|
|
1727
|
+
"kind": "TypeAlias",
|
|
1728
|
+
"canonicalReference": "@genesislcap/foundation-testing!WithTestHarness:type",
|
|
1729
|
+
"docComment": "/**\n * Type can be used to inform Typescript the object decorated with {@link testSpy} has function spies which can be interacted upon their normal function reference\n *\n * @public\n */\n",
|
|
1730
|
+
"excerptTokens": [
|
|
1731
|
+
{
|
|
1732
|
+
"kind": "Content",
|
|
1733
|
+
"text": "export type WithTestHarness<T extends "
|
|
1734
|
+
},
|
|
1735
|
+
{
|
|
1736
|
+
"kind": "Content",
|
|
1737
|
+
"text": "{\n [k in keyof T]: any;\n}"
|
|
1738
|
+
},
|
|
1739
|
+
{
|
|
1740
|
+
"kind": "Content",
|
|
1741
|
+
"text": "> = "
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
"kind": "Content",
|
|
1745
|
+
"text": "T & "
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
"kind": "Reference",
|
|
1749
|
+
"text": "SinonWrapper",
|
|
1750
|
+
"canonicalReference": "@genesislcap/foundation-testing!SinonWrapper:type"
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
"kind": "Content",
|
|
1754
|
+
"text": "<"
|
|
1755
|
+
},
|
|
1756
|
+
{
|
|
1757
|
+
"kind": "Reference",
|
|
1758
|
+
"text": "SpiedFunctions",
|
|
1759
|
+
"canonicalReference": "@genesislcap/foundation-testing!SpiedFunctions:type"
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
"kind": "Content",
|
|
1763
|
+
"text": "<T>>"
|
|
1764
|
+
},
|
|
1765
|
+
{
|
|
1766
|
+
"kind": "Content",
|
|
1767
|
+
"text": ";"
|
|
1768
|
+
}
|
|
1769
|
+
],
|
|
1770
|
+
"fileUrlPath": "src/utils/harness.ts",
|
|
1771
|
+
"releaseTag": "Public",
|
|
1772
|
+
"name": "WithTestHarness",
|
|
1773
|
+
"typeParameters": [
|
|
1774
|
+
{
|
|
1775
|
+
"typeParameterName": "T",
|
|
1776
|
+
"constraintTokenRange": {
|
|
1777
|
+
"startIndex": 1,
|
|
1778
|
+
"endIndex": 2
|
|
1779
|
+
},
|
|
1780
|
+
"defaultTypeTokenRange": {
|
|
1781
|
+
"startIndex": 0,
|
|
1782
|
+
"endIndex": 0
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
],
|
|
1786
|
+
"typeTokenRange": {
|
|
1787
|
+
"startIndex": 3,
|
|
1788
|
+
"endIndex": 8
|
|
1789
|
+
}
|
|
1284
1790
|
}
|
|
1285
1791
|
]
|
|
1286
1792
|
}
|
|
@@ -9,6 +9,7 @@ import { FoundationElementRegistry } from '@microsoft/fast-foundation';
|
|
|
9
9
|
import { HTMLView } from '@microsoft/fast-element';
|
|
10
10
|
import { Logger } from '@genesislcap/foundation-utils';
|
|
11
11
|
import { Registration } from '@microsoft/fast-foundation';
|
|
12
|
+
import { default as sinon_2 } from 'sinon';
|
|
12
13
|
import { suite as suite_2 } from 'uvu';
|
|
13
14
|
import { test as test_2 } from 'uvu';
|
|
14
15
|
import { uvu } from 'uvu';
|
|
@@ -135,6 +136,26 @@ export declare function createLogicSuite<TContext = LogicContext>(title: string,
|
|
|
135
136
|
*/
|
|
136
137
|
export declare type ElementGetter = () => FoundationElementRegistry<FoundationElementDefinition, FoundationElement>;
|
|
137
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Expects that the type parameter X is equal to Y, returning true or false
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
export declare type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Expects that the type parameter T resolves to true, or will be a typescript error
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
149
|
+
export declare type Expect<T extends true> = T;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Filters out key/value pairs from an object where they value does not match a condition
|
|
153
|
+
* @public
|
|
154
|
+
*/
|
|
155
|
+
export declare type FilterConditionally<Source, Condition> = Pick<Source, {
|
|
156
|
+
[K in keyof Source]: Source[K] extends Condition ? K : never;
|
|
157
|
+
}[keyof Source]>;
|
|
158
|
+
|
|
138
159
|
/**
|
|
139
160
|
* Unit test fixture.
|
|
140
161
|
* @public
|
|
@@ -246,10 +267,89 @@ export declare interface LogicContext {
|
|
|
246
267
|
|
|
247
268
|
export { Registration }
|
|
248
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Resets items tracked during testing such as calls to spied functions.
|
|
272
|
+
* Must be called at the end of every test even if not asserting on the spies.
|
|
273
|
+
* @param wrapper - `WithTestHarness<T>` object to reset
|
|
274
|
+
* @public
|
|
275
|
+
*/
|
|
276
|
+
export declare function resetTestHarness<T>(wrapper: WithTestHarness<T>): void;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Crates an object with a key value pair for each spied function
|
|
280
|
+
* where the key is the function name and the value is the sinon wrapped
|
|
281
|
+
* spy function
|
|
282
|
+
* @public
|
|
283
|
+
* @typeParam T - object with keys where values are functions
|
|
284
|
+
*/
|
|
285
|
+
export declare type SinonWrapper<T extends {
|
|
286
|
+
[K in keyof T]: (...args: any) => any;
|
|
287
|
+
}> = {
|
|
288
|
+
[K in keyof T]: sinon_2.SinonSpy<Parameters<T[K]>, ReturnType<T[K]>>;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Filters out all key/value pairs which are not functions, and omits the constructor
|
|
293
|
+
* @public
|
|
294
|
+
*/
|
|
295
|
+
export declare type SpiedFunctions<T> = Omit<FilterConditionally<T, (...args: any[]) => any>, 'constructor'>;
|
|
296
|
+
|
|
249
297
|
export { suite_2 as suite }
|
|
250
298
|
|
|
299
|
+
/**
|
|
300
|
+
* Defines the Generic type for a test Suite `T` the callback function
|
|
301
|
+
* required to assert on type `T`.
|
|
302
|
+
* @typeParam T - the top level class we are testing
|
|
303
|
+
* @public
|
|
304
|
+
*/
|
|
305
|
+
export declare type SuiteCallback<T> = uvu.Callback<ComponentContext<T>>;
|
|
306
|
+
|
|
251
307
|
export { test_2 as test }
|
|
252
308
|
|
|
309
|
+
/**
|
|
310
|
+
* Decorator: Used on a test harness class based on a `FoundationElement` to give it extra functionality
|
|
311
|
+
* which can be used during testing. *Important* this is to be used on a parent element compared to
|
|
312
|
+
* the element under test.
|
|
313
|
+
*
|
|
314
|
+
*
|
|
315
|
+
* @remarks
|
|
316
|
+
* Access the test functionality using the type with {@link WithTestHarness}
|
|
317
|
+
*
|
|
318
|
+
* Reset after each test with {@link resetTestHarness}
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
*
|
|
322
|
+
* // Testing the first function call
|
|
323
|
+
* async (\{ element \}) =\> \{
|
|
324
|
+
*
|
|
325
|
+
assert.ok(
|
|
326
|
+
element.layout.addItemFromChild.calledWith(\{
|
|
327
|
+
type: 'component',
|
|
328
|
+
componentType: 'test',
|
|
329
|
+
title: `Item test`,
|
|
330
|
+
reorderEnabled: true,
|
|
331
|
+
isClosable: false,
|
|
332
|
+
size: undefined,
|
|
333
|
+
\})
|
|
334
|
+
);
|
|
335
|
+
*
|
|
336
|
+
* // Reset the tester at the end of every test even if you don't assert on any of it!
|
|
337
|
+
* resetTestHarness(element.layout);
|
|
338
|
+
* \}
|
|
339
|
+
*
|
|
340
|
+
* @public
|
|
341
|
+
*/
|
|
342
|
+
export declare function testSpy(constructor: Function): void;
|
|
343
|
+
|
|
253
344
|
export { uvu }
|
|
254
345
|
|
|
346
|
+
/**
|
|
347
|
+
* Type can be used to inform Typescript the object decorated with {@link testSpy} has function
|
|
348
|
+
* spies which can be interacted upon their normal function reference
|
|
349
|
+
* @public
|
|
350
|
+
*/
|
|
351
|
+
export declare type WithTestHarness<T extends {
|
|
352
|
+
[k in keyof T]: any;
|
|
353
|
+
}> = T & SinonWrapper<SpiedFunctions<T>>;
|
|
354
|
+
|
|
255
355
|
export { }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-testing](./foundation-testing.md) > [Equal](./foundation-testing.equal.md)
|
|
4
|
+
|
|
5
|
+
## Equal type
|
|
6
|
+
|
|
7
|
+
Expects that the type parameter X is equal to Y, returning true or false
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-testing](./foundation-testing.md) > [Expect](./foundation-testing.expect.md)
|
|
4
|
+
|
|
5
|
+
## Expect type
|
|
6
|
+
|
|
7
|
+
Expects that the type parameter T resolves to true, or will be a typescript error
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export type Expect<T extends true> = T;
|
|
13
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-testing](./foundation-testing.md) > [FilterConditionally](./foundation-testing.filterconditionally.md)
|
|
4
|
+
|
|
5
|
+
## FilterConditionally type
|
|
6
|
+
|
|
7
|
+
Filters out key/value pairs from an object where they value does not match a condition
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export type FilterConditionally<Source, Condition> = Pick<Source, {
|
|
13
|
+
[K in keyof Source]: Source[K] extends Condition ? K : never;
|
|
14
|
+
}[keyof Source]>;
|
|
15
|
+
```
|