MOBILE-3947 messages: Fix tests

main
Noel De Martin 2024-01-11 15:26:49 +01:00
parent 44606242fd
commit 2200669b0f
3 changed files with 17 additions and 3 deletions

View File

@ -280,7 +280,6 @@ Feature: Test basic usage of messages in app
Then I should find "Teacher teacher" in the app
And I should find "Student1 student1" in the app
@ionic7_failure
Scenario: User blocking feature
Given I entered the course "Course 1" as "student2" in the app
When I press "Participants" in the app
@ -318,7 +317,6 @@ Feature: Test basic usage of messages in app
Then I should find "test message" in the app
But I should not find "You are unable to message this user" in the app
@ionic7_failure
Scenario: Mute Unmute conversations
Given I entered the course "Course 1" as "student1" in the app
When I press "Participants" in the app

View File

@ -169,6 +169,20 @@ export function conditionalRoutes(routes: Routes, condition: () => boolean): Rou
});
}
/**
* Check whether a route does not have any content.
*
* @param route Route.
* @returns Whether the route doesn't have any content.
*/
export function isEmptyRoute(route: Route): boolean {
return !('component' in route)
&& !('loadComponent' in route)
&& !('children' in route)
&& !('loadChildren' in route)
&& !('redirectTo' in route);
}
/**
* Resolve module routes.
*

View File

@ -15,7 +15,7 @@
import { InjectionToken, Injector, ModuleWithProviders, NgModule } from '@angular/core';
import { Route, Routes } from '@angular/router';
import { ModuleRoutesConfig, resolveModuleRoutes } from '@/app/app-routing.module';
import { ModuleRoutesConfig, isEmptyRoute, resolveModuleRoutes } from '@/app/app-routing.module';
const MAIN_MENU_TAB_ROUTES = new InjectionToken('MAIN_MENU_TAB_ROUTES');
const modulesPaths: Record<string, Set<string>> = {};
@ -71,6 +71,8 @@ export function buildTabMainRoutes(injector: Injector, mainRoute: Route): Routes
if (isRootRoute && !('redirectTo' in mainRoute)) {
mainRoute.children = mainRoute.children || [];
mainRoute.children = mainRoute.children.concat(routes.children);
} else if (isEmptyRoute(mainRoute)) {
return [];
}
return isRootRoute