Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a320d27a3 | |||
| 7910f9a856 | |||
| 05194609fe | |||
| eb0ec04199 | |||
| ffd5eb2e52 | |||
| c432079a70 | |||
| e2cab0bb59 | |||
| aaaa8b3ee4 | |||
| 4cc149069e | |||
| 6c106a4f22 | |||
| 85fca378ff | |||
| d096a08e42 | |||
| a715dd9e8c | |||
| ef8bf0a0d8 | |||
| f6d8910c45 | |||
| 0917b9dd06 |
3221
package-lock.json
generated
3221
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@apiglobal/test-sdk",
|
||||
"version": "1.0.16",
|
||||
"version": "1.0.24",
|
||||
"private": false,
|
||||
"description": "an sdk for testing ag handlers",
|
||||
"main": "dist_ts/index.js",
|
||||
@@ -12,18 +12,19 @@
|
||||
"build": "(tsbuild --web)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.43",
|
||||
"@gitzone/tsbuild": "^2.1.25",
|
||||
"@gitzone/tstest": "^1.0.44",
|
||||
"@pushrocks/tapbundle": "^3.2.9",
|
||||
"@types/node": "^14.0.26",
|
||||
"tslint": "^6.1.2",
|
||||
"@types/node": "^14.11.2",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apiglobal/sdk": "^1.0.9",
|
||||
"@apiglobal/typedrequest": "^1.0.40",
|
||||
"@apiglobal/sdk": "^1.0.13",
|
||||
"@apiglobal/typedrequest": "^1.0.43",
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||
"@pushrocks/smartexpress": "^3.0.73",
|
||||
"@pushrocks/qenv": "^4.0.10",
|
||||
"@pushrocks/smartexpress": "^3.0.76",
|
||||
"@pushrocks/smartobject": "^1.0.4"
|
||||
},
|
||||
"files": [
|
||||
|
||||
23
ts/index.ts
23
ts/index.ts
@@ -1,13 +1,22 @@
|
||||
import * as plugins from './test-sdk.plugins';
|
||||
import { AgTestServer } from './test-sdk.classes.testserver';
|
||||
import { AAgHandler } from '@apiglobal/sdk';
|
||||
|
||||
export {
|
||||
AgTestServer
|
||||
};
|
||||
|
||||
let testServer: AgTestServer;
|
||||
export const createTestServer = async (handlerArg: plugins.agSdk.AAgHandler<any>) => {
|
||||
testServer = new AgTestServer(handlerArg);
|
||||
let handler: AAgHandler<any>;
|
||||
export const createTestServer = async (handlerArg: { new(envHandler: plugins.agSdk.AgEnvironment): plugins.agSdk.AAgHandler<any> }) => {
|
||||
class AgEnvironement extends plugins.agSdk.AgEnvironment {
|
||||
public qenv = new plugins.qenv.Qenv('./', './.nogit');
|
||||
public async getEnvVar(nameArg: string) {
|
||||
return this.qenv.getEnvVarOnDemand(nameArg);
|
||||
}
|
||||
}
|
||||
handler = new handlerArg(new AgEnvironement())
|
||||
testServer = new AgTestServer(handler);
|
||||
await testServer.start();
|
||||
return testServer;
|
||||
};
|
||||
@@ -38,7 +47,13 @@ export const testFire = <
|
||||
if (comparisonResult.divergingProperties.length > 0) {
|
||||
console.log(`The following properties diverged:`);
|
||||
console.log(comparisonResult.divergingProperties);
|
||||
throwErrorBool = true;
|
||||
for (const divProperty of comparisonResult.divergingProperties) {
|
||||
if (expectedResponseArg[divProperty] !== 'maydiverge') {
|
||||
throwErrorBool = true;
|
||||
} else {
|
||||
console.log(`${divProperty} may diverge, not throwing for this one`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (comparisonResult.missingProperties.length > 0) {
|
||||
console.log(`The following properties diverged:`);
|
||||
@@ -48,6 +63,7 @@ export const testFire = <
|
||||
if (throwErrorBool) {
|
||||
throw new Error('response did not comply');
|
||||
}
|
||||
return actualResponse;
|
||||
};
|
||||
return {
|
||||
expect
|
||||
@@ -57,5 +73,6 @@ export const testFire = <
|
||||
export const stopTestServer = async () => {
|
||||
if (testServer) {
|
||||
await testServer.stop();
|
||||
await handler.stop();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,7 +6,8 @@ import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
||||
export { agSdk, typedrequest, typedrequestInterfaces };
|
||||
|
||||
// pushrocks scope
|
||||
import * as qenv from '@pushrocks/qenv';
|
||||
import * as smartexpress from '@pushrocks/smartexpress';
|
||||
import * as smartobject from '@pushrocks/smartobject';
|
||||
|
||||
export { smartexpress, smartobject };
|
||||
export { qenv, smartexpress, smartobject };
|
||||
|
||||
Reference in New Issue
Block a user