sdk/test/test.ts

42 lines
960 B
TypeScript
Raw Permalink Normal View History

2020-03-24 23:32:43 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2023-03-20 11:26:43 +00:00
import * as sdk from '../ts/index.js';
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
2023-03-20 11:26:43 +00:00
expect(myHandlerInstance).toBeInstanceOf(sdk.AAgHandler);
2020-03-24 23:32:43 +00:00
});
tap.start();