address review comments, fix tests

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Jim Ehrismann committed 2022-09-13 18:28:49 -04:00
1 parent 377cf49fb6
commit 0a0fa392b9
3 files changed
+18 -8

No files matched your search

@@ -0,0 +1,8 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getGlobalOverride } from "../../../test-utils/get-global-override";
import welcomeRouteConfig from "./welcome-route-config.injectable";
export default getGlobalOverride(welcomeRouteConfig, () => "/welcome");
@@ -5,7 +5,7 @@
import { getDiForUnitTesting } from "../../renderer/getDiForUnitTesting";
import { routeSpecificComponentInjectionToken } from "../../renderer/routes/route-specific-component-injection-token";
import { frontEndRouteInjectionToken } from "./front-end-route-injection-token";
import { filter, map, matches } from "lodash/fp";
import { filter, map } from "lodash/fp";
import clusterStoreInjectable from "../cluster-store/cluster-store.injectable";
import type { ClusterStore } from "../cluster-store/cluster-store";
import { pipeline } from "@ogre-tools/fp";
@@ -27,9 +27,11 @@ describe("verify-that-all-routes-have-component", () => {
routes,
map(
(route) => ({
path: route.path,
routeComponent: routeComponents.find(matches({ route })),
(currentRoute) => ({
path: currentRoute.path,
routeComponent: routeComponents.find(({ route }) => (
route.path === currentRoute.path
&& route.clusterFrame === currentRoute.clusterFrame)),
}),
),
@@ -22,7 +22,7 @@ describe("setting-welcome-page", () => {
applicationBuilder = getApplicationBuilder();
});
describe("given no extension sets the welcome page", () => {
describe("given configuration of welcome page route is the default", () => {
beforeEach(async () => {
applicationBuilder.beforeApplicationStart((mainDi) => {
mainDi.override(welcomeRouteConfigInjectable, () => "/welcome");
@@ -45,14 +45,14 @@ describe("setting-welcome-page", () => {
expect(welcomeRoute.path).toEqual("/welcome");
});
it("navigates to the default welcome page", () => {
it("launches to the default welcome page", () => {
const welcomePage = rendered.getByTestId("welcome-page"); // from the Welcome component (welcome.tsx)
expect(welcomePage).toBeInTheDocument();
});
});
describe("given an extension specifies a custom welcome page", () => {
describe("given configuration of welcome page route is set to a custom page", () => {
beforeEach(async () => {
applicationBuilder.beforeApplicationStart((mainDi) => {
mainDi.override(welcomeRouteConfigInjectable, () => "/extension/some-extension-name/some-welcome-page");
@@ -74,7 +74,7 @@ describe("setting-welcome-page", () => {
expect(welcomeRoute.path).toEqual("/extension/some-extension-name/some-welcome-page");
});
it("navigates to the custom welcome page", () => {
it("launches to the custom welcome page ", () => {
const welcomePage = rendered.getByTestId("some-welcome-test-id");
expect(welcomePage).toBeInTheDocument();