sdk/test/test.ts

43 lines
1.0 KiB
TypeScript
Raw Normal View History

2020-03-24 23:32:43 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
import * as sdk from '../ts/index';
2020-03-25 15:16:03 +00:00
import { ISimpleRequest } from '@tsclass/tsclass/dist_ts/network';
2020-07-04 16:42:41 +00:00
import { TypedRouter } from '@apiglobal/typedrequest';
2020-03-25 15:16:03 +00:00
tap.test('should create a valid Handler', async () => {
2020-03-25 20:15:46 +00:00
class MyHandler extends sdk.AAgHandler<any> {
2020-07-04 16:42:41 +00:00
public slug: 'testapi';
public typedrouter = new TypedRouter();
2020-09-22 23:06:34 +00:00
2020-07-04 14:38:25 +00:00
public async checkReqirements() {
return {
allOk: true,
2020-07-04 14:50:24 +00:00
reason: '',
};
2020-07-04 14:38:25 +00:00
}
public async start() {}
public async stop() {}
2020-09-22 22:54:05 +00:00
public async checkRequirements(): Promise<sdk.IRequirementResult> {
return {
allOk: true,
2020-09-23 21:24:32 +00:00
reason: '',
};
2020-09-22 22:54:05 +00:00
}
2020-03-25 15:16:03 +00:00
}
2020-09-22 23:06:34 +00:00
// tslint:disable-next-line: max-classes-per-file
class AgEnvironement extends sdk.AgEnvironment {
public async getEnvVar(nameArg: string) {
return '';
}
}
const myHandlerInstance = new MyHandler(new AgEnvironement());
2020-03-25 15:16:03 +00:00
expect(myHandlerInstance).to.be.instanceOf(sdk.AAgHandler);
2020-03-24 23:32:43 +00:00
});
tap.start();