feat(core): Added GuardError

This commit is contained in:
2024-08-25 18:03:37 +02:00
parent 425477548f
commit 1d06c878e1
11 changed files with 505 additions and 439 deletions

View File

@ -3,10 +3,10 @@ import * as smartguard from '../ts/index.js';
import * as typedserver from '@api.global/typedserver';
import * as smartrequest from '@push.rocks/smartrequest';
let smartexpressInstance: typedserver.servertools.Server;
let typedserverInstance: typedserver.servertools.Server;
tap.test('should create a demo smartexpress instance', async () => {
smartexpressInstance = new typedserver.servertools.Server({
typedserverInstance = new typedserver.servertools.Server({
cors: true,
forceSsl: false,
defaultAnswer: async () => 'hi there',
@ -30,7 +30,7 @@ tap.test('should be able to create smartguards for a request', async () => {
}
});
smartexpressInstance.addRoute(
typedserverInstance.addRoute(
'/testroute',
new typedserver.servertools.Handler('ALL', async (req, res) => {
await smartguard.passGuardsOrReject(
@ -49,7 +49,7 @@ tap.test('should be able to create smartguards for a request', async () => {
});
tap.test('should start server with guards in place', async () => {
await smartexpressInstance.start();
await typedserverInstance.start();
});
tap.test('should execute a request', async () => {
@ -59,7 +59,7 @@ tap.test('should execute a request', async () => {
});
tap.test('should end the demo smartexpress instance', async () => {
await smartexpressInstance.stop();
await typedserverInstance.stop();
});
tap.start();