BREAKING CHANGE(core): updated to esm

This commit is contained in:
2022-03-21 21:53:46 +01:00
parent 2e42011eda
commit 3b50e9c8cc
15 changed files with 17789 additions and 1659 deletions

View File

@ -1,5 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartguard from '../ts/index';
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartguard from '../ts/index.js';
import * as smartexpress from '@pushrocks/smartexpress';
import * as smartrequest from '@pushrocks/smartrequest';
@ -10,7 +10,7 @@ tap.test('should create a demo smartexpress instance', async () => {
cors: true,
forceSsl: false,
defaultAnswer: async () => 'hi there',
port: 3211
port: 3211,
});
});
@ -19,7 +19,7 @@ tap.test('should be able to create smartguards for a request', async () => {
req: smartexpress.Request;
res: smartexpress.Response;
}
const ipGuard = new smartguard.Guard<IRequestGuardData>(async dataArg => {
const ipGuard = new smartguard.Guard<IRequestGuardData>(async (dataArg) => {
console.log('executing ip guard');
if (dataArg) {
console.log('ip guard succeeded');
@ -36,7 +36,7 @@ tap.test('should be able to create smartguards for a request', async () => {
await smartguard.passGuards(
{
req,
res
res,
},
[ipGuard]
);
@ -54,7 +54,7 @@ tap.test('should start server with guards in place', async () => {
tap.test('should execute a request', async () => {
const response = await smartrequest.request('http://localhost:3211/testroute', {
method: 'GET'
method: 'GET',
});
});