testeranto.tiposkripto 0.3.2 → 0.4.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.
Files changed (31) hide show
  1. package/dist/.DS_Store +0 -0
  2. package/dist/module/Node.js +1394 -824
  3. package/dist/module/Web.js +1405 -825
  4. package/dist/module/index.js +243 -841
  5. package/dist/types/Types.d.ts +55 -10
  6. package/dist/types/lib/tiposkripto/src/Adapters.d.ts +3 -0
  7. package/dist/types/lib/tiposkripto/src/BaseExpected.d.ts +1 -1
  8. package/dist/types/lib/tiposkripto/src/BaseTiposkripto.d.ts +22 -18
  9. package/dist/types/lib/tiposkripto/src/CoreTypes.d.ts +27 -28
  10. package/dist/types/lib/tiposkripto/src/Node.d.ts +4 -4
  11. package/dist/types/lib/tiposkripto/src/Web.d.ts +9 -3
  12. package/dist/types/lib/tiposkripto/src/index.d.ts +21 -29
  13. package/dist/types/lib/tiposkripto/src/interop/index.d.ts +0 -0
  14. package/dist/types/lib/tiposkripto/src/interop/jest.d.ts +0 -0
  15. package/dist/types/lib/tiposkripto/src/interop/mocha.d.ts +0 -0
  16. package/dist/types/lib/tiposkripto/src/interop/nodeNative.d.ts +0 -0
  17. package/dist/types/lib/tiposkripto/src/interop/vite.d.ts +0 -0
  18. package/dist/types/lib/tiposkripto/src/types.d.ts +18 -26
  19. package/dist/types/lib/tiposkripto/src/verbs/BaseSuite.d.ts +0 -0
  20. package/dist/types/lib/tiposkripto/src/verbs/aaa/BaseDescribe.d.ts +39 -0
  21. package/dist/types/lib/tiposkripto/src/verbs/aaa/BaseIt.d.ts +22 -0
  22. package/dist/types/lib/tiposkripto/src/verbs/bdd/BaseGiven.d.ts +48 -0
  23. package/dist/types/lib/tiposkripto/src/verbs/bdd/BaseThen.d.ts +38 -0
  24. package/dist/types/lib/tiposkripto/src/verbs/bdd/BaseWhen.d.ts +37 -0
  25. package/dist/types/lib/tiposkripto/src/verbs/internal/CommonUtils.d.ts +45 -0
  26. package/dist/types/lib/tiposkripto/src/verbs/tdt/BaseConfirm.d.ts +26 -0
  27. package/dist/types/lib/tiposkripto/src/verbs/tdt/BaseExpected.d.ts +27 -0
  28. package/dist/types/lib/tiposkripto/src/verbs/tdt/BaseShould.d.ts +24 -0
  29. package/dist/types/lib/tiposkripto/src/verbs/tdt/BaseValue.d.ts +38 -0
  30. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  31. package/package.json +2 -1
