From d14137dc44b01cc6e97b4105599cb9b147bfda4b Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 21 Mar 2025 11:41:42 -0700 Subject: [PATCH] Reformat. --- .prettierrc.js | 17 - electron-builder.yml | 12 +- electron.vite.config.ts | 20 +- src/main/decoder/decode-ad1.ts | 4 +- src/main/decoder/decode-ad2.ts | 4 +- src/main/decoder/decode-env.ts | 4 +- src/main/decoder/decode-lin.ts | 4 +- src/main/decoder/decode-pfh.ts | 4 +- src/main/decoder/decode-pfl.ts | 4 +- src/main/decoder/decode-pfm.ts | 14 +- src/main/decoder/decode-pfo.ts | 6 +- src/main/decoder/decode-pfp.ts | 6 +- src/main/decoder/decode-pft.ts | 4 +- src/main/decoder/decode-ttl.ts | 4 +- src/main/decoder/decode-veh.ts | 4 +- src/main/graphql/graphql-client.ts | 6 +- src/main/index.ts | 4 +- src/main/ipc/ipcMainConfig.ts | 10 +- src/main/ipc/ipcMainHandler.settings.ts | 6 +- src/main/ipc/ipcMainHandler.user.ts | 6 +- src/preload/index.d.ts | 6 +- src/preload/index.ts | 18 +- src/renderer/src/App.test.tsx | 78 ++-- src/renderer/src/App.tsx | 2 +- src/renderer/src/components/Home/Home.tsx | 2 +- .../src/components/SignInForm/SignInForm.tsx | 2 +- src/renderer/src/components/Versions.tsx | 8 +- src/renderer/src/main.tsx | 2 +- src/renderer/src/util/ipcRendererHandler.ts | 10 +- src/util/deepLowercaseKeys.ts | 2 +- src/util/translations/en-US/main.json | 6 +- src/util/translations/en-US/renderer.json | 36 +- tests-examples/demo-todo-app.spec.ts | 388 ++++++++++-------- tests/example.spec.ts | 16 +- 34 files changed, 380 insertions(+), 339 deletions(-) delete mode 100644 .prettierrc.js diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 391da91..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,17 +0,0 @@ -export default { - printWidth: 120, - useTabs: false, - tabWidth: 2, - trailingComma: "none", - semi: true, - singleQuote: false, - bracketSpacing: true, - arrowParens: "always", - jsxSingleQuote: false, - bracketSameLine: false, - endOfLine: "lf" - // importOrder: ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"], - // importOrderSeparation: true, - // importOrderSortSpecifiers: true -}; - diff --git a/electron-builder.yml b/electron-builder.yml index 4d54d6d..8e55311 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -3,12 +3,12 @@ productName: Shop Partner directories: buildResources: build files: - - '!**/.vscode/*' - - '!src/*' - - '!electron.vite.config.{js,ts,mjs,cjs}' - - '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}' - - '!{.env,.env.*,.npmrc,pnpm-lock.yaml}' - - '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}' + - "!**/.vscode/*" + - "!src/*" + - "!electron.vite.config.{js,ts,mjs,cjs}" + - "!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}" + - "!{.env,.env.*,.npmrc,pnpm-lock.yaml}" + - "!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}" asarUnpack: - resources/** win: diff --git a/electron.vite.config.ts b/electron.vite.config.ts index 5b54e20..dc54fae 100644 --- a/electron.vite.config.ts +++ b/electron.vite.config.ts @@ -1,20 +1,20 @@ -import { resolve } from 'path' -import { defineConfig, externalizeDepsPlugin } from 'electron-vite' -import react from '@vitejs/plugin-react' +import { resolve } from "path"; +import { defineConfig, externalizeDepsPlugin } from "electron-vite"; +import react from "@vitejs/plugin-react"; export default defineConfig({ main: { - plugins: [externalizeDepsPlugin()] + plugins: [externalizeDepsPlugin()], }, preload: { - plugins: [externalizeDepsPlugin()] + plugins: [externalizeDepsPlugin()], }, renderer: { resolve: { alias: { - '@renderer': resolve('src/renderer/src') - } + "@renderer": resolve("src/renderer/src"), + }, }, - plugins: [react()] - } -}) + plugins: [react()], + }, +}); diff --git a/src/main/decoder/decode-ad1.ts b/src/main/decoder/decode-ad1.ts index cfe6e92..d347e37 100644 --- a/src/main/decoder/decode-ad1.ts +++ b/src/main/decoder/decode-ad1.ts @@ -7,7 +7,7 @@ import store from "../store/store"; import { DecodedAd1, OwnerRecordInterface } from "./decode-ad1.interface"; const DecodeAD1 = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -147,7 +147,7 @@ const DecodeAD1 = async ( "INS_CT_PH", "INS_CT_PHX", "LOSS_CAT", - ]) + ]), ); //Copy specific logic for manipulation. diff --git a/src/main/decoder/decode-ad2.ts b/src/main/decoder/decode-ad2.ts index 557a489..49957da 100644 --- a/src/main/decoder/decode-ad2.ts +++ b/src/main/decoder/decode-ad2.ts @@ -6,7 +6,7 @@ import { DecodedAD2 } from "./decode-ad2.interface"; import errorTypeCheck from "../../util/errorTypeCheck"; const DecodeAD2 = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -135,7 +135,7 @@ const DecodeAD2 = async ( //"LOC_PH", //"LOC_PHX", //"LOC_EA", - ]) + ]), ); //Apply business logic transfomrations. diff --git a/src/main/decoder/decode-env.ts b/src/main/decoder/decode-env.ts index 00a91a7..529fcf7 100644 --- a/src/main/decoder/decode-env.ts +++ b/src/main/decoder/decode-env.ts @@ -6,7 +6,7 @@ import errorTypeCheck from "../../util/errorTypeCheck"; import { DecodedEnv } from "./decode-env.interface"; const DecodeEnv = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -32,7 +32,7 @@ const DecodeEnv = async ( //TODO: Several of these fields will fail. Should extend schema to capture them. //"EST_SYSTEM", "ESTFILE_ID", - ]) + ]), ); rawEnvData.ciecaid = rawEnvData.estfile_id; delete rawEnvData.estfile_id; diff --git a/src/main/decoder/decode-lin.ts b/src/main/decoder/decode-lin.ts index ac855c6..8c5e724 100644 --- a/src/main/decoder/decode-lin.ts +++ b/src/main/decoder/decode-lin.ts @@ -7,7 +7,7 @@ import store from "../store/store"; import { DecodedLin, DecodedLinLine } from "./decode-lin.interface"; const DecodeLin = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -80,7 +80,7 @@ const DecodeLin = async ( "BETT_PCTG", "BETT_AMT", "BETT_TAX", - ]) + ]), ); //Apply line by line adjustments. singleLineData.op_code_desc = opCodeData[singleLineData.lbr_op]?.desc; diff --git a/src/main/decoder/decode-pfh.ts b/src/main/decoder/decode-pfh.ts index 6e53764..38c6949 100644 --- a/src/main/decoder/decode-pfh.ts +++ b/src/main/decoder/decode-pfh.ts @@ -6,7 +6,7 @@ import errorTypeCheck from "../../util/errorTypeCheck"; import { DecodedPfh } from "./decode-pfh.interface"; const DecodePfh = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -50,7 +50,7 @@ const DecodePfh = async ( "ADJ_STRDIS", //"ADJ_BTR_IN", //Remove "TAX_PREDIS", - ]) + ]), ); //Apply business logic transfomrations. diff --git a/src/main/decoder/decode-pfl.ts b/src/main/decoder/decode-pfl.ts index dc35180..7e35516 100644 --- a/src/main/decoder/decode-pfl.ts +++ b/src/main/decoder/decode-pfl.ts @@ -10,7 +10,7 @@ import { } from "./decode-pfl.interface"; const DecodePfl = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -67,7 +67,7 @@ const DecodePfl = async ( "LBR_TX_IN4", "LBR_TX_TY5", "LBR_TX_IN5", - ]) + ]), ); //Apply line by line adjustments. //Set the job.rate_ field based on the value. diff --git a/src/main/decoder/decode-pfm.ts b/src/main/decoder/decode-pfm.ts index 937d80b..c7dbdfb 100644 --- a/src/main/decoder/decode-pfm.ts +++ b/src/main/decoder/decode-pfm.ts @@ -11,7 +11,7 @@ import { } from "./decode-pfm.interface"; const DecodePfm = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -80,8 +80,8 @@ const DecodePfm = async ( "MAT_TX_IN4", "MAT_TX_TY5", "MAT_TX_IN5", - ]) - ) + ]), + ), ); //Also capture the whole object. @@ -93,7 +93,7 @@ const DecodePfm = async ( //Apply line by line adjustments. const mapaLine: DecodedPfmLine | undefined = rawPfmData.find( - (line) => line.matl_type === "MAPA" + (line) => line.matl_type === "MAPA", ); if (mapaLine) { jobMaterialRates.rate_mapa = @@ -102,7 +102,7 @@ const DecodePfm = async ( } const mashLine: DecodedPfmLine | undefined = rawPfmData.find( - (line) => line.matl_type === "MASH" + (line) => line.matl_type === "MASH", ); if (mashLine) { jobMaterialRates.rate_mash = @@ -111,7 +111,7 @@ const DecodePfm = async ( } const mahwLine: DecodedPfmLine | undefined = rawPfmData.find( - (line) => line.matl_type === "MAHW" + (line) => line.matl_type === "MAHW", ); if (mahwLine) { jobMaterialRates.rate_mahw = @@ -122,7 +122,7 @@ const DecodePfm = async ( const additionalMaterials = ["MA2S", "MA2T", "MA3S", "MACS", "MABL"]; additionalMaterials.forEach((type) => { const line: DecodedPfmLine | undefined = rawPfmData.find( - (line) => line.matl_type === type + (line) => line.matl_type === type, ); if (line) { jobMaterialRates[`rate_${type.toLowerCase()}`] = diff --git a/src/main/decoder/decode-pfo.ts b/src/main/decoder/decode-pfo.ts index 3976612..6a6e536 100644 --- a/src/main/decoder/decode-pfo.ts +++ b/src/main/decoder/decode-pfo.ts @@ -7,7 +7,7 @@ import YNBoolConverter from "../../util/ynBoolConverter"; import { DecodedPfo, DecodedPfoLine } from "./decode-pfo.interface"; const DecodePfo = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -58,8 +58,8 @@ const DecodePfo = async ( "STOR_T_IN5", "STOR_T_TY6", "STOR_T_IN6", - ]) - ) + ]), + ), ); //Apply business logic transfomrations. diff --git a/src/main/decoder/decode-pfp.ts b/src/main/decoder/decode-pfp.ts index aae3cdf..b19e822 100644 --- a/src/main/decoder/decode-pfp.ts +++ b/src/main/decoder/decode-pfp.ts @@ -11,7 +11,7 @@ import { } from "./decode-pfp.interface"; const DecodePfp = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -51,7 +51,7 @@ const DecodePfp = async ( "PRT_TX_IN4", "PRT_TX_TY5", "PRT_TX_IN5", - ]) + ]), ); singleLineData.prt_tax_rt = singleLineData.prt_tax_rt / 100; @@ -66,7 +66,7 @@ const DecodePfp = async ( acc[line.prt_type] = line; return acc; }, - {} as DecodedPfpLinesByType + {} as DecodedPfpLinesByType, ); return { parts_tax_rates: parsedPfpFile }; diff --git a/src/main/decoder/decode-pft.ts b/src/main/decoder/decode-pft.ts index 3039af8..5c9e2c3 100644 --- a/src/main/decoder/decode-pft.ts +++ b/src/main/decoder/decode-pft.ts @@ -6,7 +6,7 @@ import errorTypeCheck from "../../util/errorTypeCheck"; import { DecodedPft, DecodedPftLine } from "./decode-pft.interface"; const DecodePft = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -154,7 +154,7 @@ const DecodePft = async ( "TY6_THRES5", "TY6_RATE5", "TY6_SUR5", - ]) + ]), ); //Apply business logic transfomrations. diff --git a/src/main/decoder/decode-ttl.ts b/src/main/decoder/decode-ttl.ts index a3445e1..e69e738 100644 --- a/src/main/decoder/decode-ttl.ts +++ b/src/main/decoder/decode-ttl.ts @@ -6,7 +6,7 @@ import errorTypeCheck from "../../util/errorTypeCheck"; import { DecodedTtl, DecodedTtlLine } from "./decode-ttl.interface"; const DecodeTtl = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -42,7 +42,7 @@ const DecodeTtl = async ( "G_TTL_DISC", "G_TAX", "GST_AMT", - ]) + ]), ); //Apply business logic transfomrations. diff --git a/src/main/decoder/decode-veh.ts b/src/main/decoder/decode-veh.ts index 7c9012b..f6e35fe 100644 --- a/src/main/decoder/decode-veh.ts +++ b/src/main/decoder/decode-veh.ts @@ -7,7 +7,7 @@ import errorTypeCheck from "../../util/errorTypeCheck"; import store from "../store/store"; const DecodeVeh = async ( - extensionlessFilePath: string + extensionlessFilePath: string, ): Promise => { let dbf: DBFFile | null = null; try { @@ -56,7 +56,7 @@ const DecodeVeh = async ( "PAINT_CD1", "PAINT_CD2", "PAINT_CD3", - ]) + ]), ); //Apply business logic transfomrations. diff --git a/src/main/graphql/graphql-client.ts b/src/main/graphql/graphql-client.ts index 69a9ac5..a1d7d08 100644 --- a/src/main/graphql/graphql-client.ts +++ b/src/main/graphql/graphql-client.ts @@ -10,7 +10,7 @@ const requestMiddleware: RequestMiddleware = async (request) => { `%c[Graphql Request]%c${request.operationName}`, "color: red", "color: green", - request + request, ); return { @@ -23,7 +23,7 @@ const client: GraphQLClient = new GraphQLClient( import.meta.env.VITE_GRAPHQL_ENDPOINT, { requestMiddleware, - } + }, ); export async function getTokenFromRenderer(): Promise { @@ -35,7 +35,7 @@ export async function getTokenFromRenderer(): Promise { } catch (error) { log.error( "Unable to send request to renderer process for token", - errorTypeCheck(error) + errorTypeCheck(error), ); } diff --git a/src/main/index.ts b/src/main/index.ts index c2d9720..dbbf0e1 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -154,7 +154,7 @@ function createWindow(): void { label: "Log the Store", click: (): void => { log.debug( - "Store Contents" + JSON.stringify(store.store, null, 4) + "Store Contents" + JSON.stringify(store.store, null, 4), ); }, }, @@ -171,7 +171,7 @@ function createWindow(): void { jobs { id}} - ` + `, ) .then((data) => { log.info("Data from graffle", data); diff --git a/src/main/ipc/ipcMainConfig.ts b/src/main/ipc/ipcMainConfig.ts index 2b840ea..51c9053 100644 --- a/src/main/ipc/ipcMainConfig.ts +++ b/src/main/ipc/ipcMainConfig.ts @@ -27,7 +27,7 @@ const logIpcMessages = (): void => { `%c[IPC Main]%c${messageType}`, "color: red", "color: green", - payload + payload, ); // Call original handler if it existed if (originalHandler) { @@ -38,7 +38,7 @@ const logIpcMessages = (): void => { }; ipcMain.on(ipcTypes.toMain.test, () => - console.log("** Verify that ipcMain is loaded and working.") + console.log("** Verify that ipcMain is loaded and working."), ); //Auth handler @@ -67,15 +67,15 @@ if (import.meta.env.DEV) { //Settings Handlers ipcMain.handle( ipcTypes.toMain.settings.filepaths.get, - SettingsWatchedFilePathsGet + SettingsWatchedFilePathsGet, ); ipcMain.handle( ipcTypes.toMain.settings.filepaths.add, - SettingsWatchedFilePathsAdd + SettingsWatchedFilePathsAdd, ); ipcMain.handle( ipcTypes.toMain.settings.filepaths.remove, - SettingsWatchedFilePathsRemove + SettingsWatchedFilePathsRemove, ); //Watcher Handlers diff --git a/src/main/ipc/ipcMainHandler.settings.ts b/src/main/ipc/ipcMainHandler.settings.ts index c2a5bc9..20084f6 100644 --- a/src/main/ipc/ipcMainHandler.settings.ts +++ b/src/main/ipc/ipcMainHandler.settings.ts @@ -17,7 +17,7 @@ const SettingsWatchedFilePathsAdd = async (): Promise => { if (!result.canceled) { Store.set( "settings.filepaths", - _.union(result.filePaths, Store.get("settings.filepaths")) + _.union(result.filePaths, Store.get("settings.filepaths")), ); addWatcherPath(result.filePaths); } @@ -26,11 +26,11 @@ const SettingsWatchedFilePathsAdd = async (): Promise => { }; const SettingsWatchedFilePathsRemove = async ( event: IpcMainInvokeEvent, - path: string + path: string, ): Promise => { Store.set( "settings.filepaths", - _.without(Store.get("settings.filepaths"), path) + _.without(Store.get("settings.filepaths"), path), ); removeWatcherPath(path); return Store.get("settings.filepaths"); diff --git a/src/main/ipc/ipcMainHandler.user.ts b/src/main/ipc/ipcMainHandler.user.ts index c15ed85..b6793f1 100644 --- a/src/main/ipc/ipcMainHandler.user.ts +++ b/src/main/ipc/ipcMainHandler.user.ts @@ -12,14 +12,14 @@ import log from "electron-log/main"; const ipcMainHandleAuthStateChanged = async ( event: IpcMainEvent, - user: User | null + user: User | null, ): Promise => { Store.set("user", user); //Need to query the currently active shop, and store the metadata as well. //Also need to query the OP Codes for decoding reference. const activeBodyshop: ActiveBodyshopQueryResult = await client.request( - QUERY_ACTIVE_BODYSHOP_TYPED + QUERY_ACTIVE_BODYSHOP_TYPED, ); Store.set("app.bodyshop", activeBodyshop.bodyshops[0]); @@ -28,7 +28,7 @@ const ipcMainHandleAuthStateChanged = async ( QUERY_MASTERDATA_TYPED, { key: `${activeBodyshop.bodyshops[0].region_config}_ciecaopcodes`, - } + }, ); Store.set("app.masterdata.opcodes", JSON.parse(OpCodes.masterdata[0]?.value)); log.debug("Received authentication state change from Renderer.", user); diff --git a/src/preload/index.d.ts b/src/preload/index.d.ts index a153669..ab1657a 100644 --- a/src/preload/index.d.ts +++ b/src/preload/index.d.ts @@ -1,8 +1,8 @@ -import { ElectronAPI } from '@electron-toolkit/preload' +import { ElectronAPI } from "@electron-toolkit/preload"; declare global { interface Window { - electron: ElectronAPI - api: unknown + electron: ElectronAPI; + api: unknown; } } diff --git a/src/preload/index.ts b/src/preload/index.ts index 08a4962..3f7d1ec 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -1,23 +1,23 @@ -import { contextBridge } from 'electron' -import { electronAPI } from '@electron-toolkit/preload' -import 'electron-log/preload' +import { contextBridge } from "electron"; +import { electronAPI } from "@electron-toolkit/preload"; +import "electron-log/preload"; // Custom APIs for renderer -const api = {} +const api = {}; // Use `contextBridge` APIs to expose Electron APIs to // renderer only if context isolation is enabled, otherwise // just add to the DOM global. if (process.contextIsolated) { try { - contextBridge.exposeInMainWorld('electron', electronAPI) - contextBridge.exposeInMainWorld('api', api) + contextBridge.exposeInMainWorld("electron", electronAPI); + contextBridge.exposeInMainWorld("api", api); } catch (error) { - console.error(error) + console.error(error); } } else { // @ts-ignore (define in dts) - window.electron = electronAPI + window.electron = electronAPI; // @ts-ignore (define in dts) - window.api = api + window.api = api; } diff --git a/src/renderer/src/App.test.tsx b/src/renderer/src/App.test.tsx index 7a9277f..3b3d936 100644 --- a/src/renderer/src/App.test.tsx +++ b/src/renderer/src/App.test.tsx @@ -1,93 +1,97 @@ -import { test, expect } from '@playwright/test'; -import { Page } from '@playwright/test'; +import { test, expect } from "@playwright/test"; +import { Page } from "@playwright/test"; // src/renderer/src/App.test.tsx // Mock data const mockUser = { - uid: 'test123', - email: 'test@example.com', - displayName: 'Test User', + uid: "test123", + email: "test@example.com", + displayName: "Test User", toJSON: () => ({ - uid: 'test123', - email: 'test@example.com', - displayName: 'Test User' - }) + uid: "test123", + email: "test@example.com", + displayName: "Test User", + }), }; -test.describe('App Component', () => { +test.describe("App Component", () => { let page: Page; - + test.beforeEach(async ({ browser }) => { page = await browser.newPage(); - + // Mock Firebase Auth await page.addInitScript(() => { window.mockAuthState = null; - + // Mock the firebase auth module - jest.mock('./util/firebase', () => ({ + jest.mock("./util/firebase", () => ({ auth: { onAuthStateChanged: (callback) => { callback(window.mockAuthState); // Return mock unsubscribe function return () => {}; - } - } + }, + }, })); - + // Mock electron IPC window.electron = { ipcRenderer: { - send: jest.fn() - } + send: jest.fn(), + }, }; }); - - await page.goto('/'); + + await page.goto("/"); }); - test('should show SignInForm when user is not authenticated', async () => { + test("should show SignInForm when user is not authenticated", async () => { await page.evaluate(() => { window.mockAuthState = null; }); - + await page.reload(); - + // Check if SignInForm is visible - const signInForm = await page.locator('form').filter({ hasText: 'Sign In' }); + const signInForm = await page + .locator("form") + .filter({ hasText: "Sign In" }); await expect(signInForm).toBeVisible(); }); - test('should show routes when user is authenticated', async () => { + test("should show routes when user is authenticated", async () => { await page.evaluate((user) => { window.mockAuthState = user; }, mockUser); - + await page.reload(); - + // Check if AuthHome is visible const authHome = await page.locator('div:text("AuthHome")'); await expect(authHome).toBeVisible(); - + // Check that electron IPC was called with auth state - await expect(page.evaluate(() => { - return window.electron.ipcRenderer.send.mock.calls.length > 0; - })).resolves.toBe(true); + await expect( + page.evaluate(() => { + return window.electron.ipcRenderer.send.mock.calls.length > 0; + }), + ).resolves.toBe(true); }); - test('should navigate to settings page when authenticated', async () => { + test("should navigate to settings page when authenticated", async () => { await page.evaluate((user) => { window.mockAuthState = user; }, mockUser); - + await page.reload(); - + // Navigate to settings await page.click('a[href="/settings"]'); - + // Check if Settings page is visible const settingsPage = await page.locator('div:text("Settings")'); await expect(settingsPage).toBeVisible(); }); -}); \ No newline at end of file +}); diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 20788b0..1bb5c6f 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -25,7 +25,7 @@ const App: React.FC = () => { if (user) { window.electron.ipcRenderer.send( ipcTypes.toMain.authStateChanged, - user.toJSON() + user.toJSON(), ); window.electron.ipcRenderer.send(ipcTypes.toMain.watcher.start); } diff --git a/src/renderer/src/components/Home/Home.tsx b/src/renderer/src/components/Home/Home.tsx index 0b37986..8b71e5a 100644 --- a/src/renderer/src/components/Home/Home.tsx +++ b/src/renderer/src/components/Home/Home.tsx @@ -8,7 +8,7 @@ const Home: React.FC = () => {