fix(core): update
This commit is contained in:
parent
6df4f8de77
commit
6ec6869e9c
78
package-lock.json
generated
78
package-lock.json
generated
@ -14,20 +14,64 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@apiglobal/typedrequest": {
|
"@apiglobal/typedrequest": {
|
||||||
"version": "1.0.38",
|
"version": "1.0.40",
|
||||||
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest/-/typedrequest-1.0.38.tgz",
|
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest/-/typedrequest-1.0.40.tgz",
|
||||||
"integrity": "sha512-A0kFQJEadwOc9Zlnc4QvVoqL0e5zaEGye+dUDlfq3p9jvis6KbDSamG+xcGXw1HTz7BxFp66Ix73qwHUzWkHeg==",
|
"integrity": "sha512-CnYa7h6rZWe3GPf0h8F8M/LNQ1wpGRvtFnx5R6h8ukIT3agXyJIWaCpR4k8yAokSvUov4ZVwadH/FGNS1fHrfw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.13",
|
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||||
"@pushrocks/lik": "^4.0.13",
|
"@pushrocks/isounique": "^1.0.4",
|
||||||
"@pushrocks/smartdelay": "^2.0.9",
|
"@pushrocks/lik": "^4.0.17",
|
||||||
"@pushrocks/webrequest": "^2.0.9"
|
"@pushrocks/smartdelay": "^2.0.10",
|
||||||
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
|
"@pushrocks/webrequest": "^2.0.10"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@apiglobal/typedrequest-interfaces": {
|
||||||
|
"version": "1.0.15",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest-interfaces/-/typedrequest-interfaces-1.0.15.tgz",
|
||||||
|
"integrity": "sha512-KncX168fUQJ73FeT22Cvls41mkJmtasP8dB2s9+9/OyWZpNsCzk9NEmtdRhulW2vLQwuAbQc1eoloe7ffCmhcA=="
|
||||||
|
},
|
||||||
|
"@pushrocks/lik": {
|
||||||
|
"version": "4.0.17",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-4.0.17.tgz",
|
||||||
|
"integrity": "sha512-K5dX3k3i7iVxFMJ+IYwJRljewukJCc2zgj6+88R18/8SajVAq7ITOl3/FTbmEPFCJv5rl/LQ9FtcMynWlwSlzQ==",
|
||||||
|
"requires": {
|
||||||
|
"@pushrocks/smartdelay": "^2.0.10",
|
||||||
|
"@pushrocks/smartmatch": "^1.0.7",
|
||||||
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
|
"@pushrocks/smartrx": "^2.0.17",
|
||||||
|
"@pushrocks/smarttime": "^3.0.24",
|
||||||
|
"@types/minimatch": "^3.0.3",
|
||||||
|
"symbol-tree": "^3.2.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@pushrocks/smartdelay": {
|
||||||
|
"version": "2.0.10",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.10.tgz",
|
||||||
|
"integrity": "sha512-JOFpEfYiKnqcQYoUrL/jDyBDZUmlgJNm5U30MQQ3f+yci+rlFnMY5VvBBEYn5WgoX0ilwU+E15mtpDWhXcmhzg==",
|
||||||
|
"requires": {
|
||||||
|
"@pushrocks/smartpromise": "^3.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@pushrocks/smarttime": {
|
||||||
|
"version": "3.0.24",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.24.tgz",
|
||||||
|
"integrity": "sha512-c/n0Y3CUnVNa3TnuXZ5aRc0bWj4RX7+XSjPes1J4HidU1yBOd9UOt6l08W8aPH5jMjT9Ei2jH0GsheaTGoVEYA==",
|
||||||
|
"requires": {
|
||||||
|
"@pushrocks/lik": "^4.0.13",
|
||||||
|
"@pushrocks/smartdelay": "^2.0.10",
|
||||||
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
|
"croner": "^1.1.23",
|
||||||
|
"dayjs": "^1.8.29",
|
||||||
|
"is-nan": "^1.3.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@apiglobal/typedrequest-interfaces": {
|
"@apiglobal/typedrequest-interfaces": {
|
||||||
"version": "1.0.13",
|
"version": "1.0.15",
|
||||||
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest-interfaces/-/typedrequest-interfaces-1.0.13.tgz",
|
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest-interfaces/-/typedrequest-interfaces-1.0.15.tgz",
|
||||||
"integrity": "sha512-3mk0mMC7unqh+Bb0mPEMwEfJcLAGl5ZjA1If/OGyk56KQOBqA2mLATS40HREeGoAEcUOHU2VCwPuU/tpSVMY/w=="
|
"integrity": "sha512-KncX168fUQJ73FeT22Cvls41mkJmtasP8dB2s9+9/OyWZpNsCzk9NEmtdRhulW2vLQwuAbQc1eoloe7ffCmhcA=="
|
||||||
},
|
},
|
||||||
"@babel/code-frame": {
|
"@babel/code-frame": {
|
||||||
"version": "7.10.4",
|
"version": "7.10.4",
|
||||||
@ -1142,8 +1186,7 @@
|
|||||||
"@pushrocks/isounique": {
|
"@pushrocks/isounique": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fisounique/-/isounique-1.0.4.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fisounique/-/isounique-1.0.4.tgz",
|
||||||
"integrity": "sha512-P1xLsuA1+8LQpoWCo2nP2vIQXKGUl5wDWU6CD7xTDZc3uw0He5V/qCPHM5zpIZsS7IuZOxDDpWb7aFveB11tXw==",
|
"integrity": "sha512-P1xLsuA1+8LQpoWCo2nP2vIQXKGUl5wDWU6CD7xTDZc3uw0He5V/qCPHM5zpIZsS7IuZOxDDpWb7aFveB11tXw=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"@pushrocks/lik": {
|
"@pushrocks/lik": {
|
||||||
"version": "4.0.13",
|
"version": "4.0.13",
|
||||||
@ -1380,6 +1423,11 @@
|
|||||||
"systeminformation": "^4.15.3"
|
"systeminformation": "^4.15.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@pushrocks/smartobject": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartobject/-/smartobject-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-zByvI2HHCumnoRYEWCYoDZqm9k3t/qeVo/LjmbZsdy8wVS/20Dveirexk52jEELFT3cr8IX88FvVZQ6b3pPUzQ=="
|
||||||
|
},
|
||||||
"@pushrocks/smartparam": {
|
"@pushrocks/smartparam": {
|
||||||
"version": "1.1.6",
|
"version": "1.1.6",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartparam/-/smartparam-1.1.6.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartparam/-/smartparam-1.1.6.tgz",
|
||||||
@ -1523,9 +1571,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/webrequest": {
|
"@pushrocks/webrequest": {
|
||||||
"version": "2.0.9",
|
"version": "2.0.10",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fwebrequest/-/webrequest-2.0.9.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fwebrequest/-/webrequest-2.0.10.tgz",
|
||||||
"integrity": "sha512-cHKbVlS6j26SRzFMjvV+4hwwimXJ9NX/NnUmLmPSTZguzz6dEp1dYd+aNzGaGC8Da4ewvH7klhx7a5LI3Gv5tw==",
|
"integrity": "sha512-uQ8MvKclGqdLaUjah3SUsr8RplvtEUDXpFYjyO1dsHabbLWNVPQipt70CAMvS/8hOzDDD/G+dUEHIz2yZSVKNQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/smartdelay": "^2.0.9",
|
"@pushrocks/smartdelay": "^2.0.9",
|
||||||
"@pushrocks/smartenv": "^4.0.10",
|
"@pushrocks/smartenv": "^4.0.10",
|
||||||
|
@ -21,7 +21,10 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apiglobal/sdk": "^1.0.9",
|
"@apiglobal/sdk": "^1.0.9",
|
||||||
"@pushrocks/smartexpress": "^3.0.73"
|
"@apiglobal/typedrequest": "^1.0.40",
|
||||||
|
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||||
|
"@pushrocks/smartexpress": "^3.0.73",
|
||||||
|
"@pushrocks/smartobject": "^1.0.3"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
44
ts/index.ts
44
ts/index.ts
@ -1,7 +1,9 @@
|
|||||||
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';
|
||||||
|
|
||||||
export { AgTestServer };
|
export {
|
||||||
|
AgTestServer
|
||||||
|
}
|
||||||
|
|
||||||
let testServer: AgTestServer;
|
let testServer: AgTestServer;
|
||||||
export const createTestServer = async (handlerArg: plugins.agSdk.AAgHandler<any>) => {
|
export const createTestServer = async (handlerArg: plugins.agSdk.AAgHandler<any>) => {
|
||||||
@ -10,6 +12,46 @@ export const createTestServer = async (handlerArg: plugins.agSdk.AAgHandler<any>
|
|||||||
return testServer;
|
return testServer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const testFire = <
|
||||||
|
A extends plugins.agSdk.AAgHandler<any>,
|
||||||
|
T extends plugins.typedrequestInterfaces.ITypedRequest
|
||||||
|
>(
|
||||||
|
slug: string,
|
||||||
|
methodArg: T['method'],
|
||||||
|
requestArg: T['request']
|
||||||
|
) => {
|
||||||
|
if (!testServer) {
|
||||||
|
throw new Error('you need to create and start a testServer first!');
|
||||||
|
}
|
||||||
|
if (testServer.server.serverStatus !== 'running') {
|
||||||
|
throw new Error('you need to start the testServer first!');
|
||||||
|
}
|
||||||
|
const typedRequest = new plugins.typedrequest.TypedRequest<T>(
|
||||||
|
`https://localhost:${testServer.server.options.port}`,
|
||||||
|
methodArg
|
||||||
|
);
|
||||||
|
const responsePromise = typedRequest.fire(requestArg);
|
||||||
|
const expect = async (expectedResponseArg: T['response']) => {
|
||||||
|
const actualResponse = await responsePromise;
|
||||||
|
const comparisonResult = plugins.smartobject.compareObjects(expectedResponseArg, actualResponse);
|
||||||
|
let throwErrorBool = false;
|
||||||
|
if (comparisonResult.divergingProperties.length > 0) {
|
||||||
|
console.log(`The following properties diverged:`);
|
||||||
|
console.log(comparisonResult.divergingProperties);
|
||||||
|
throwErrorBool = true;
|
||||||
|
}
|
||||||
|
if (comparisonResult.missingProperties.length > 0) {
|
||||||
|
console.log(`The following properties diverged:`);
|
||||||
|
console.log(comparisonResult.divergingProperties);
|
||||||
|
throwErrorBool = true;
|
||||||
|
}
|
||||||
|
if (throwErrorBool) {
|
||||||
|
throw new Error('response did not comply');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return expect;
|
||||||
|
};
|
||||||
|
|
||||||
export const stopTestServer = async () => {
|
export const stopTestServer = async () => {
|
||||||
if (testServer) {
|
if (testServer) {
|
||||||
await testServer.stop();
|
await testServer.stop();
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
// apiglobal scope
|
// apiglobal scope
|
||||||
import * as agSdk from '@apiglobal/sdk';
|
import * as agSdk from '@apiglobal/sdk';
|
||||||
|
import * as typedrequest from '@apiglobal/typedrequest';
|
||||||
|
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
||||||
|
|
||||||
export { agSdk };
|
export { agSdk, typedrequest, typedrequestInterfaces };
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
import * as smartexpress from '@pushrocks/smartexpress';
|
import * as smartexpress from '@pushrocks/smartexpress';
|
||||||
|
import * as smartobject from '@pushrocks/smartobject';
|
||||||
|
|
||||||
export { smartexpress };
|
export { smartexpress, smartobject };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user