Skip to content

Commit

Permalink
added test for the strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
ywarezk committed Mar 9, 2020
1 parent 1623747 commit 6150944
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions __tests__/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Server } from 'http';
import autoCannon from 'autocannon';
import { resolve, dirname } from 'path';
import { promises } from 'fs';
import zoneErrors from '../';
import zoneErrors, { ErrorStrategy } from '../';

export async function startServer(app: Application): Promise<Server> {
return new Promise(resolve => {
Expand All @@ -23,11 +23,21 @@ export async function startServer(app: Application): Promise<Server> {
});
}

class StamStrategy implements ErrorStrategy {
handleError = async (): Promise<void> => {
return;
};
}

export function createApp(isZone = true): Application {
const app = express();

if (isZone) {
app.use(zoneErrors());
app.use(
zoneErrors({
strategy: new StamStrategy(),
}),
);
}

return app;
Expand Down

0 comments on commit 6150944

Please sign in to comment.