Improve Settings test coverage.
This commit is contained in:
parent
60d2298a16
commit
56cec7a835
2 changed files with 4 additions and 7 deletions
|
@ -19,24 +19,20 @@ interface settingsFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Settings extends EventEmitter {
|
export class Settings extends EventEmitter {
|
||||||
static #instance: Settings|undefined;
|
static #instance: Settings | undefined;
|
||||||
|
|
||||||
readonly #file: string;
|
readonly #file: string;
|
||||||
|
|
||||||
minValue: number;
|
minValue: number;
|
||||||
maxDistance: number;
|
maxDistance: number;
|
||||||
|
|
||||||
#matrixFile: null|string;
|
#matrixFile: null | string;
|
||||||
matrix?: EliteMatrix;
|
matrix?: EliteMatrix;
|
||||||
|
|
||||||
private constructor(isPackaged: boolean) {
|
private constructor(isPackaged: boolean) {
|
||||||
super();
|
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
|
// 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.
|
// file, and this information is necessary to build the UI.
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { Settings } from '../src/models/Settings';
|
||||||
import { mockSettings } from './mockData';
|
import { mockSettings } from './mockData';
|
||||||
|
|
||||||
jest.mock('fs');
|
jest.mock('fs');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
describe('Settings', () => {
|
describe('Settings', () => {
|
||||||
const settingsFile = {
|
const settingsFile = {
|
||||||
|
|
Loading…
Reference in a new issue