Skip to content

Commit 4ba6f4b

Browse files
committed
feat(test-tooling): all in one besu ledger
Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 5782eb8 commit 4ba6f4b

File tree

17 files changed

+803
-130
lines changed

17 files changed

+803
-130
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ examples/simple-asset-transfer/fabric/**/hfc-key-store/
3737
bin/
3838
.tmp/
3939
lerna-debug.log
40+
bif-openapi-spec.json

package-lock.json

+22-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
"scripts": {
55
"configure": "lerna clean --yes && lerna bootstrap && npm run build && node ./tools/generate-api-server-config.js",
66
"start:api-server": "node ./packages/bif-cmd-api-server/dist/lib/main/typescript/cmd/bif-api.js --config-file=.config.json",
7-
"generate-sdk": "openapi-generator generate -i x.json -g typescript-axios -o packages/bif-sdk/src/main/typescript/generated/openapi/typescript-axios/",
7+
"pregenerate-sdk": "ts-node -e 'import(\"./packages/bif-cmd-api-server/src/main/typescript/openapi-spec\").then((x) => x.exportToFileSystemAsJson());'",
8+
"generate-sdk": "openapi-generator generate --input-spec bif-openapi-spec.json -g typescript-axios -o packages/bif-sdk/src/main/typescript/generated/openapi/typescript-axios/",
89
"tsc": "lerna exec --stream --ignore '*/*cockpit' -- tsc --project ./tsconfig.json",
910
"clean": "lerna exec --stream --ignore '*/*cockpit' -- del-cli dist/** && del-cli packages/bif-sdk/src/main/typescript/generated/openapi/typescript-axios/*",
1011
"build": "npm-run-all build:backend build:frontend",
1112
"build:frontend": "lerna exec --stream --scope '*/*cockpit' -- ng build --prod",
1213
"build:backend": "npm-run-all lint clean generate-sdk tsc webpack",
1314
"build:dev:pkg:cmd-api-server": "lerna exec --stream --scope '*/*api-server' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'",
15+
"build:dev:pkg:test-tooling": "lerna exec --stream --scope '*/*test-tooling' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'",
1416
"build:dev:pkg:sdk": "lerna exec --stream --scope '*/*sdk' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'",
1517
"webpack": "npm-run-all webpack:web:dev webpack:node:dev webpack:web:prod webpack:node:prod",
16-
"webpack:web:prod": "lerna exec --stream --ignore '*/*{cockpit,server}' -- webpack --env=prod --target=web --config ../../webpack.config.js",
17-
"webpack:web:dev": "lerna exec --stream --ignore '*/*{cockpit,server}' -- webpack --env=dev --target=web --config ../../webpack.config.js",
18+
"webpack:web:prod": "lerna exec --stream --ignore '*/*{cockpit,server,test-tooling}' -- webpack --env=prod --target=web --config ../../webpack.config.js",
19+
"webpack:web:dev": "lerna exec --stream --ignore '*/*{cockpit,server,test-tooling}' -- webpack --env=dev --target=web --config ../../webpack.config.js",
1820
"webpack:node:prod": "lerna exec --stream --ignore '*/*cockpit' -- webpack --env=prod --target=node --config ../../webpack.config.js",
1921
"webpack:node:dev": "lerna exec --stream --ignore '*/*cockpit' -- webpack --env=dev --target=node --config ../../webpack.config.js",
2022
"changelog": "conventional-changelog --infile CHANGELOG.md --outfile CHANGELOG.md && git add CHANGELOG.md",
@@ -23,6 +25,7 @@
2325
"lint": "lerna exec --stream --ignore '*/*cockpit' -- cross-env DEBUG= tslint --project tsconfig.json",
2426
"pretest": "npm run build",
2527
"test": "lerna exec --stream --ignore '*/*cockpit' -- tap --timeout=600 src/test/typescript/unit/",
28+
"test:bif-test-tooling": "lerna exec --stream --scope '*/*test-tooling' -- tap --timeout=600 src/test/typescript/integration/",
2629
"test-coverage": "lerna exec --stream --ignore '*/*cockpit' -- tap --timeout=600 src/test/typescript/unit/ --cov",
2730
"test-coverage-html": "lerna exec --stream --ignore '*/*cockpit' -- tap --timeout=600 src/test/typescript/unit/ --cov --coverage-report=lcov",
2831
"test-integration": "lerna exec --stream --ignore '*/*cockpit' -- tap --timeout=600 src/test/typescript/integration/",
@@ -51,6 +54,7 @@
5154
"source-map-loader": "0.2.4",
5255
"tap": "14.10.6",
5356
"ts-loader": "6.2.1",
57+
"ts-node": "8.9.1",
5458
"tslint": "6.0.0",
5559
"typescript": "3.7.5",
5660
"webpack": "4.41.6",

packages/bif-cmd-api-server/src/main/typescript/openapi-spec.ts

+9
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,12 @@ export const BIF_OPEN_API_JSON: OpenAPI.OpenAPIV3.Document = {
123123
}
124124
}
125125
};
126+
127+
export async function exportToFileSystemAsJson(): Promise<void> {
128+
const fs = await import('fs');
129+
const destination = process.argv[2] || './bif-openapi-spec.json';
130+
131+
// tslint:disable-next-line: no-console
132+
console.log(`OpenApiSpec#exportToFileSystemAsJson() destination=${destination}`);
133+
fs.writeFileSync(destination, JSON.stringify(BIF_OPEN_API_JSON, null, 4));
134+
};

packages/bif-test-tooling/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# `@hyperledger-labs/bif-test-tooling`
2+
3+
> TODO: description
4+
5+
## Usage
6+
7+
```
8+
// TODO: DEMONSTRATE API
9+
```

0 commit comments

Comments
 (0)