@@ -0,0 +1,48 @@
1
+ import type { TestTypeParams_any } from "../../CoreTypes.js";
2
+ import type { ITestArtifactory, ITestResourceConfiguration } from "../../types.js";
3
+ /**
4
+ * Represents a collection of Given conditions keyed by their names.
5
+ * Givens are typically organized as named collections because:
6
+ * - They set up different initial states for tests
7
+ * - Tests often need to reference specific Given conditions by name
8
+ * - This allows for better organization and reuse of setup logic
9
+ * - The BDD pattern often involves multiple named Given scenarios
10
+ */
11
+ /**
12
+ * BaseGiven for BDD pattern - independent implementation
13
+ */
14
+ export declare abstract class BaseGiven<I extends TestTypeParams_any> {
15
+ features: string[];
16
+ whens: any[];
17
+ thens: any[];
18
+ error: Error | null;
19
+ store: I["istore"];
20
+ givenCB: I["given"];
21
+ initialValues: any;
22
+ key: string;
23
+ failed: boolean;
24
+ artifacts: string[];
25
+ fails: number;
26
+ status: boolean | undefined;
27
+ testResourceConfiguration: ITestResourceConfiguration | null;
28
+ constructor(features: string[], whens: any[], thens: any[], givenCB: I["given"], initialValues: any);
29
+ addArtifact(path: string): void;
30
+ setParent(parent: any): void;
31
+ toObj(): any;
32
+ /**
33
+ * Abstract method to be implemented by concrete Given classes.
34
+ * Sets up the initial state for the BDD Given phase.
35
+ *
36
+ * @param subject The test subject
37
+ * @param testResourceConfiguration Test resource configuration
38
+ * @param artifactory Context-aware artifactory for file operations
39
+ * @param givenCB Given callback function
40
+ * @param initialValues Initial values for setup
41
+ * @returns Promise resolving to the test store
42
+ */
43
+ abstract givenThat(subject: I["isubject"], testResourceConfiguration: ITestResourceConfiguration, artifactory: ITestArtifactory, givenCB: I["given"], initialValues: any): Promise<I["istore"]>;
44
+ afterEach(store: I["istore"], key: string, artifactory: ITestArtifactory): Promise<I["istore"]>;
45
+ give(subject: I["isubject"], key: string, testResourceConfiguration: ITestResourceConfiguration, tester: (t: Awaited<I["then"]> | undefined) => boolean, artifactory?: any, suiteNdx?: number): Promise<I["istore"]>;
46
+ private createArtifactoryForWhen;
47
+ private createArtifactoryForThen;
48
+ }
@@ -0,0 +1,38 @@
1
+ import type { TestTypeParams_any } from "../../CoreTypes.js";
2
+ import type { ITestResourceConfiguration } from "../../types.js";
3
+ /**
4
+ * BaseThen for BDD pattern - independent implementation
5
+ */
6
+ export declare abstract class BaseThen<I extends TestTypeParams_any> {
7
+ name: string;
8
+ thenCB: (storeState: I["iselection"]) => Promise<I["then"]>;
9
+ error: Error | null;
10
+ status: boolean | undefined;
11
+ constructor(name: string, thenCB: (val: I["iselection"]) => Promise<I["then"]>);
12
+ /**
13
+ * Abstract method to be implemented by concrete Then classes.
14
+ * Performs the verification for the BDD Then phase.
15
+ *
16
+ * @param store The test store
17
+ * @param thenCB Then callback function
18
+ * @param testResourceConfiguration Test resource configuration
19
+ * @param artifactory Context-aware artifactory for file operations
20
+ * @returns Promise resolving to the selection for verification
21
+ */
22
+ abstract butThen(store: I["istore"], thenCB: (s: I["iselection"]) => Promise<I["isubject"]>, testResourceConfiguration: ITestResourceConfiguration, artifactory?: any): Promise<I["iselection"]>;
23
+ test(store: I["istore"], testResourceConfiguration: ITestResourceConfiguration, filepath: string, artifactory?: any): Promise<I["then"] | undefined>;
24
+ toObj(): {
25
+ name: string;
26
+ status: boolean | undefined;
27
+ error: string | null;
28
+ };
29
+ }
30
+ /**
31
+ * Represents a collection of Then assertions keyed by their names.
32
+ * Thens are typically part of Given definitions rather than standalone collections,
33
+ * but this type exists for consistency and potential future use cases where:
34
+ * - Assertions might need to be reused or composed dynamically
35
+ * - Custom assertion libraries could benefit from named assertion collections
36
+ * - Advanced validation patterns require named Then conditions
37
+ */
38
+ export type IThens<I extends TestTypeParams_any> = Record<string, BaseThen<I>>;
@@ -0,0 +1,37 @@
1
+ import { TestTypeParams_any } from "../../CoreTypes.js";
2
+ /**
3
+ * BaseWhen for BDD pattern - independent implementation
4
+ */
5
+ export declare abstract class BaseWhen<I extends TestTypeParams_any> {
6
+ name: string;
7
+ whenCB: (x: I["iselection"]) => I["then"];
8
+ error: Error | null;
9
+ status: boolean | undefined;
10
+ constructor(name: string, whenCB: (xyz: I["iselection"]) => I["then"]);
11
+ /**
12
+ * Abstract method to be implemented by concrete When classes.
13
+ * Performs the action for the BDD When phase.
14
+ *
15
+ * @param store The test store
16
+ * @param whenCB When callback function
17
+ * @param testResource Test resource configuration
18
+ * @param artifactory Context-aware artifactory for file operations
19
+ * @returns Promise resolving to the result of the action
20
+ */
21
+ abstract andWhen(store: I["istore"], whenCB: (x: I["iselection"]) => I["then"], testResource: any, artifactory?: any): Promise<any>;
22
+ test(store: I["istore"], testResourceConfiguration: any, artifactory?: any): Promise<any>;
23
+ toObj(): {
24
+ name: string;
25
+ status: boolean | undefined;
26
+ error: string | null;
27
+ };
28
+ }
29
+ /**
30
+ * Represents a collection of When actions keyed by their names.
31
+ * Whens are typically part of Given definitions rather than standalone collections,
32
+ * but this type exists for consistency and potential future use cases where:
33
+ * - When actions might need to be reused across multiple Given conditions
34
+ * - Dynamic composition of test steps is required
35
+ * - Advanced test patterns need to reference When actions by name
36
+ */
37
+ export type IWhens<I extends TestTypeParams_any> = Record<string, BaseWhen<I>>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Common utilities shared across all testing patterns
3
+ */
4
+ export declare class CommonUtils {
5
+ /**
6
+ * Normalize a path string for consistent artifact storage
7
+ */
8
+ static normalizePath(path: string): string;
9
+ /**
10
+ * Add an artifact with path normalization
11
+ */
12
+ static addArtifact(artifacts: string[], path: string): void;
13
+ /**
14
+ * Create a fallback artifactory for logging
15
+ */
16
+ static createFallbackArtifactory(context: {
17
+ suiteIndex?: number;
18
+ givenKey?: string;
19
+ whenIndex?: number;
20
+ thenIndex?: number;
21
+ valueKey?: string;
22
+ rowIndex?: number;
23
+ }, basePath?: string): any;
24
+ /**
25
+ * Standard error handling for test operations
26
+ */
27
+ static handleTestError(error: any, target: {
28
+ failed: boolean;
29
+ fails: number;
30
+ error: Error | null;
31
+ }): void;
32
+ /**
33
+ * Standard method to create an object representation
34
+ */
35
+ static toObj(target: {
36
+ key?: string;
37
+ name?: string;
38
+ failed: boolean;
39
+ fails?: number;
40
+ error: Error | null;
41
+ features?: string[];
42
+ artifacts: string[];
43
+ status?: boolean | undefined;
44
+ }, additionalProps?: Record<string, any>): any;
45
+ }
@@ -0,0 +1,26 @@
1
+ import type { TestTypeParams_any } from "../../CoreTypes.js";
2
+ import type { ITestArtifactory, ITestResourceConfiguration } from "../../types.js";
3
+ /**
4
+ * BaseConfirm for TDT (Table-Driven Testing) pattern.
5
+ * Standalone class similar to BaseGiven but for table-driven testing.
6
+ */
7
+ export declare class BaseConfirm<I extends TestTypeParams_any> {
8
+ features: string[];
9
+ testCases: any[][];
10
+ confirmCB: I["given"];
11
+ initialValues: any;
12
+ key: string;
13
+ failed: boolean;
14
+ artifacts: string[];
15
+ fails: number;
16
+ status: boolean | undefined;
17
+ error: Error | null;
18
+ store: I["istore"];
19
+ constructor(features: string[], testCases: any[][], confirmCB: I["given"], initialValues: any);
20
+ addArtifact(path: string): void;
21
+ setParent(parent: any): void;
22
+ toObj(): any;
23
+ confirm(subject: I["isubject"], key: string, testResourceConfiguration: ITestResourceConfiguration, tester: (t: Awaited<I["then"]> | undefined) => boolean, artifactory?: any, suiteNdx?: number): Promise<I["istore"]>;
24
+ run(subject: I["isubject"], testResourceConfiguration: ITestResourceConfiguration, artifactory?: ITestArtifactory): Promise<I["istore"]>;
25
+ }
26
+ export type IConfirms<I extends TestTypeParams_any> = Record<string, BaseConfirm<I>>;
@@ -0,0 +1,27 @@
1
+ import type { TestTypeParams_any } from "../../CoreTypes.js";
2
+ import type { ITestResourceConfiguration } from "../../types.js";
3
+ /**
4
+ * BaseExpected for TDT pattern - independent implementation
5
+ * Validates each row in table-driven testing.
6
+ */
7
+ export declare abstract class BaseExpected<I extends TestTypeParams_any> {
8
+ name: string;
9
+ expectedCB: (val: I["iselection"]) => Promise<I["action"]>;
10
+ expectedValue: any;
11
+ error: Error | null;
12
+ status: boolean | undefined;
13
+ constructor(name: string, expectedCB: (val: I["iselection"]) => Promise<I["action"]>);
14
+ setExpectedValue(expected: any): void;
15
+ /**
16
+ * Abstract method to validate a row
17
+ */
18
+ abstract validateRow(store: I["istore"], testResourceConfiguration: any, filepath: string, expectedValue: any, artifactory?: any): Promise<any>;
19
+ test(store: I["istore"], testResourceConfiguration: ITestResourceConfiguration, filepath: string, artifactory?: any): Promise<any>;
20
+ toObj(): {
21
+ name: string;
22
+ status: boolean | undefined;
23
+ error: string | null;
24
+ expectedValue: any;
25
+ };
26
+ }
27
+ export type IExpecteds<I extends TestTypeParams_any> = Record<string, BaseExpected<I>>;
@@ -0,0 +1,24 @@
1
+ import { TestTypeParams_any } from "../../CoreTypes.js";
2
+ /**
3
+ * BaseShould for TDT pattern - independent implementation
4
+ * Processes each row in table-driven testing.
5
+ */
6
+ export declare class BaseShould<I extends TestTypeParams_any> {
7
+ name: string;
8
+ shouldCB: (xyz: I["iselection"]) => I["action"];
9
+ currentRow: any[];
10
+ rowIndex: number;
11
+ error: Error | null;
12
+ status: boolean | undefined;
13
+ constructor(name: string, shouldCB: (xyz: I["iselection"]) => I["action"]);
14
+ setRowData(rowIndex: number, rowData: any[]): void;
15
+ processRow(actualResult: any, testResourceConfiguration: any, artifactory?: any): Promise<boolean>;
16
+ toObj(): {
17
+ name: string;
18
+ status: boolean | undefined;
19
+ error: string | null;
20
+ rowIndex: number;
21
+ currentRow: any[];
22
+ };
23
+ }
24
+ export type IShoulds<I extends TestTypeParams_any> = Record<string, BaseShould<I>>;
@@ -0,0 +1,38 @@
1
+ import type { TestTypeParams_any } from "../../CoreTypes.js";
2
+ import { ITestResourceConfiguration } from "../../types.js";
3
+ /**
4
+ * BaseValue for TDT pattern - independent implementation
5
+ * Sets up table data for table-driven testing.
6
+ */
7
+ export declare class BaseValue<I extends TestTypeParams_any> {
8
+ features: string[];
9
+ tableRows: any[][];
10
+ confirmCB: I["setup"];
11
+ initialValues: any;
12
+ key: string;
13
+ failed: boolean;
14
+ artifacts: string[];
15
+ fails: number;
16
+ status: boolean | undefined;
17
+ error: Error | null;
18
+ store: I["istore"];
19
+ testResourceConfiguration: ITestResourceConfiguration | null;
20
+ constructor(features: string[], tableRows: any[][], confirmCB: I["setup"], initialValues: any);
21
+ setParent(parent: any): void;
22
+ addArtifact(path: string): void;
23
+ value(subject: I["isubject"], key: string, testResourceConfiguration: ITestResourceConfiguration, tester: (t: Awaited<I["check"]> | undefined) => boolean, artifactory?: any, suiteNdx?: number): Promise<I["istore"]>;
24
+ private processRow;
25
+ private createArtifactoryForRow;
26
+ afterEach(store: I["istore"], key: string, artifactory: any): Promise<I["istore"]>;
27
+ toObj(): {
28
+ key: string;
29
+ values: any[][];
30
+ tableRows: any[][];
31
+ error: (string | Error | undefined)[] | null;
32
+ failed: boolean;
33
+ features: string[];
34
+ artifacts: string[];
35
+ status: boolean | undefined;
36
+ };
37
+ }
38
+ export type IValues<I extends TestTypeParams_any> = Record<string, BaseValue<I>>;