Rename old directory for behaviours as "features" to better communicate new intent with new directory structure to organize code and tests around features instead of technicalities (#6033)

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Iku-tursoandJanne Savolainen authored and GitHub committed 2022-08-16 15:09:08 +03:00
1 parent 36077a9fea
commit 299922c8a7
107 files changed

No files matched your search

@@ -0,0 +1,68 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { RenderResult } from "@testing-library/react";
import type { IObservableValue } from "mobx";
import { observable, runInAction, computed } from "mobx";
import React from "react";
import type { TestExtensionRenderer } from "../../../renderer/components/test-utils/get-extension-fake";
import type { ApplicationBuilder } from "../../../renderer/components/test-utils/get-application-builder";
import { getApplicationBuilder } from "../../../renderer/components/test-utils/get-application-builder";
import { getExtensionFakeFor } from "../../../renderer/components/test-utils/get-extension-fake";
describe("reactively disable global pages", () => {
let builder: ApplicationBuilder;
let rendered: RenderResult;
let someObservable: IObservableValue<boolean>;
let rendererTestExtension: TestExtensionRenderer;
beforeEach(async () => {
builder = getApplicationBuilder();
const getExtensionFake = getExtensionFakeFor(builder);
someObservable = observable.box(false);
const testExtension = getExtensionFake({
id: "test-extension-id",
name: "test-extension",
rendererOptions: {
globalPages: [{
components: {
Page: () => <div data-testid="some-test-page">Some page</div>,
},
enabled: computed(() => someObservable.get()),
}],
},
});
rendered = await builder.render();
builder.extensions.enable(testExtension);
rendererTestExtension = testExtension.renderer;
});
it("when navigating to the page, does not show the page", () => {
rendererTestExtension.navigate();
const actual = rendered.queryByTestId("some-test-page");
expect(actual).not.toBeInTheDocument();
});
it("given page becomes enabled, when navigating to the page, shows the page", () => {
runInAction(() => {
someObservable.set(true);
});
rendererTestExtension.navigate();
const actual = rendered.queryByTestId("some-test-page");
expect(actual).toBeInTheDocument();
});
});