From 56cec7a835fca983e08cf00c06882be396763faa Mon Sep 17 00:00:00 2001 From: marley Date: Thu, 18 May 2023 21:20:15 -0700 Subject: [PATCH] Improve Settings test coverage. --- src/models/Settings.ts | 10 +++------- test/Settings.test.ts | 1 + 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/models/Settings.ts b/src/models/Settings.ts index 5bea55a..266b0d7 100644 --- a/src/models/Settings.ts +++ b/src/models/Settings.ts @@ -19,24 +19,20 @@ interface settingsFile { } export class Settings extends EventEmitter { - static #instance: Settings|undefined; + static #instance: Settings | undefined; readonly #file: string; minValue: number; maxDistance: number; - #matrixFile: null|string; + #matrixFile: null | string; matrix?: EliteMatrix; private constructor(isPackaged: boolean) { super(); - if (!isPackaged && os.platform() === 'linux') { - this.#file = '/mnt/c/Users/marle/ed-safari-settings.json'; - } else { - this.#file = path.join(os.homedir(), 'ed-safari-settings.json'); - } + this.#file = path.join(os.homedir(), 'ed-safari-settings.json'); // Check if settings file exists, and create it if not. Using sync since it's such a small // file, and this information is necessary to build the UI. diff --git a/test/Settings.test.ts b/test/Settings.test.ts index a34f23a..889902e 100644 --- a/test/Settings.test.ts +++ b/test/Settings.test.ts @@ -4,6 +4,7 @@ import { Settings } from '../src/models/Settings'; import { mockSettings } from './mockData'; jest.mock('fs'); +const fs = require('fs'); describe('Settings', () => { const settingsFile = {