@mcp-abap-adt/adt-clients 3.7.0 → 3.8.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/dist/core/unitTest/AdtCdsUnitTest.d.ts +8 -6
- package/dist/core/unitTest/AdtCdsUnitTest.d.ts.map +1 -1
- package/dist/core/unitTest/AdtCdsUnitTest.js +37 -40
- package/dist/core/unitTest/{validateCdsForUnitTest.d.ts → checkCdsTestDoublesAvailability.d.ts} +11 -8
- package/dist/core/unitTest/checkCdsTestDoublesAvailability.d.ts.map +1 -0
- package/dist/core/unitTest/{validateCdsForUnitTest.js → checkCdsTestDoublesAvailability.js} +11 -8
- package/package.json +4 -1
- package/dist/core/unitTest/validateCdsForUnitTest.d.ts.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* AdtCdsUnitTest - High-level CRUD operations for CDS Unit Test objects
|
|
3
3
|
*
|
|
4
4
|
* Extends AdtUnitTest with CDS-specific functionality:
|
|
5
|
-
* -
|
|
5
|
+
* - Checks CDS view availability for unit test doubles
|
|
6
6
|
* - Creates test classes with CDS templates
|
|
7
7
|
* - Manages test class lifecycle (create, update, delete)
|
|
8
8
|
* - Runs unit tests for CDS views
|
|
@@ -25,7 +25,7 @@ export interface ICdsUnitTestConfig extends IUnitTestConfig {
|
|
|
25
25
|
}
|
|
26
26
|
export interface ICdsUnitTestState extends IUnitTestState {
|
|
27
27
|
testClassState?: IClassState;
|
|
28
|
-
|
|
28
|
+
cdsCheckResponse?: AxiosResponse;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* AdtCdsUnitTest - CDS-specific unit test operations
|
|
@@ -38,11 +38,13 @@ export declare class AdtCdsUnitTest extends AdtUnitTest {
|
|
|
38
38
|
private className?;
|
|
39
39
|
constructor(connection: IAbapConnection, logger?: ILogger);
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
* This
|
|
43
|
-
*
|
|
41
|
+
* Check CDS view availability for unit test doubles
|
|
42
|
+
* This check is required before creating a CDS unit test class.
|
|
43
|
+
*
|
|
44
|
+
* Unlike validate() (which checks name/params before create), this checks whether
|
|
45
|
+
* a CDS view can be used with the test doubles framework (cl_cds_test_environment).
|
|
44
46
|
*/
|
|
45
|
-
|
|
47
|
+
checkCdsTestDoubles(cdsViewName: string): Promise<ICdsUnitTestState>;
|
|
46
48
|
/**
|
|
47
49
|
* Override: Create test class with CDS template and test class source
|
|
48
50
|
* For CDS: creates a global minimal class and adds local test class to it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdtCdsUnitTest.d.ts","sourceRoot":"","sources":["../../../src/core/unitTest/AdtCdsUnitTest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EACf,OAAO,EACR,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"AdtCdsUnitTest.d.ts","sourceRoot":"","sources":["../../../src/core/unitTest/AdtCdsUnitTest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EACf,OAAO,EACR,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,kBAAmB,SAAQ,eAAe;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AwClB;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;OAEG;IACH,cAAc,IAAI,MAAM,GAAG,SAAS;CAGrC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* AdtCdsUnitTest - High-level CRUD operations for CDS Unit Test objects
|
|
4
4
|
*
|
|
5
5
|
* Extends AdtUnitTest with CDS-specific functionality:
|
|
6
|
-
* -
|
|
6
|
+
* - Checks CDS view availability for unit test doubles
|
|
7
7
|
* - Creates test classes with CDS templates
|
|
8
8
|
* - Manages test class lifecycle (create, update, delete)
|
|
9
9
|
* - Runs unit tests for CDS views
|
|
@@ -16,7 +16,7 @@ const internalUtils_1 = require("../../utils/internalUtils");
|
|
|
16
16
|
const run_1 = require("../class/run");
|
|
17
17
|
const AdtView_1 = require("../view/AdtView");
|
|
18
18
|
const AdtUnitTest_1 = require("./AdtUnitTest");
|
|
19
|
-
const
|
|
19
|
+
const checkCdsTestDoublesAvailability_1 = require("./checkCdsTestDoublesAvailability");
|
|
20
20
|
/**
|
|
21
21
|
* AdtCdsUnitTest - CDS-specific unit test operations
|
|
22
22
|
*
|
|
@@ -33,49 +33,46 @@ class AdtCdsUnitTest extends AdtUnitTest_1.AdtUnitTest {
|
|
|
33
33
|
this.adtView = new AdtView_1.AdtView(connection, logger);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
* This
|
|
38
|
-
*
|
|
36
|
+
* Check CDS view availability for unit test doubles
|
|
37
|
+
* This check is required before creating a CDS unit test class.
|
|
38
|
+
*
|
|
39
|
+
* Unlike validate() (which checks name/params before create), this checks whether
|
|
40
|
+
* a CDS view can be used with the test doubles framework (cl_cds_test_environment).
|
|
39
41
|
*/
|
|
40
|
-
async
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
`Validation failed with severity: ${severity}`;
|
|
58
|
-
throw new Error(`CDS view ${config.cdsViewName} validation for unit test doubles failed: ${errorMessage}`);
|
|
59
|
-
}
|
|
60
|
-
this.logger?.info?.('CDS view validated successfully for unit test doubles');
|
|
61
|
-
this.cdsViewName = config.cdsViewName;
|
|
62
|
-
const state = {
|
|
63
|
-
cdsValidationResponse: response,
|
|
64
|
-
errors: [],
|
|
65
|
-
};
|
|
66
|
-
return state;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
throw new Error(`CDS view validation failed with HTTP ${response.status}`);
|
|
42
|
+
async checkCdsTestDoubles(cdsViewName) {
|
|
43
|
+
try {
|
|
44
|
+
this.logger?.info?.('Checking CDS view for unit test doubles:', cdsViewName);
|
|
45
|
+
const response = await (0, checkCdsTestDoublesAvailability_1.checkCdsTestDoublesAvailability)(this.connection, cdsViewName);
|
|
46
|
+
// Check if the check succeeded (SEVERITY=OK)
|
|
47
|
+
if (response?.status === 200) {
|
|
48
|
+
const { XMLParser } = require('fast-xml-parser');
|
|
49
|
+
const parser = new XMLParser({ ignoreAttributes: false });
|
|
50
|
+
const parsed = parser.parse(response.data);
|
|
51
|
+
const severity = parsed?.['asx:abap']?.['asx:values']?.DATA?.SEVERITY;
|
|
52
|
+
if (severity !== 'OK') {
|
|
53
|
+
const shortText = parsed?.['asx:abap']?.['asx:values']?.DATA?.SHORT_TEXT || '';
|
|
54
|
+
const longText = parsed?.['asx:abap']?.['asx:values']?.DATA?.LONG_TEXT || '';
|
|
55
|
+
const errorMessage = shortText ||
|
|
56
|
+
longText ||
|
|
57
|
+
`CDS test doubles check failed with severity: ${severity}`;
|
|
58
|
+
throw new Error(`CDS view ${cdsViewName} is not available for unit test doubles: ${errorMessage}`);
|
|
70
59
|
}
|
|
60
|
+
this.logger?.info?.('CDS view available for unit test doubles');
|
|
61
|
+
this.cdsViewName = cdsViewName;
|
|
62
|
+
const state = {
|
|
63
|
+
cdsCheckResponse: response,
|
|
64
|
+
errors: [],
|
|
65
|
+
};
|
|
66
|
+
return state;
|
|
71
67
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
throw error;
|
|
68
|
+
else {
|
|
69
|
+
throw new Error(`CDS test doubles check failed with HTTP ${response.status}`);
|
|
75
70
|
}
|
|
76
71
|
}
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
catch (error) {
|
|
73
|
+
this.logger?.error('checkCdsTestDoubles failed:', error);
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
79
76
|
}
|
|
80
77
|
/**
|
|
81
78
|
* Override: Create test class with CDS template and test class source
|
package/dist/core/unitTest/{validateCdsForUnitTest.d.ts → checkCdsTestDoublesAvailability.d.ts}
RENAMED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Uses ADT
|
|
2
|
+
* Check CDS view availability for unit test doubles
|
|
3
|
+
* Uses ADT endpoint: /sap/bc/adt/aunit/dbtestdoubles/cds/validation
|
|
4
|
+
*
|
|
5
|
+
* This is NOT a standard ADT validation (which checks name/params before create).
|
|
6
|
+
* It checks whether a CDS view can be used with the test doubles framework
|
|
7
|
+
* (cl_cds_test_environment).
|
|
4
8
|
*/
|
|
5
9
|
import type { IAdtResponse as AxiosResponse, IAbapConnection } from '@mcp-abap-adt/interfaces';
|
|
6
10
|
/**
|
|
7
|
-
*
|
|
8
|
-
* This validation is required before creating a CDS unit test class
|
|
11
|
+
* Check CDS view availability for unit test doubles
|
|
9
12
|
*
|
|
10
13
|
* Endpoint: POST /sap/bc/adt/aunit/dbtestdoubles/cds/validation?ddlName={viewName}
|
|
11
14
|
*
|
|
12
|
-
* What this
|
|
13
|
-
* - Whether the CDS view is active (must be activated before
|
|
15
|
+
* What this checks:
|
|
16
|
+
* - Whether the CDS view is active (must be activated before check)
|
|
14
17
|
* - Whether the view structure allows creation of test doubles (temporary updatable copies)
|
|
15
18
|
* - Whether dependent components (tables, views) can be replaced with test doubles
|
|
16
19
|
* - Whether there are any restrictions preventing use of the view in test doubles framework
|
|
@@ -23,5 +26,5 @@ import type { IAdtResponse as AxiosResponse, IAbapConnection } from '@mcp-abap-a
|
|
|
23
26
|
* - Success: <SEVERITY>OK</SEVERITY>
|
|
24
27
|
* - Error: <SEVERITY>ERROR</SEVERITY> with <SHORT_TEXT> and <LONG_TEXT>
|
|
25
28
|
*/
|
|
26
|
-
export declare function
|
|
27
|
-
//# sourceMappingURL=
|
|
29
|
+
export declare function checkCdsTestDoublesAvailability(connection: IAbapConnection, viewName: string): Promise<AxiosResponse>;
|
|
30
|
+
//# sourceMappingURL=checkCdsTestDoublesAvailability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkCdsTestDoublesAvailability.d.ts","sourceRoot":"","sources":["../../../src/core/unitTest/checkCdsTestDoublesAvailability.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAIlC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,+BAA+B,CACnD,UAAU,EAAE,eAAe,EAC3B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,CAAC,CAiBxB"}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Uses ADT
|
|
3
|
+
* Check CDS view availability for unit test doubles
|
|
4
|
+
* Uses ADT endpoint: /sap/bc/adt/aunit/dbtestdoubles/cds/validation
|
|
5
|
+
*
|
|
6
|
+
* This is NOT a standard ADT validation (which checks name/params before create).
|
|
7
|
+
* It checks whether a CDS view can be used with the test doubles framework
|
|
8
|
+
* (cl_cds_test_environment).
|
|
5
9
|
*/
|
|
6
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
11
|
+
exports.checkCdsTestDoublesAvailability = checkCdsTestDoublesAvailability;
|
|
8
12
|
const internalUtils_1 = require("../../utils/internalUtils");
|
|
9
13
|
const timeouts_1 = require("../../utils/timeouts");
|
|
10
14
|
/**
|
|
11
|
-
*
|
|
12
|
-
* This validation is required before creating a CDS unit test class
|
|
15
|
+
* Check CDS view availability for unit test doubles
|
|
13
16
|
*
|
|
14
17
|
* Endpoint: POST /sap/bc/adt/aunit/dbtestdoubles/cds/validation?ddlName={viewName}
|
|
15
18
|
*
|
|
16
|
-
* What this
|
|
17
|
-
* - Whether the CDS view is active (must be activated before
|
|
19
|
+
* What this checks:
|
|
20
|
+
* - Whether the CDS view is active (must be activated before check)
|
|
18
21
|
* - Whether the view structure allows creation of test doubles (temporary updatable copies)
|
|
19
22
|
* - Whether dependent components (tables, views) can be replaced with test doubles
|
|
20
23
|
* - Whether there are any restrictions preventing use of the view in test doubles framework
|
|
@@ -27,7 +30,7 @@ const timeouts_1 = require("../../utils/timeouts");
|
|
|
27
30
|
* - Success: <SEVERITY>OK</SEVERITY>
|
|
28
31
|
* - Error: <SEVERITY>ERROR</SEVERITY> with <SHORT_TEXT> and <LONG_TEXT>
|
|
29
32
|
*/
|
|
30
|
-
async function
|
|
33
|
+
async function checkCdsTestDoublesAvailability(connection, viewName) {
|
|
31
34
|
const url = `/sap/bc/adt/aunit/dbtestdoubles/cds/validation`;
|
|
32
35
|
const encodedName = (0, internalUtils_1.encodeSapObjectName)(viewName);
|
|
33
36
|
const queryParams = new URLSearchParams({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-abap-adt/adt-clients",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "ADT clients for SAP ABAP systems - AdtClient and AdtRuntimeClient",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -54,6 +54,9 @@
|
|
|
54
54
|
"package:contents": "npx ts-node scripts/show-package-contents.ts",
|
|
55
55
|
"discovery:markdown": "npx ts-node tools/discovery-to-markdown.ts",
|
|
56
56
|
"adt:entities": "node tools/adt-object-entities.js",
|
|
57
|
+
"shared:setup": "npx jest --testPathIgnorePatterns '/node_modules/' --testPathPatterns 'admin/shared-deps/setup'",
|
|
58
|
+
"shared:teardown": "npx jest --testPathIgnorePatterns '/node_modules/' --testPathPatterns 'admin/shared-deps/teardown'",
|
|
59
|
+
"shared:check": "npx jest --testPathIgnorePatterns '/node_modules/' --testPathPatterns 'admin/shared-deps/check'",
|
|
57
60
|
"pretest": "npm run test:check:integration",
|
|
58
61
|
"prepublishOnly": "npm run build"
|
|
59
62
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateCdsForUnitTest.d.ts","sourceRoot":"","sources":["../../../src/core/unitTest/validateCdsForUnitTest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,YAAY,IAAI,aAAa,EAC7B,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAIlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,eAAe,EAC3B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,CAAC,CAiBxB"}
|