Skip to content

Commit

Permalink
minor: test
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Aug 1, 2024
1 parent 18d93c5 commit 9dc1141
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ internal fun DynaNodeGroup.navigatorTest() {

group("security") {
group("no user logged in") {
test("both mock routes are present") {
expect(true, routes.toString()) { routes.errorRoutes.contains(MockRouteNotFoundError::class.java) }
expect(true, routes.toString()) { routes.errorRoutes.contains(MockRouteAccessDeniedError::class.java) }
}
test("when access is rejected, redirect goes to WelcomeView") {
UI.getCurrent().addBeforeEnterListener(SimpleNavigationAccessControl().apply {
setLoginView(WelcomeView::class.java)
Expand Down Expand Up @@ -260,6 +264,10 @@ internal fun DynaNodeGroup.navigatorTest() {
afterEach { MockVaadin.tearDown() }

group("no user logged in") {
test("both mock routes are present") {
val routes = Routes().autoDiscoverViews()
expect(true, routes.toString()) { routes.errorRoutes.contains(MockRouteAccessDeniedError::class.java) }
}
test("when access is rejected, redirect goes to WelcomeView") {
val routes = Routes().autoDiscoverViews()
routes.errorRoutes.remove(MyRouteNotFoundError::class.java)
Expand Down

0 comments on commit 9dc1141

Please sign in to comment.