From ff00f7a99ecec7e6f4caf9c4c646c265376889f1 Mon Sep 17 00:00:00 2001 From: Thomas Nordquist Date: Mon, 20 Apr 2020 12:31:57 +0200 Subject: [PATCH] Add app tests to `yarn test` --- .cspell.json | 2 ++ app/src/utils/ConfigMigrator.ts | 6 +++--- package.json | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.cspell.json b/.cspell.json index 360993f..afcb54f 100644 --- a/.cspell.json +++ b/.cspell.json @@ -1,6 +1,8 @@ { "language": "en", "words": [ + "Bbreak", + "nodered", "goog", "thomasnordquist", "nowrap", diff --git a/app/src/utils/ConfigMigrator.ts b/app/src/utils/ConfigMigrator.ts index 7663ae4..2a9cb1c 100644 --- a/app/src/utils/ConfigMigrator.ts +++ b/app/src/utils/ConfigMigrator.ts @@ -16,7 +16,7 @@ export class ConfigMigrator { public applyMigrations(subject: MigrationSubject): Partial { while (this.isMigrationNecessary(subject)) { - subject = this.applyableMigrations(subject) + subject = this.applicableMigrations(subject) .filter(migration => migration.from === subject.configVersion) .reduce((currentSubject, migration) => migration.apply(currentSubject as any), subject) } @@ -25,10 +25,10 @@ export class ConfigMigrator { } public isMigrationNecessary(subject: MigrationSubject): boolean { - return this.applyableMigrations(subject).length > 0 + return this.applicableMigrations(subject).length > 0 } - private applyableMigrations(subject: MigrationSubject): Migration[] { + private applicableMigrations(subject: MigrationSubject): Migration[] { return this.migrations.filter(migration => migration.from === subject.configVersion) } } diff --git a/package.json b/package.json index 87e38ea..27ec391 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "main": "dist/src/electron.js", "scripts": { "start": "electron .", - "test": "yarn run test-backend", + "test": "yarn test:app && yarn test:backend", + "test:app": "cd app && yarn test", + "test:backend": "cd backend && yarn test", "install": "cd app && yarn && cd ..", "dev": "npm-run-all --parallel dev:*", "dev:app": "cd app && npm run dev", @@ -15,7 +17,6 @@ "lint:tslint": "tslint -p ./", "lint:spellcheck": "cspell -e ./build -e \"node_modules\" \"**/*.ts{x,}\"", "build": "tsc && cd app && yarn run build && cd ..", - "test-backend": "cd backend && yarn run test && cd ..", "prepare-release": "ts-node scripts/prepare-release.ts", "package": "ts-node package.ts", "ui-test": "./scripts/uiTests.sh",