mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
javascript test coverage
This commit is contained in:
@@ -28,7 +28,7 @@ const normalizeUri = (uri: string) => {
|
||||
}
|
||||
return uri;
|
||||
} else {
|
||||
throw new TypeError(`${typeof uri} ${uri}`);
|
||||
throw new TypeError(`Only strings are permitted in URI`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -68,16 +68,16 @@ export class Router {
|
||||
throw new TypeError('a callback fn must be provided');
|
||||
}
|
||||
|
||||
this.routes.forEach(route => {
|
||||
if (route.uri == uri) {
|
||||
throw new Error(
|
||||
`URI exists. provided URI: ${uri}, registered config: ${route}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
uri = normalizeUri(uri);
|
||||
|
||||
if (this.routes.find(route => {
|
||||
if (route.uri == uri) {
|
||||
return true;
|
||||
}
|
||||
})) {
|
||||
throw new Error('URI exists');
|
||||
};
|
||||
|
||||
const route: routeTuple = {
|
||||
uri,
|
||||
fn,
|
||||
|
||||
Reference in New Issue
Block a user