Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a715dd9e8c | |||
| ef8bf0a0d8 | |||
| f6d8910c45 | |||
| 0917b9dd06 | |||
| 0455c34cfa | |||
| a69fee7985 | |||
| 3e0d01520e | |||
| 7c4db19825 |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@apiglobal/test-sdk",
|
"name": "@apiglobal/test-sdk",
|
||||||
"version": "1.0.14",
|
"version": "1.0.18",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@apiglobal/test-sdk",
|
"name": "@apiglobal/test-sdk",
|
||||||
"version": "1.0.14",
|
"version": "1.0.18",
|
||||||
"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",
|
||||||
|
|||||||
@@ -38,7 +38,13 @@ export const testFire = <
|
|||||||
if (comparisonResult.divergingProperties.length > 0) {
|
if (comparisonResult.divergingProperties.length > 0) {
|
||||||
console.log(`The following properties diverged:`);
|
console.log(`The following properties diverged:`);
|
||||||
console.log(comparisonResult.divergingProperties);
|
console.log(comparisonResult.divergingProperties);
|
||||||
|
for (const divProperty of comparisonResult.divergingProperties) {
|
||||||
|
if (expectedResponseArg[divProperty] !== 'maydiverge') {
|
||||||
throwErrorBool = true;
|
throwErrorBool = true;
|
||||||
|
} else {
|
||||||
|
console.log(`${divProperty} may diverge, not throwing for this one`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (comparisonResult.missingProperties.length > 0) {
|
if (comparisonResult.missingProperties.length > 0) {
|
||||||
console.log(`The following properties diverged:`);
|
console.log(`The following properties diverged:`);
|
||||||
|
|||||||
@@ -6,30 +6,37 @@ export class AgTestServer {
|
|||||||
|
|
||||||
constructor(handlerArg?: plugins.agSdk.AAgHandler<any>) {
|
constructor(handlerArg?: plugins.agSdk.AAgHandler<any>) {
|
||||||
if (handlerArg) {
|
if (handlerArg) {
|
||||||
this.handlers.push(handlerArg);
|
this.addAgHandler(handlerArg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async addAgHandler(handlerArg: plugins.agSdk.AAgHandler<any>) {
|
public async addAgHandler(handlerArg: plugins.agSdk.AAgHandler<any>) {
|
||||||
this.handlers.push(handlerArg);
|
this.handlers.push(handlerArg);
|
||||||
|
console.log(`added handler with slug ${handlerArg.slug}`);
|
||||||
|
if (this.server && this.server.serverStatus === 'running') {
|
||||||
await this.stop();
|
await this.stop();
|
||||||
await this.start();
|
await this.start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async start() {
|
public async start() {
|
||||||
this.server = new plugins.smartexpress.Server({
|
this.server = new plugins.smartexpress.Server({
|
||||||
cors: true,
|
cors: true,
|
||||||
|
forceSsl: false,
|
||||||
defaultAnswer: async () => 'apiglobal testserver',
|
defaultAnswer: async () => 'apiglobal testserver',
|
||||||
domain: 'localhost',
|
domain: 'localhost',
|
||||||
port: 3000,
|
port: 3000,
|
||||||
forceSsl: false,
|
|
||||||
});
|
});
|
||||||
for (const handlerArg of this.handlers) {
|
for (const handlerArg of this.handlers) {
|
||||||
|
console.log(`found handler with slug ${handlerArg.slug}`);
|
||||||
await handlerArg.start();
|
await handlerArg.start();
|
||||||
|
console.log(`started handler with slug ${handlerArg.slug}`);
|
||||||
|
const slugroute = `/${handlerArg.slug}`;
|
||||||
this.server.addRoute(
|
this.server.addRoute(
|
||||||
`/${handlerArg.slug}`,
|
slugroute,
|
||||||
new plugins.smartexpress.HandlerTypedRouter(handlerArg.typedrouter)
|
new plugins.smartexpress.HandlerTypedRouter(handlerArg.typedrouter)
|
||||||
);
|
);
|
||||||
|
console.log(`added slugroute ${slugroute}`);
|
||||||
}
|
}
|
||||||
await this.server.start();
|
await this.server.start();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user