Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c387a633bb | |||
| 99efc2d5fe | |||
| e146b7741d | |||
| 02866cbe8d | |||
| 7a320d27a3 | |||
| 7910f9a856 | |||
| 05194609fe | |||
| eb0ec04199 |
62
package-lock.json
generated
62
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@apiglobal/test-sdk",
|
"name": "@apiglobal/test-sdk",
|
||||||
"version": "1.0.22",
|
"version": "1.0.26",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1395,6 +1395,64 @@
|
|||||||
"symbol-tree": "^3.2.4"
|
"symbol-tree": "^3.2.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@pushrocks/qenv": {
|
||||||
|
"version": "4.0.10",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fqenv/-/qenv-4.0.10.tgz",
|
||||||
|
"integrity": "sha512-bQknJrGa9zXDTmohi2W0fi/gZ5H36J1138WsRgdR2u/9D/0gwjBasL0kqBokH9sddcLSYe/H9itGFxbT7i7MCg==",
|
||||||
|
"requires": {
|
||||||
|
"@pushrocks/smartfile": "^7.0.12",
|
||||||
|
"@pushrocks/smartlog": "^2.0.26"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@pushrocks/smartfile": {
|
||||||
|
"version": "7.0.12",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.12.tgz",
|
||||||
|
"integrity": "sha512-/4T4K07WqOXGvQQ/VFyRMUd8kN1RdqQgmrqHjZE/vMDLz7RYsqU9FlEN6OGX1G1E6pR9IdHnT4ClXPlvzClHYg==",
|
||||||
|
"requires": {
|
||||||
|
"@pushrocks/smarthash": "^2.1.6",
|
||||||
|
"@pushrocks/smartmime": "^1.0.3",
|
||||||
|
"@pushrocks/smartpath": "^4.0.1",
|
||||||
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
|
"@pushrocks/smartrequest": "^1.1.47",
|
||||||
|
"@types/fs-extra": "^8.1.0",
|
||||||
|
"fs-extra": "^8.1.0",
|
||||||
|
"glob": "^7.1.6",
|
||||||
|
"js-yaml": "^3.13.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/fs-extra": {
|
||||||
|
"version": "8.1.1",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-8.1.1.tgz",
|
||||||
|
"integrity": "sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w==",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fs-extra": {
|
||||||
|
"version": "8.1.0",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||||
|
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
|
||||||
|
"requires": {
|
||||||
|
"graceful-fs": "^4.2.0",
|
||||||
|
"jsonfile": "^4.0.0",
|
||||||
|
"universalify": "^0.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"jsonfile": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/jsonfile/-/jsonfile-4.0.0.tgz",
|
||||||
|
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
|
||||||
|
"requires": {
|
||||||
|
"graceful-fs": "^4.1.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"universalify": {
|
||||||
|
"version": "0.1.2",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/universalify/-/universalify-0.1.2.tgz",
|
||||||
|
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@pushrocks/smartbrowser": {
|
"@pushrocks/smartbrowser": {
|
||||||
"version": "1.0.17",
|
"version": "1.0.17",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartbrowser/-/smartbrowser-1.0.17.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartbrowser/-/smartbrowser-1.0.17.tgz",
|
||||||
@@ -1583,7 +1641,6 @@
|
|||||||
"version": "2.0.39",
|
"version": "2.0.39",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.39.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.39.tgz",
|
||||||
"integrity": "sha512-fHCoBLwKM+F3jN5nZH6QEcEVWtgyESN+ysT9KLxmM/wrhIibG98yLxp6kwfZZbv6aKmHWbtKEvBmv+Vd4Hfwlg==",
|
"integrity": "sha512-fHCoBLwKM+F3jN5nZH6QEcEVWtgyESN+ysT9KLxmM/wrhIibG98yLxp6kwfZZbv6aKmHWbtKEvBmv+Vd4Hfwlg==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/isounique": "^1.0.4",
|
"@pushrocks/isounique": "^1.0.4",
|
||||||
"@pushrocks/smartlog-interfaces": "^2.0.20"
|
"@pushrocks/smartlog-interfaces": "^2.0.20"
|
||||||
@@ -1604,7 +1661,6 @@
|
|||||||
"version": "2.0.22",
|
"version": "2.0.22",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog-interfaces/-/smartlog-interfaces-2.0.22.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog-interfaces/-/smartlog-interfaces-2.0.22.tgz",
|
||||||
"integrity": "sha512-blvtNLgYz08F5EhftxfzLEkQ3VE9uoXRVQukbVpwJ4Zk0QRkNg2VCkuJu/kkfbtlCEOEOG2HCZDyhbxeEeq0pA==",
|
"integrity": "sha512-blvtNLgYz08F5EhftxfzLEkQ3VE9uoXRVQukbVpwJ4Zk0QRkNg2VCkuJu/kkfbtlCEOEOG2HCZDyhbxeEeq0pA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.15"
|
"@apiglobal/typedrequest-interfaces": "^1.0.15"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@apiglobal/test-sdk",
|
"name": "@apiglobal/test-sdk",
|
||||||
"version": "1.0.22",
|
"version": "1.0.26",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "an sdk for testing ag handlers",
|
"description": "an sdk for testing ag handlers",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"@apiglobal/sdk": "^1.0.13",
|
"@apiglobal/sdk": "^1.0.13",
|
||||||
"@apiglobal/typedrequest": "^1.0.43",
|
"@apiglobal/typedrequest": "^1.0.43",
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||||
|
"@pushrocks/qenv": "^4.0.10",
|
||||||
"@pushrocks/smartexpress": "^3.0.76",
|
"@pushrocks/smartexpress": "^3.0.76",
|
||||||
"@pushrocks/smartobject": "^1.0.4"
|
"@pushrocks/smartobject": "^1.0.4"
|
||||||
},
|
},
|
||||||
|
|||||||
18
ts/index.ts
18
ts/index.ts
@@ -1,18 +1,24 @@
|
|||||||
import * as plugins from './test-sdk.plugins';
|
import * as plugins from './test-sdk.plugins';
|
||||||
import { AgTestServer } from './test-sdk.classes.testserver';
|
import { AgTestServer } from './test-sdk.classes.testserver';
|
||||||
|
import { AAgHandler } from '@apiglobal/sdk';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AgTestServer
|
AgTestServer
|
||||||
};
|
};
|
||||||
|
|
||||||
let testServer: AgTestServer;
|
let testServer: AgTestServer;
|
||||||
export const createTestServer = async (handlerArg: { new(envHandler: plugins.agSdk.AgEnvironment): plugins.agSdk.AAgHandler<any> }) => {
|
let handler: AAgHandler<any>;
|
||||||
|
export const createTestServer = async (handlerArg: { new(envManagerArg: plugins.agSdk.AgEnvironment): plugins.agSdk.AAgHandler<any> }) => {
|
||||||
class AgEnvironement extends plugins.agSdk.AgEnvironment {
|
class AgEnvironement extends plugins.agSdk.AgEnvironment {
|
||||||
|
public qenv = new plugins.qenv.Qenv('./', './.nogit');
|
||||||
public async getEnvVar(nameArg: string) {
|
public async getEnvVar(nameArg: string) {
|
||||||
return '';
|
return this.qenv.getEnvVarOnDemand(nameArg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
testServer = new AgTestServer(new handlerArg(new AgEnvironement()));
|
handler = new handlerArg(new AgEnvironement());
|
||||||
|
console.log(`now checking requirements for handler with slug ${handler.slug}...`);
|
||||||
|
await handler.checkRequirements();
|
||||||
|
testServer = new AgTestServer(handler);
|
||||||
await testServer.start();
|
await testServer.start();
|
||||||
return testServer;
|
return testServer;
|
||||||
};
|
};
|
||||||
@@ -57,6 +63,11 @@ export const testFire = <
|
|||||||
throwErrorBool = true;
|
throwErrorBool = true;
|
||||||
}
|
}
|
||||||
if (throwErrorBool) {
|
if (throwErrorBool) {
|
||||||
|
console.log('Result: response did not comply');
|
||||||
|
console.log('-> expected:');
|
||||||
|
console.log(expectedResponseArg);
|
||||||
|
console.log('-> but actually received:');
|
||||||
|
console.log(actualResponse);
|
||||||
throw new Error('response did not comply');
|
throw new Error('response did not comply');
|
||||||
}
|
}
|
||||||
return actualResponse;
|
return actualResponse;
|
||||||
@@ -69,5 +80,6 @@ export const testFire = <
|
|||||||
export const stopTestServer = async () => {
|
export const stopTestServer = async () => {
|
||||||
if (testServer) {
|
if (testServer) {
|
||||||
await testServer.stop();
|
await testServer.stop();
|
||||||
|
await handler.stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
|||||||
export { agSdk, typedrequest, typedrequestInterfaces };
|
export { agSdk, typedrequest, typedrequestInterfaces };
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
|
import * as qenv from '@pushrocks/qenv';
|
||||||
import * as smartexpress from '@pushrocks/smartexpress';
|
import * as smartexpress from '@pushrocks/smartexpress';
|
||||||
import * as smartobject from '@pushrocks/smartobject';
|
import * as smartobject from '@pushrocks/smartobject';
|
||||||
|
|
||||||
export { smartexpress, smartobject };
|
export { qenv, smartexpress, smartobject };
|
||||||
|
|||||||
Reference in New Issue
Block a user