testeranto.tiposkripto 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/Node.js +361 -154
- package/dist/module/Web.js +362 -171
- package/dist/module/index.js +636 -10
- package/dist/types/Types.d.ts +1 -0
- package/dist/types/lib/tiposkripto/src/BaseAct.d.ts +12 -0
- package/dist/types/lib/tiposkripto/src/BaseAction.d.ts +24 -0
- package/dist/types/lib/tiposkripto/src/BaseArrange.d.ts +11 -0
- package/dist/types/lib/tiposkripto/src/BaseAssert.d.ts +13 -0
- package/dist/types/lib/tiposkripto/src/BaseCheck.d.ts +25 -0
- package/dist/types/lib/tiposkripto/src/BaseFeed.d.ts +15 -0
- package/dist/types/lib/tiposkripto/src/BaseGiven.d.ts +10 -3
- package/dist/types/lib/tiposkripto/src/BaseMap.d.ts +16 -0
- package/dist/types/lib/tiposkripto/src/BaseSetup.d.ts +39 -0
- package/dist/types/lib/tiposkripto/src/BaseSuite.d.ts +3 -3
- package/dist/types/lib/tiposkripto/src/BaseThen.d.ts +9 -3
- package/dist/types/lib/tiposkripto/src/BaseValidate.d.ts +15 -0
- package/dist/types/lib/tiposkripto/src/BaseWhen.d.ts +10 -3
- package/dist/types/lib/tiposkripto/src/CoreTypes.d.ts +29 -24
- package/dist/types/lib/tiposkripto/src/Node.d.ts +3 -3
- package/dist/types/lib/tiposkripto/src/Web.d.ts +3 -3
- package/dist/types/lib/tiposkripto/src/flavored/Decorators.d.ts +22 -0
- package/dist/types/lib/tiposkripto/src/flavored/FluentBuilder.d.ts +31 -0
- package/dist/types/lib/tiposkripto/src/flavored/index.d.ts +17 -0
- package/dist/types/lib/tiposkripto/src/index.d.ts +45 -3
- package/dist/types/lib/tiposkripto/src/types.d.ts +12 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseSetup } from "./BaseSetup.js";
|
|
2
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
3
|
+
import { ITestArtifactory, ITestResourceConfiguration } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* BaseArrange extends BaseSetup for AAA pattern.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BaseArrange<I extends TestTypeParams_any> extends BaseSetup<I> {
|
|
8
|
+
constructor(features: string[], acts: any[], asserts: any[], arrangeCB: I["given"], initialValues: any);
|
|
9
|
+
arrange(subject: I["isubject"], key: string, testResourceConfiguration: ITestResourceConfiguration, tester: (t: Awaited<I["then"]> | undefined) => boolean, artifactory?: ITestArtifactory, suiteNdx?: number): Promise<I["istore"]>;
|
|
10
|
+
}
|
|
11
|
+
export type IArranges<I extends TestTypeParams_any> = Record<string, BaseArrange<I>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCheck } from "./BaseCheck.js";
|
|
2
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
3
|
+
import { ITestResourceConfiguration } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* BaseAssert extends BaseCheck to support AAA pattern.
|
|
6
|
+
* It reuses all Check functionality but with AAA naming.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BaseAssert<I extends TestTypeParams_any> extends BaseCheck<I> {
|
|
9
|
+
constructor(name: string, assertCB: (val: I["iselection"]) => Promise<I["then"]>);
|
|
10
|
+
verifyAssert(store: I["istore"], assertCB: (s: I["iselection"]) => Promise<I["isubject"]>, testResourceConfiguration: ITestResourceConfiguration): Promise<I["iselection"]>;
|
|
11
|
+
verify(store: I["istore"], testResourceConfiguration: any, filepath: string): Promise<I["then"] | undefined>;
|
|
12
|
+
}
|
|
13
|
+
export type IAsserts<I extends TestTypeParams_any> = Record<string, BaseAssert<I>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
2
|
+
import { ITestResourceConfiguration } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* BaseCheck is the unified base class for all verification phases.
|
|
5
|
+
* It covers BDD's Then, AAA's Assert, and TDT's Validate.
|
|
6
|
+
* @deprecated Use BaseThen, BaseAssert, or BaseValidate for specific patterns
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class BaseCheck<I extends TestTypeParams_any> {
|
|
9
|
+
name: string;
|
|
10
|
+
checkCB: (storeState: I["iselection"]) => Promise<I["then"]>;
|
|
11
|
+
error: boolean;
|
|
12
|
+
artifacts: string[];
|
|
13
|
+
status: boolean | undefined;
|
|
14
|
+
constructor(name: string, checkCB: (val: I["iselection"]) => Promise<I["then"]>);
|
|
15
|
+
addArtifact(path: string): void;
|
|
16
|
+
toObj(): {
|
|
17
|
+
name: string;
|
|
18
|
+
error: boolean;
|
|
19
|
+
artifacts: string[];
|
|
20
|
+
status: boolean | undefined;
|
|
21
|
+
};
|
|
22
|
+
abstract verifyCheck(store: I["istore"], checkCB: (s: I["iselection"]) => Promise<I["isubject"]>, testResourceConfiguration: ITestResourceConfiguration): Promise<I["iselection"]>;
|
|
23
|
+
test(store: I["istore"], testResourceConfiguration: any, filepath: string): Promise<I["then"] | undefined>;
|
|
24
|
+
}
|
|
25
|
+
export type IChecks<I extends TestTypeParams_any> = Record<string, BaseCheck<I>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseAction } from "./BaseAction.js";
|
|
2
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* BaseFeed extends BaseAction to support TDT (Table Driven Testing) pattern.
|
|
5
|
+
* It processes each row from the table.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BaseFeed<I extends TestTypeParams_any> extends BaseAction<I> {
|
|
8
|
+
rowIndex: number;
|
|
9
|
+
rowData: any;
|
|
10
|
+
constructor(name: string, feedCB: (xyz: I["iselection"]) => I["then"]);
|
|
11
|
+
setRowData(index: number, data: any): void;
|
|
12
|
+
feed(store: I["istore"], feedCB: (x: I["iselection"]) => I["then"], testResource: any): Promise<any>;
|
|
13
|
+
processRow(store: I["istore"], testResourceConfiguration: any, rowIndex: number, rowData: any): Promise<any>;
|
|
14
|
+
}
|
|
15
|
+
export type IFeeds<I extends TestTypeParams_any> = Record<string, BaseFeed<I>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
2
2
|
import { ITestArtifactory, ITestResourceConfiguration } from "./types.js";
|
|
3
|
+
import { BaseSetup } from "./BaseSetup.js";
|
|
3
4
|
/**
|
|
4
5
|
* Represents a collection of Given conditions keyed by their names.
|
|
5
6
|
* Givens are typically organized as named collections because:
|
|
@@ -7,9 +8,14 @@ import { ITestArtifactory, ITestResourceConfiguration } from "./types.js";
|
|
|
7
8
|
* - Tests often need to reference specific Given conditions by name
|
|
8
9
|
* - This allows for better organization and reuse of setup logic
|
|
9
10
|
* - The BDD pattern often involves multiple named Given scenarios
|
|
11
|
+
* @deprecated Use BaseSetup for unified terminology
|
|
10
12
|
*/
|
|
11
|
-
export type IGivens<I extends
|
|
12
|
-
|
|
13
|
+
export type IGivens<I extends TestTypeParams_any> = Record<string, BaseGiven<I>>;
|
|
14
|
+
/**
|
|
15
|
+
* BaseGiven extends BaseSetup for BDD pattern.
|
|
16
|
+
* @deprecated Use BaseSetup for unified terminology
|
|
17
|
+
*/
|
|
18
|
+
export declare abstract class BaseGiven<I extends TestTypeParams_any> extends BaseSetup<I> {
|
|
13
19
|
features: string[];
|
|
14
20
|
whens: any[];
|
|
15
21
|
thens: any[];
|
|
@@ -38,6 +44,7 @@ export declare abstract class BaseGiven<I extends Ibdd_in_any> {
|
|
|
38
44
|
status: boolean | undefined;
|
|
39
45
|
};
|
|
40
46
|
abstract givenThat(subject: I["isubject"], testResourceConfiguration: any, artifactory: ITestArtifactory, givenCB: I["given"], initialValues: any): Promise<I["istore"]>;
|
|
47
|
+
setupThat(subject: I["isubject"], testResourceConfiguration: ITestResourceConfiguration, artifactory: ITestArtifactory, setupCB: I["given"], initialValues: any): Promise<I["istore"]>;
|
|
41
48
|
afterEach(store: I["istore"], key: string, artifactory: ITestArtifactory): Promise<I["istore"]>;
|
|
42
49
|
give(subject: I["isubject"], key: string, testResourceConfiguration: ITestResourceConfiguration, tester: (t: Awaited<I["then"]> | undefined) => boolean, artifactory?: ITestArtifactory, suiteNdx?: number): Promise<I["istore"]>;
|
|
43
50
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseSetup } from "./BaseSetup.js";
|
|
2
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
3
|
+
import { ITestArtifactory, ITestResourceConfiguration } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* BaseMap extends BaseSetup to support TDT (Table Driven Testing) pattern.
|
|
6
|
+
* It sets up the test table data.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BaseMap<I extends TestTypeParams_any> extends BaseSetup<I> {
|
|
9
|
+
tableData: any[];
|
|
10
|
+
constructor(features: string[], feeds: any[], // These will be processed as actions
|
|
11
|
+
validates: any[], // These will be processed as checks
|
|
12
|
+
mapCB: I["given"], initialValues: any, tableData?: any[]);
|
|
13
|
+
map(subject: I["isubject"], key: string, testResourceConfiguration: ITestResourceConfiguration, tester: (t: Awaited<I["then"]> | undefined) => boolean, artifactory?: ITestArtifactory, suiteNdx?: number): Promise<I["istore"]>;
|
|
14
|
+
getTableData(): any[];
|
|
15
|
+
}
|
|
16
|
+
export type IMaps<I extends TestTypeParams_any> = Record<string, BaseMap<I>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
2
|
+
import { ITestArtifactory, ITestResourceConfiguration } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* BaseSetup is the unified base class for all setup phases.
|
|
5
|
+
* It covers BDD's Given, AAA's Arrange, and TDT's Map.
|
|
6
|
+
* @deprecated Use BaseGiven, BaseArrange, or BaseMap for specific patterns
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class BaseSetup<I extends TestTypeParams_any> {
|
|
9
|
+
features: string[];
|
|
10
|
+
actions: any[];
|
|
11
|
+
checks: any[];
|
|
12
|
+
error: Error;
|
|
13
|
+
fail: any;
|
|
14
|
+
store: I["istore"];
|
|
15
|
+
recommendedFsPath: string;
|
|
16
|
+
setupCB: I["given"];
|
|
17
|
+
initialValues: any;
|
|
18
|
+
key: string;
|
|
19
|
+
failed: boolean;
|
|
20
|
+
artifacts: string[];
|
|
21
|
+
fails: number;
|
|
22
|
+
status: boolean | undefined;
|
|
23
|
+
addArtifact(path: string): void;
|
|
24
|
+
constructor(features: string[], actions: any[], checks: any[], setupCB: I["given"], initialValues: any);
|
|
25
|
+
toObj(): {
|
|
26
|
+
key: string;
|
|
27
|
+
actions: any[];
|
|
28
|
+
checks: any[];
|
|
29
|
+
error: (string | Error | undefined)[] | null;
|
|
30
|
+
failed: boolean;
|
|
31
|
+
features: string[];
|
|
32
|
+
artifacts: string[];
|
|
33
|
+
status: boolean | undefined;
|
|
34
|
+
};
|
|
35
|
+
abstract setupThat(subject: I["isubject"], testResourceConfiguration: ITestResourceConfiguration, artifactory: ITestArtifactory, setupCB: I["given"], initialValues: any): Promise<I["istore"]>;
|
|
36
|
+
afterEach(store: I["istore"], key: string, artifactory: ITestArtifactory): Promise<I["istore"]>;
|
|
37
|
+
setup(subject: I["isubject"], key: string, testResourceConfiguration: ITestResourceConfiguration, tester: (t: Awaited<I["then"]> | undefined) => boolean, artifactory?: ITestArtifactory, suiteNdx?: number): Promise<I["istore"]>;
|
|
38
|
+
}
|
|
39
|
+
export type ISetups<I extends TestTypeParams_any> = Record<string, BaseSetup<I>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestTypeParams_any, TestSpecShape_any } from "./CoreTypes.js";
|
|
2
2
|
import { IGivens } from "./BaseGiven";
|
|
3
3
|
import { ITestResourceConfiguration, ITestArtifactory } from "./types.js";
|
|
4
4
|
/**
|
|
@@ -9,8 +9,8 @@ import { ITestResourceConfiguration, ITestArtifactory } from "./types.js";
|
|
|
9
9
|
* - Named suites allow for selective test execution and better reporting
|
|
10
10
|
* - This supports the hierarchical structure of test organization
|
|
11
11
|
*/
|
|
12
|
-
export type ISuites<I extends
|
|
13
|
-
export declare abstract class BaseSuite<I extends
|
|
12
|
+
export type ISuites<I extends TestTypeParams_any, O extends TestSpecShape_any> = Record<string, BaseSuite<I, O>>;
|
|
13
|
+
export declare abstract class BaseSuite<I extends TestTypeParams_any, O extends TestSpecShape_any> {
|
|
14
14
|
name: string;
|
|
15
15
|
givens: IGivens<I>;
|
|
16
16
|
store: I["istore"];
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
2
2
|
import { ITestResourceConfiguration } from "./types.js";
|
|
3
|
-
|
|
3
|
+
import { BaseCheck } from "./BaseCheck.js";
|
|
4
|
+
/**
|
|
5
|
+
* BaseThen extends BaseCheck for BDD pattern.
|
|
6
|
+
* @deprecated Use BaseCheck for unified terminology
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class BaseThen<I extends TestTypeParams_any> extends BaseCheck<I> {
|
|
4
9
|
name: string;
|
|
5
10
|
thenCB: (storeState: I["iselection"]) => Promise<I["then"]>;
|
|
6
11
|
error: boolean;
|
|
@@ -24,5 +29,6 @@ export declare abstract class BaseThen<I extends Ibdd_in_any> {
|
|
|
24
29
|
* - Assertions might need to be reused or composed dynamically
|
|
25
30
|
* - Custom assertion libraries could benefit from named assertion collections
|
|
26
31
|
* - Advanced validation patterns require named Then conditions
|
|
32
|
+
* @deprecated Use IChecks for unified terminology
|
|
27
33
|
*/
|
|
28
|
-
export type IThens<I extends
|
|
34
|
+
export type IThens<I extends TestTypeParams_any> = Record<string, BaseThen<I>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCheck } from "./BaseCheck.js";
|
|
2
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
3
|
+
import { ITestResourceConfiguration } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* BaseValidate extends BaseCheck to support TDT (Table Driven Testing) pattern.
|
|
6
|
+
* It validates the output against expected results.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BaseValidate<I extends TestTypeParams_any> extends BaseCheck<I> {
|
|
9
|
+
expectedResult: any;
|
|
10
|
+
constructor(name: string, validateCB: (val: I["iselection"]) => Promise<I["then"]>);
|
|
11
|
+
setExpectedResult(expected: any): void;
|
|
12
|
+
validate(store: I["istore"], validateCB: (s: I["iselection"]) => Promise<I["isubject"]>, testResourceConfiguration: ITestResourceConfiguration): Promise<I["iselection"]>;
|
|
13
|
+
check(store: I["istore"], testResourceConfiguration: any, filepath: string, expectedResult: any): Promise<I["then"] | undefined>;
|
|
14
|
+
}
|
|
15
|
+
export type IValidates<I extends TestTypeParams_any> = Record<string, BaseValidate<I>>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { TestTypeParams_any } from "./CoreTypes.js";
|
|
2
|
+
import { BaseAction } from "./BaseAction.js";
|
|
3
|
+
/**
|
|
4
|
+
* BaseWhen extends BaseAction for BDD pattern.
|
|
5
|
+
* @deprecated Use BaseAction for unified terminology
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class BaseWhen<I extends TestTypeParams_any> extends BaseAction<I> {
|
|
3
8
|
name: string;
|
|
4
9
|
whenCB: (x: I["iselection"]) => I["then"];
|
|
5
10
|
error: Error;
|
|
@@ -8,6 +13,7 @@ export declare abstract class BaseWhen<I extends Ibdd_in_any> {
|
|
|
8
13
|
addArtifact(path: string): void;
|
|
9
14
|
constructor(name: string, whenCB: (xyz: I["iselection"]) => I["then"]);
|
|
10
15
|
abstract andWhen(store: I["istore"], whenCB: (x: I["iselection"]) => I["then"], testResource: any): Promise<any>;
|
|
16
|
+
performAction(store: I["istore"], actionCB: (x: I["iselection"]) => I["then"], testResource: any): Promise<any>;
|
|
11
17
|
toObj(): {
|
|
12
18
|
name: string;
|
|
13
19
|
status: boolean | undefined;
|
|
@@ -23,5 +29,6 @@ export declare abstract class BaseWhen<I extends Ibdd_in_any> {
|
|
|
23
29
|
* - When actions might need to be reused across multiple Given conditions
|
|
24
30
|
* - Dynamic composition of test steps is required
|
|
25
31
|
* - Advanced test patterns need to reference When actions by name
|
|
32
|
+
* @deprecated Use IActions for unified terminology
|
|
26
33
|
*/
|
|
27
|
-
export type IWhens<I extends
|
|
34
|
+
export type IWhens<I extends TestTypeParams_any> = Record<string, BaseWhen<I>>;
|
|
@@ -5,15 +5,16 @@ import { ITestResourceConfiguration } from "./types";
|
|
|
5
5
|
export type SuiteSpecification<I extends Ibdd_in_any, O extends Ibdd_out_any> = {
|
|
6
6
|
[K in keyof O["suites"]]: (name: string, givens: IGivens<I>) => BaseSuite<I, O>;
|
|
7
7
|
};
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
export type IUniversalTestAdapter<I extends TestTypeParams_any> = {
|
|
9
|
+
prepareAll: (input: I["iinput"], testResource: ITestResourceConfiguration) => Promise<I["isubject"]>;
|
|
10
|
+
prepareEach: (subject: I["isubject"], initializer: (c?: any) => I["given"], testResource: ITestResourceConfiguration, initialValues: any) => Promise<I["istore"]>;
|
|
11
|
+
execute: (store: I["istore"], actionCB: I["when"], testResource: ITestResourceConfiguration) => Promise<I["istore"]>;
|
|
12
|
+
verify: (store: I["istore"], checkCB: I["then"], testResource: ITestResourceConfiguration) => Promise<I["iselection"]>;
|
|
13
|
+
cleanupEach: (store: I["istore"], key: string) => Promise<unknown>;
|
|
14
|
+
cleanupAll: (store: I["istore"]) => any;
|
|
15
|
+
assert: (x: I["then"]) => any;
|
|
16
16
|
};
|
|
17
|
+
export type ITestAdapter<I extends TestTypeParams_any> = IUniversalTestAdapter<I>;
|
|
17
18
|
export type ITestSpecification<I extends Ibdd_in_any, O extends Ibdd_out_any> = (Suite: SuiteSpecification<I, O>, Given: GivenSpecification<I, O>, When: WhenSpecification<I, O>, Then: ThenSpecification<I, O>) => BaseSuite<I, O>[];
|
|
18
19
|
export type ITestImplementation<I extends Ibdd_in_any, O extends Ibdd_out_any, modifier = {
|
|
19
20
|
whens: TestWhenImplementation<I, O>;
|
|
@@ -23,20 +24,22 @@ export type ITestImplementation<I extends Ibdd_in_any, O extends Ibdd_out_any, m
|
|
|
23
24
|
whens: TestWhenImplementation<I, O>;
|
|
24
25
|
thens: TestThenImplementation<I, O>;
|
|
25
26
|
}, modifier>;
|
|
26
|
-
export type
|
|
27
|
+
export type TestSpecShape<ISuites extends TestSuiteShape = TestSuiteShape, ISetups extends TestGivenShape = TestGivenShape, IActions extends TestWhenShape = TestWhenShape, IChecks extends TestThenShape = TestThenShape> = {
|
|
27
28
|
suites: ISuites;
|
|
28
|
-
givens:
|
|
29
|
-
whens:
|
|
30
|
-
thens:
|
|
29
|
+
givens: ISetups;
|
|
30
|
+
whens: IActions;
|
|
31
|
+
thens: IChecks;
|
|
31
32
|
};
|
|
32
|
-
export type
|
|
33
|
-
export type
|
|
33
|
+
export type TestSpecShape_any = TestSpecShape<TestSuiteShape, TestGivenShape, TestWhenShape, TestThenShape>;
|
|
34
|
+
export type Ibdd_out<ISuites, IGivens, IWhens, IThens> = TestSpecShape<ISuites, IGivens, IWhens, IThens>;
|
|
35
|
+
export type Ibdd_out_any = TestSpecShape_any;
|
|
36
|
+
export type TestTypeParams<IInput, // Type of initial test input
|
|
34
37
|
ISubject, // Type of object being tested
|
|
35
38
|
IStore, // Type for storing test state between steps
|
|
36
39
|
ISelection, // Type for selecting state for assertions
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
ISetup, // Type for Setup step functions (formerly Given)
|
|
41
|
+
IAction, // Type for Action step functions (formerly When)
|
|
42
|
+
ICheck> = {
|
|
40
43
|
/** Initial input required to start tests */
|
|
41
44
|
iinput: IInput;
|
|
42
45
|
/** The subject being tested (class, function, etc) */
|
|
@@ -45,11 +48,13 @@ IThen> = {
|
|
|
45
48
|
istore: IStore;
|
|
46
49
|
/** Selected portion of state for assertions */
|
|
47
50
|
iselection: ISelection;
|
|
48
|
-
/** Function type for
|
|
49
|
-
given:
|
|
50
|
-
/** Function type for
|
|
51
|
-
when:
|
|
52
|
-
/** Function type for
|
|
53
|
-
then:
|
|
51
|
+
/** Function type for Setup steps (Given/Arrange/Map) */
|
|
52
|
+
given: ISetup;
|
|
53
|
+
/** Function type for Action steps (When/Act/Feed) */
|
|
54
|
+
when: IAction;
|
|
55
|
+
/** Function type for Check steps (Then/Assert/Validate) */
|
|
56
|
+
then: ICheck;
|
|
54
57
|
};
|
|
55
|
-
export type
|
|
58
|
+
export type TestTypeParams_any = TestTypeParams<unknown, unknown, unknown, unknown, unknown, unknown, unknown>;
|
|
59
|
+
export type Ibdd_in<IInput, ISubject, IStore, ISelection, IGiven, IWhen, IThen> = TestTypeParams<IInput, ISubject, IStore, ISelection, IGiven, IWhen, IThen>;
|
|
60
|
+
export type Ibdd_in_any = TestTypeParams_any;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestTypeParams_any, TestSpecShape_any, ITestSpecification, ITestImplementation, ITestAdapter } from "./CoreTypes";
|
|
2
2
|
import BaseTiposkripto from "./BaseTiposkripto";
|
|
3
3
|
import { ITTestResourceRequest } from "./types";
|
|
4
|
-
export declare class NodeTiposkripto<I extends
|
|
4
|
+
export declare class NodeTiposkripto<I extends TestTypeParams_any, O extends TestSpecShape_any, M> extends BaseTiposkripto<I, O, M> {
|
|
5
5
|
constructor(input: I["iinput"], testSpecification: ITestSpecification<I, O>, testImplementation: ITestImplementation<I, O, M>, testResourceRequirement: ITTestResourceRequest, testAdapter: Partial<ITestAdapter<I>>);
|
|
6
6
|
writeFileSync(filename: string, payload: string): void;
|
|
7
7
|
}
|
|
8
|
-
declare const tiposkripto: <I extends
|
|
8
|
+
declare const tiposkripto: <I extends TestTypeParams_any, O extends TestSpecShape_any, M>(input: I["iinput"], testSpecification: ITestSpecification<I, O>, testImplementation: ITestImplementation<I, O, M>, testAdapter: Partial<ITestAdapter<I>>, testResourceRequirement?: ITTestResourceRequest) => Promise<BaseTiposkripto<I, O, M>>;
|
|
9
9
|
export default tiposkripto;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestTypeParams_any, TestSpecShape_any, ITestAdapter, ITestImplementation, ITestSpecification } from "./CoreTypes.js";
|
|
2
2
|
import BaseTiposkripto from "./BaseTiposkripto";
|
|
3
3
|
import { ITTestResourceRequest } from "./types";
|
|
4
|
-
export declare class WebTiposkripto<I extends
|
|
4
|
+
export declare class WebTiposkripto<I extends TestTypeParams_any, O extends TestSpecShape_any, M> extends BaseTiposkripto<I, O, M> {
|
|
5
5
|
constructor(input: I["iinput"], testSpecification: ITestSpecification<I, O>, testImplementation: ITestImplementation<I, O, M>, testResourceRequirement: ITTestResourceRequest, testAdapter: Partial<ITestAdapter<I>>);
|
|
6
6
|
writeFileSync(filename: string, payload: string): void;
|
|
7
7
|
}
|
|
8
|
-
declare const tiposkripto: <I extends
|
|
8
|
+
declare const tiposkripto: <I extends TestTypeParams_any, O extends TestSpecShape_any, M>(input: I["iinput"], testSpecification: ITestSpecification<I, O>, testImplementation: ITestImplementation<I, O, M>, testAdapter: Partial<ITestAdapter<I>>, testResourceRequirement?: ITTestResourceRequest) => Promise<BaseTiposkripto<I, O, M>>;
|
|
9
9
|
export default tiposkripto;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function suite(name: string): <T extends {
|
|
2
|
+
new (...args: any[]): {};
|
|
3
|
+
}>(constructor: T) => {
|
|
4
|
+
new (...args: any[]): {};
|
|
5
|
+
suiteName: string;
|
|
6
|
+
isTestSuite: boolean;
|
|
7
|
+
tests: Array<{
|
|
8
|
+
given: string;
|
|
9
|
+
when?: string;
|
|
10
|
+
then?: string;
|
|
11
|
+
method: string;
|
|
12
|
+
args?: any[];
|
|
13
|
+
}>;
|
|
14
|
+
} & T;
|
|
15
|
+
export declare function given(description: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
16
|
+
export declare function when(description: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
17
|
+
export declare function then(description: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
18
|
+
export declare function runSuite(testClass: any): Promise<{
|
|
19
|
+
suiteName: any;
|
|
20
|
+
tests: never[];
|
|
21
|
+
passed: boolean;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare class FluentTestBuilder<T = any> {
|
|
2
|
+
private givenDesc;
|
|
3
|
+
private setup;
|
|
4
|
+
private whenSteps;
|
|
5
|
+
private thenSteps;
|
|
6
|
+
constructor(givenDesc: string, setup: () => T | Promise<T>);
|
|
7
|
+
when<A extends any[]>(description: string, action: (store: T, ...args: A) => T | Promise<T>, ...args: A): this;
|
|
8
|
+
then<A extends any[]>(description: string, assertion: (store: T, ...args: A) => void | Promise<void>, ...args: A): this;
|
|
9
|
+
run(): Promise<{
|
|
10
|
+
success: boolean;
|
|
11
|
+
store?: T;
|
|
12
|
+
error?: any;
|
|
13
|
+
}>;
|
|
14
|
+
toBaseline(): {
|
|
15
|
+
specification: (Suite: any, Given: any, When: any, Then: any) => any[];
|
|
16
|
+
implementation: {
|
|
17
|
+
suites: {
|
|
18
|
+
Default: string;
|
|
19
|
+
};
|
|
20
|
+
givens: {
|
|
21
|
+
Default: () => () => T | Promise<T>;
|
|
22
|
+
};
|
|
23
|
+
whens: Record<string, Function>;
|
|
24
|
+
thens: Record<string, Function>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare function given<T>(description: string, setup: () => T | Promise<T>): FluentTestBuilder<T>;
|
|
29
|
+
export declare const flavored: {
|
|
30
|
+
given: typeof given;
|
|
31
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './Decorators';
|
|
2
|
+
export * from './FluentBuilder';
|
|
3
|
+
import { given, flavored } from './FluentBuilder';
|
|
4
|
+
import { suite, given as givenDecorator, when, then, runSuite } from './Decorators';
|
|
5
|
+
export { given, flavored, suite, givenDecorator, when, then, runSuite };
|
|
6
|
+
declare const _default: {
|
|
7
|
+
given: typeof given;
|
|
8
|
+
flavored: {
|
|
9
|
+
given: typeof given;
|
|
10
|
+
};
|
|
11
|
+
suite: typeof suite;
|
|
12
|
+
givenDecorator: typeof givenDecorator;
|
|
13
|
+
when: typeof when;
|
|
14
|
+
then: typeof then;
|
|
15
|
+
runSuite: typeof runSuite;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
import { Ibdd_in_any
|
|
2
|
-
export declare const BaseAdapter: <T extends
|
|
3
|
-
export declare const DefaultAdapter: <T extends
|
|
1
|
+
import { Ibdd_in_any } from "./CoreTypes";
|
|
2
|
+
export declare const BaseAdapter: <T extends TestTypeParams_any>() => IUniversalTestAdapter<T>;
|
|
3
|
+
export declare const DefaultAdapter: <T extends TestTypeParams_any>(p: Partial<IUniversalTestAdapter<T>>) => IUniversalTestAdapter<T>;
|
|
4
|
+
export { BaseSetup } from "./BaseSetup.js";
|
|
5
|
+
export { BaseAction } from "./BaseAction.js";
|
|
6
|
+
export { BaseCheck } from "./BaseCheck.js";
|
|
7
|
+
export { BaseArrange } from "./BaseArrange.js";
|
|
8
|
+
export { BaseAct } from "./BaseAct.js";
|
|
9
|
+
export { BaseAssert } from "./BaseAssert.js";
|
|
10
|
+
export { BaseMap } from "./BaseMap.js";
|
|
11
|
+
export { BaseFeed } from "./BaseFeed.js";
|
|
12
|
+
export { BaseValidate } from "./BaseValidate.js";
|
|
13
|
+
export { BaseGiven } from "./BaseGiven.js";
|
|
14
|
+
export { BaseWhen } from "./BaseWhen.js";
|
|
15
|
+
export { BaseThen } from "./BaseThen.js";
|
|
16
|
+
export declare function createAAASpecification<I extends Ibdd_in_any, O extends Ibdd_out_any>(Suite: any, Arrange: any, Act: any, Assert: any): {
|
|
17
|
+
Suite: {
|
|
18
|
+
Default: (name: string, arrangements: Record<string, any>) => any;
|
|
19
|
+
};
|
|
20
|
+
Arrange: {
|
|
21
|
+
Default: (features: string[], acts: any[], asserts: any[], arrangeCB: I["given"], initialValues: any) => any;
|
|
22
|
+
};
|
|
23
|
+
Act: {
|
|
24
|
+
Default: (name: string, actCB: (x: I["iselection"]) => I["then"]) => any;
|
|
25
|
+
};
|
|
26
|
+
Assert: {
|
|
27
|
+
Default: (name: string, assertCB: (val: I["iselection"]) => Promise<I["then"]>) => any;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function createTDTSpecification<I extends Ibdd_in_any, O extends Ibdd_out_any>(Suite: any, Map: any, Feed: any, Validate: any): {
|
|
31
|
+
Suite: {
|
|
32
|
+
Default: (name: string, maps: Record<string, any>) => any;
|
|
33
|
+
};
|
|
34
|
+
Map: {
|
|
35
|
+
Default: (features: string[], feeds: any[], validates: any[], mapCB: I["given"], initialValues: any, tableData?: any[]) => any;
|
|
36
|
+
};
|
|
37
|
+
Feed: {
|
|
38
|
+
Default: (name: string, feedCB: (x: I["iselection"]) => I["then"]) => any;
|
|
39
|
+
};
|
|
40
|
+
Validate: {
|
|
41
|
+
Default: (name: string, validateCB: (val: I["iselection"]) => Promise<I["then"]>) => any;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare const AAA: typeof createAAASpecification;
|
|
45
|
+
export declare const TDT: typeof createTDTSpecification;
|
|
@@ -21,6 +21,18 @@ export type ITTestResourceRequirement = {
|
|
|
21
21
|
ports: number;
|
|
22
22
|
fs: string;
|
|
23
23
|
};
|
|
24
|
+
export type ISetups<I extends TestTypeParams_any> = Record<string, import("./BaseSetup").BaseSetup<I>>;
|
|
25
|
+
export type IActions<I extends TestTypeParams_any> = Record<string, import("./BaseAction").BaseAction<I>>;
|
|
26
|
+
export type IChecks<I extends TestTypeParams_any> = Record<string, import("./BaseCheck").BaseCheck<I>>;
|
|
27
|
+
export type IArranges<I extends TestTypeParams_any> = Record<string, import("./BaseArrange").BaseArrange<I>>;
|
|
28
|
+
export type IActs<I extends TestTypeParams_any> = Record<string, import("./BaseAct").BaseAct<I>>;
|
|
29
|
+
export type IAsserts<I extends TestTypeParams_any> = Record<string, import("./BaseAssert").BaseAssert<I>>;
|
|
30
|
+
export type IMaps<I extends TestTypeParams_any> = Record<string, import("./BaseMap").BaseMap<I>>;
|
|
31
|
+
export type IFeeds<I extends TestTypeParams_any> = Record<string, import("./BaseFeed").BaseFeed<I>>;
|
|
32
|
+
export type IValidates<I extends TestTypeParams_any> = Record<string, import("./BaseValidate").BaseValidate<I>>;
|
|
33
|
+
export type IGivens<I extends TestTypeParams_any> = Record<string, import("./BaseGiven").BaseGiven<I>>;
|
|
34
|
+
export type IWhens<I extends TestTypeParams_any> = Record<string, import("./BaseWhen").BaseWhen<I>>;
|
|
35
|
+
export type IThens<I extends TestTypeParams_any> = Record<string, import("./BaseThen").BaseThen<I>>;
|
|
24
36
|
export type ITTestResourceRequest = {
|
|
25
37
|
ports: number;
|
|
26
38
|
};
|