1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

address review comments, fix tests

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Jim Ehrismann 2022-09-13 18:28:39 -04:00
parent 377cf49fb6
commit 0a0fa392b9
3 changed files with 18 additions and 8 deletions

View File

@ -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");

View File

@ -5,7 +5,7 @@
import { getDiForUnitTesting } from "../../renderer/getDiForUnitTesting"; import { getDiForUnitTesting } from "../../renderer/getDiForUnitTesting";
import { routeSpecificComponentInjectionToken } from "../../renderer/routes/route-specific-component-injection-token"; import { routeSpecificComponentInjectionToken } from "../../renderer/routes/route-specific-component-injection-token";
import { frontEndRouteInjectionToken } from "./front-end-route-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 clusterStoreInjectable from "../cluster-store/cluster-store.injectable";
import type { ClusterStore } from "../cluster-store/cluster-store"; import type { ClusterStore } from "../cluster-store/cluster-store";
import { pipeline } from "@ogre-tools/fp"; import { pipeline } from "@ogre-tools/fp";
@ -27,9 +27,11 @@ describe("verify-that-all-routes-have-component", () => {
routes, routes,
map( map(
(route) => ({ (currentRoute) => ({
path: route.path, path: currentRoute.path,
routeComponent: routeComponents.find(matches({ route })), routeComponent: routeComponents.find(({ route }) => (
route.path === currentRoute.path
&& route.clusterFrame === currentRoute.clusterFrame)),
}), }),
), ),

View File

@ -22,7 +22,7 @@ describe("setting-welcome-page", () => {
applicationBuilder = getApplicationBuilder(); applicationBuilder = getApplicationBuilder();
}); });
describe("given no extension sets the welcome page", () => { describe("given configuration of welcome page route is the default", () => {
beforeEach(async () => { beforeEach(async () => {
applicationBuilder.beforeApplicationStart((mainDi) => { applicationBuilder.beforeApplicationStart((mainDi) => {
mainDi.override(welcomeRouteConfigInjectable, () => "/welcome"); mainDi.override(welcomeRouteConfigInjectable, () => "/welcome");
@ -45,14 +45,14 @@ describe("setting-welcome-page", () => {
expect(welcomeRoute.path).toEqual("/welcome"); 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) const welcomePage = rendered.getByTestId("welcome-page"); // from the Welcome component (welcome.tsx)
expect(welcomePage).toBeInTheDocument(); 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 () => { beforeEach(async () => {
applicationBuilder.beforeApplicationStart((mainDi) => { applicationBuilder.beforeApplicationStart((mainDi) => {
mainDi.override(welcomeRouteConfigInjectable, () => "/extension/some-extension-name/some-welcome-page"); 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"); 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"); const welcomePage = rendered.getByTestId("some-welcome-test-id");
expect(welcomePage).toBeInTheDocument(); expect(welcomePage).toBeInTheDocument();