diff --git a/client/package.json b/client/package.json index 557fac5ce11..8a047c6e8b8 100644 --- a/client/package.json +++ b/client/package.json @@ -80,7 +80,7 @@ "styleguide": "vue-styleguidist server", "styleguide:build": "vue-styleguidist build", "test": "yarn run test-mocha && yarn run test-qunit && yarn run jest", - "jest": "jest", + "jest": "jest --config tests/jest.config.js", "test-watch": "yarn run test-mocha --no-single-run", "test-qunit": "karma start tests/karma/karma.config.qunit.js", "test-mocha": "karma start tests/karma/karma.config.mocha.js", diff --git a/client/src/store/jobMetricsStore.mocha.js b/client/src/store/jobMetricsStore.mocha.js deleted file mode 100644 index a35573cb334..00000000000 --- a/client/src/store/jobMetricsStore.mocha.js +++ /dev/null @@ -1,19 +0,0 @@ -import { jobMetricsStore } from "./jobMetricsStore"; - -describe("store/jobMetricsStore.js", () => { - it("getter should return empty list for unfetched job IDs", () => { - const state = { - jobMetricsByJobId: {}, - }; - let metrics = jobMetricsStore.getters.getJobMetricsByJobId(state)("123"); - assert(metrics.length == 0); - }); - - it("should simply return fetched metrics list for job ID", () => { - const state = { - jobMetricsByJobId: { "123": [{ plugin: "core", value: 123 }] }, - }; - let metrics = jobMetricsStore.getters.getJobMetricsByJobId(state)("123"); - assert(metrics.length == 1); - }); -}); diff --git a/client/src/store/jobMetricsStore.test.js b/client/src/store/jobMetricsStore.test.js new file mode 100644 index 00000000000..bf99a44ab55 --- /dev/null +++ b/client/src/store/jobMetricsStore.test.js @@ -0,0 +1,19 @@ +import { jobMetricsStore } from "./jobMetricsStore"; + +describe("store/jobMetricsStore.js", () => { + test("getter should return empty list for unfetched job IDs", () => { + const state = { + jobMetricsByJobId: {}, + }; + const metrics = jobMetricsStore.getters.getJobMetricsByJobId(state)("123"); + expect(metrics.length == 0).toBeTruthy(); + }); + + test("should simply return fetched metrics list for job ID", () => { + const state = { + jobMetricsByJobId: { "123": [{ plugin: "core", value: 123 }] }, + }; + const metrics = jobMetricsStore.getters.getJobMetricsByJobId(state)("123"); + expect(metrics.length == 1).toBeTruthy(); + }); +}); diff --git a/client/jest.config.js b/client/tests/jest.config.js similarity index 97% rename from client/jest.config.js rename to client/tests/jest.config.js index f20275b129e..dca91eba3ff 100644 --- a/client/jest.config.js +++ b/client/tests/jest.config.js @@ -1,3 +1,5 @@ +const path = require("path"); + // For a detailed explanation regarding each configuration property, visit: // https://jestjs.io/docs/en/configuration.html @@ -77,7 +79,8 @@ module.exports = { ], modulePaths: [ - "/galaxy/src/" + "/src/", + "/node_modules/" ], // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module @@ -114,12 +117,12 @@ module.exports = { // restoreMocks: false, // The root directory that Jest should scan for tests and modules within - // rootDir: undefined, + rootDir: path.join(__dirname, "../"), // A list of paths to directories that Jest should use to search for files in - // roots: [ - // "" - // ], + roots: [ + "/src" + ], // Allows you to use a custom runner instead of Jest's default test runner // runner: "jest-runner",