fix(tests): add more meaningful tests
This commit is contained in:
parent
cdb3c27637
commit
8d9d3f92db
29
test/test.ts
29
test/test.ts
@ -1,8 +1,35 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as smartswagger from '../ts/index';
|
||||
|
||||
import * as smartexpress from '@pushrocks/smartexpress';
|
||||
|
||||
let testSmartswaggerInstance: smartswagger.Smartswagger;
|
||||
let testExpressServer: smartexpress.Server;
|
||||
|
||||
tap.test('first test', async () => {
|
||||
console.log(smartswagger);
|
||||
testSmartswaggerInstance = await smartswagger.Smartswagger.createFromUrl('https://my.sevdesk.de/OpenAPI/ReceiptAPI/openApi.json');
|
||||
await testSmartswaggerInstance.mergeDocumentFromUrl('https://my.sevdesk.de/OpenAPI/ContactAPI/openApi.json', '');
|
||||
await testSmartswaggerInstance.mergeDocumentFromUrl('https://my.sevdesk.de/OpenAPI/InvoiceAPI/openApi.json', '');
|
||||
await testSmartswaggerInstance.mergeDocumentFromUrl('https://my.sevdesk.de/OpenAPI/OrderAPI/openApi.json', '');
|
||||
await testSmartswaggerInstance.mergeDocumentFromUrl('https://my.sevdesk.de/OpenAPI/InventoryAPI/openApi.json', '');
|
||||
|
||||
// express stuff
|
||||
testExpressServer = new smartexpress.Server({
|
||||
cors: true,
|
||||
});
|
||||
testExpressServer.addRoute('/apiui', new smartexpress.Handler('ALL', testSmartswaggerInstance.getSlashApiUiMiddleware()));
|
||||
testExpressServer.addRoute('/apiredoc', new smartexpress.Handler('ALL', testSmartswaggerInstance.getSlashRedocMiddleware()))
|
||||
|
||||
testExpressServer.addRoute('/apischema', new smartexpress.Handler('ALL', testSmartswaggerInstance.getSlashApiSchemaMiddleware()));
|
||||
await testExpressServer.start(3000);
|
||||
});
|
||||
|
||||
tap.test('should run for a few seconds', async (toolsArg) => {
|
||||
await toolsArg.delayFor(5000);
|
||||
});
|
||||
|
||||
tap.test('should end smartswagger', async () => {
|
||||
await testExpressServer.stop();
|
||||
})
|
||||
|
||||
tap.start();
|
||||
|
Loading…
Reference in New Issue
Block a user