From 5e1159711b33c0b3c95b53e90deedb538d6db552 Mon Sep 17 00:00:00 2001 From: Art Date: Fri, 17 Sep 2021 17:32:46 +0300 Subject: [PATCH] 135. Test routes (#17) --- .../src/app/app-routing.module.spec.ts | 24 +++++++++++++++++++ .../src/app/app-routing.module.ts | 2 +- .../src/app/app.component.html | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 support-portal-frontend/src/app/app-routing.module.spec.ts diff --git a/support-portal-frontend/src/app/app-routing.module.spec.ts b/support-portal-frontend/src/app/app-routing.module.spec.ts new file mode 100644 index 0000000..19d248c --- /dev/null +++ b/support-portal-frontend/src/app/app-routing.module.spec.ts @@ -0,0 +1,24 @@ +import {routes} from './app-routing.module'; +import {UserComponent} from "./component/user/user.component"; +import {LoginComponent} from "./component/login/login.component"; +import {RegisterComponent} from "./component/register/register.component"; + +describe('routes', () => { + + it('should contain a route for /login', () => { + expect(routes).toContain({path: "login", component: LoginComponent}); + }); + + it('should contain a route for /register', () => { + expect(routes).toContain({path: "register", component: RegisterComponent}); + }); + + it('should contain a route for /user/management', () => { + expect(routes).toContain({path: "user/management", component: UserComponent}); + }); + + it('should redirect to /login endpoint if no route found', () => { + expect(routes).toContain({path: '', redirectTo: '/login', pathMatch: 'full'}); + }); + +}) diff --git a/support-portal-frontend/src/app/app-routing.module.ts b/support-portal-frontend/src/app/app-routing.module.ts index 76cba5f..79556d4 100644 --- a/support-portal-frontend/src/app/app-routing.module.ts +++ b/support-portal-frontend/src/app/app-routing.module.ts @@ -4,7 +4,7 @@ import {LoginComponent} from "./component/login/login.component"; import {RegisterComponent} from "./component/register/register.component"; import {UserComponent} from "./component/user/user.component"; -const routes: Routes = [ +export const routes: Routes = [ {path: 'login', component: LoginComponent}, {path: 'register', component: RegisterComponent}, {path: 'user/management', component: UserComponent}, diff --git a/support-portal-frontend/src/app/app.component.html b/support-portal-frontend/src/app/app.component.html index 33752f3..2b60ccf 100644 --- a/support-portal-frontend/src/app/app.component.html +++ b/support-portal-frontend/src/app/app.component.html @@ -487,7 +487,7 @@ Gray Clouds Background - +