Skip to content

Commit 3f5cc75

Browse files
cleaned up route testing
1 parent efd7323 commit 3f5cc75

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/backend/__tests__/routes.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ describe('Route class testing', () => {
6161
});
6262

6363
it('should throw an error if target route is not found', () => {
64-
const dummyRoute: Route = new Route('/dummy', 0);
65-
expect(routes.navigate(dummyRoute)).toThrowError();
64+
const dummyRoute: Route = new Route('/error', 0);
65+
expect(() => routes.navigate(dummyRoute)).toThrowError();
6666
});
6767
});
6868

src/backend/models/routes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export class Routes {
4747
const currentRoute: Route = this.routeHistory[this.current];
4848
// Check if the new url is different from the current url
4949
const isNavigating = currentRoute.url !== url;
50-
console.log('IsNavigating ', isNavigating);
5150
if (isNavigating) {
5251
// Check if current is not equal to routeHistory.length - 1 becuase if it doesnt, we need to rebuild history
5352
if (this.current !== this.routeHistory.length - 1) {
@@ -102,7 +101,7 @@ export class Routes {
102101
);
103102
// If the target route is not found, throw an error
104103
if (targetIndex === -1) {
105-
throw Error('Error at Routes.navigage: targetIndex is undefined');
104+
throw new Error('Error at Routes.navigage: targetIndex is undefined');
106105
}
107106
// Calculate the difference in index between the current route and the target route
108107
const delta: number = targetIndex - this.current;

0 commit comments

Comments
 (0)