diff --git a/components/annot-columns.vue b/components/annot-columns.vue index e69ca35c..3b064673 100644 --- a/components/annot-columns.vue +++ b/components/annot-columns.vue @@ -13,7 +13,7 @@ data-cy="mappedColumns" class="d-flex justify-content-between align-items-center" :key="columnName" - v-for="columnName of getMappedColumns(activeCategory)"> + v-for="columnName of getColumnsForCategory(activeCategory)"> {{ columnName }} {{ getColumnDescription(columnName) }} @@ -93,7 +93,7 @@ "getHarmonizedPreview", "getHeuristic", - "getMappedColumns", + "getColumnsForCategory", "getTransformOptions", "getUniqueValues" ]) diff --git a/cypress/component/annot-columns.cy.js b/cypress/component/annot-columns.cy.js index db62d369..7df78ab3 100644 --- a/cypress/component/annot-columns.cy.js +++ b/cypress/component/annot-columns.cy.js @@ -4,7 +4,7 @@ import annotColumns from "~/components/annot-columns.vue"; const store = { commit: () => {}, getters: { - getMappedColumns: () => (activeCategory) => { + getColumnsForCategory: () => (activeCategory) => { return [ "column1", "column2", diff --git a/cypress/component/annot-continuous-values.cy.js b/cypress/component/annot-continuous-values.cy.js index 4e4389f3..16889446 100644 --- a/cypress/component/annot-continuous-values.cy.js +++ b/cypress/component/annot-continuous-values.cy.js @@ -36,7 +36,7 @@ describe("Continuous values component", () => { return store.state.dataDictionary.annotated[p_column].transformationHeuristic; }, - getMappedColumns: () => (p_activeCategory) => { + getColumnsForCategory: () => (p_activeCategory) => { return ["column1"]; }, @@ -153,7 +153,7 @@ describe("Continuous values component", () => { // Setup store.state.dataDictionary.annotated["column2"] = { transformationHeuristic: "" }; - store.getters.getMappedColumns = () => (p_activeCategory) => { + store.getters.getColumnsForCategory = () => (p_activeCategory) => { return ["column1", "column2"]; }; @@ -196,7 +196,7 @@ describe("Continuous values component", () => { // Setup store.state.dataDictionary.annotated["column2"] = { transformationHeuristic: "" }; - store.getters.getMappedColumns = () => (p_activeCategory) => { + store.getters.getColumnsForCategory = () => (p_activeCategory) => { return ["column1", "column2"]; }; diff --git a/cypress/unit/store-getter-getMappedColumns.cy.js b/cypress/unit/store-getter-getColumnsForCategory.cy.js similarity index 63% rename from cypress/unit/store-getter-getMappedColumns.cy.js rename to cypress/unit/store-getter-getColumnsForCategory.cy.js index bd8ccdf7..7cce2136 100644 --- a/cypress/unit/store-getter-getMappedColumns.cy.js +++ b/cypress/unit/store-getter-getColumnsForCategory.cy.js @@ -13,17 +13,17 @@ const store = { } }; -describe("getMappedColumns", () => { +describe("getColumnsForCategory", () => { it("Gets list of columns of a given category", () => { // Assert - expect(getters.getMappedColumns(store.state)("category1")).to.deep.equal(["column1", "column3"]); + expect(getters.getColumnsForCategory(store.state)("category1")).to.deep.equal(["column1", "column3"]); }); it("Gets empty list if a given category is not assigned to any columns", () => { // Assert - expect(getters.getMappedColumns(store.state)("category4")).to.deep.equal([]); + expect(getters.getColumnsForCategory(store.state)("category4")).to.deep.equal([]); }); -}); \ No newline at end of file +}); diff --git a/cypress/unit/store-mutation-alterColumnToToolMap.cy.js b/cypress/unit/store-mutation-alterColumnToToolMap.cy.js index 16bb6c99..2a9f98e4 100644 --- a/cypress/unit/store-mutation-alterColumnToToolMap.cy.js +++ b/cypress/unit/store-mutation-alterColumnToToolMap.cy.js @@ -22,19 +22,19 @@ describe("alterColumnToToolMapping", () => { it("Maps column to tool if it's not already mapped", () => { - mutations.alterColumnToToolMapping(store.state, "column2", "cogatlas:MOCA"); + mutations.alterColumnToToolMapping(store.state, {columnName: "column2", toolIdentifier: "cogatlas:MOCA"}); expect(store.state.columnToToolMap.column2).to.equal("cogatlas:MOCA"); }); it("Maps column to new tool overwriting previous mapping", () => { - mutations.alterColumnToToolMapping(store.state, "column3", "cogatlas:MOCA"); + mutations.alterColumnToToolMapping(store.state, {columnName: "column3", toolIdentifier: "cogatlas:MOCA"}); expect(store.state.columnToToolMap.column3).to.equal("cogatlas:MOCA"); }); it("Sets mapping to null if it's already mapped", () => { - mutations.alterColumnToToolMapping(store.state, "column1", "cogatlas:MOCA"); + mutations.alterColumnToToolMapping(store.state, {columnName: "column1", toolIdentifier: "cogatlas:MOCA"}); expect(store.state.columnToToolMap.column1).to.equal(null); }); }); diff --git a/store/index.js b/store/index.js index af7f5534..042068ad 100644 --- a/store/index.js +++ b/store/index.js @@ -752,8 +752,8 @@ export const mutations = { } }, - alterColumnToToolMapping(p_state, columnName, toolIdentifier) { - if ( p_state.columnToToolMap[columnName] == toolIdentifier ) { + alterColumnToToolMapping(p_state, {columnName, toolIdentifier}) { + if ( p_state.columnToToolMap[columnName] === toolIdentifier ) { p_state.columnToToolMap[columnName] = null; } else { p_state.columnToToolMap[columnName] = toolIdentifier;