Skip to content

Commit

Permalink
Fix test that was accidentally broken
Browse files Browse the repository at this point in the history
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
  • Loading branch information
jansav committed Dec 16, 2021
1 parent 250b301 commit 8337dfd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

import "@testing-library/jest-dom/extend-expect";
import { fireEvent, render, waitFor } from "@testing-library/react";
import { fireEvent, waitFor } from "@testing-library/react";
import fse from "fs-extra";
import React from "react";
import { UserStore } from "../../../../common/user-store";
Expand All @@ -35,6 +35,7 @@ import { AppPaths } from "../../../../common/app-paths";
import extensionLoaderInjectable
from "../../../../extensions/extension-loader/extension-loader.injectable";
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
import { DiRender, renderFor } from "../../test-utils/renderFor";

mockWindow();

Expand Down Expand Up @@ -77,10 +78,13 @@ AppPaths.init();

describe("Extensions", () => {
let extensionLoader: ExtensionLoader;
let render: DiRender;

beforeEach(async () => {
const di = getDiForUnitTesting();

render = renderFor(di);

extensionLoader = di.inject(extensionLoaderInjectable);

mockFs({
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/components/getDiForUnitTesting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const getDiForUnitTesting = () => {
return di;
};

const getInjectableFilePaths = memoize(() =>
glob.sync("./**/*.injectable.{ts,tsx}", { cwd: __dirname }),
);
const getInjectableFilePaths = memoize(() => [
...glob.sync("./**/*.injectable.{ts,tsx}", { cwd: __dirname }),
...glob.sync("../../extensions/**/*.injectable.{ts,tsx}", { cwd: __dirname }),
]);

0 comments on commit 8337dfd

Please sign in to comment.