diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 462c065d..bc4bd59d 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -25,7 +25,7 @@ jobs: uses: cycjimmy/semantic-release-action@v3 id: semantic env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ secrets.TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Merge master -> next if: github.ref == 'refs/heads/master' diff --git a/components/ExtensionSelector.vue b/components/ExtensionSelector.vue index 41c9c939..ef0a633f 100644 --- a/components/ExtensionSelector.vue +++ b/components/ExtensionSelector.vue @@ -39,7 +39,7 @@ :color="extension.is_saveable ? 'primary' : 'grey'" hover @click=" - set_variables(output_geode_object, output_extension) + update_values(output_geode_object, output_extension) " :disabled="!extension.is_saveable" > @@ -123,13 +123,12 @@ toggle_loading() } - function set_variables(output_geode_object, output_extension) { + function update_values(output_geode_object, output_extension) { if (output_geode_object != "" && output_extension != "") { - const keys_values_object = { + emit("update_values", { output_geode_object, output_extension, - } - emit("update_values", keys_values_object) + }) emit("increment_step") } } diff --git a/components/Inspector/InspectionButton.vue b/components/Inspector/InspectionButton.vue new file mode 100644 index 00000000..59febdf2 --- /dev/null +++ b/components/Inspector/InspectionButton.vue @@ -0,0 +1,50 @@ + + + + Inspect + + + + + Cancel + + + + diff --git a/components/Inspector/ResultPanel.vue b/components/Inspector/ResultPanel.vue new file mode 100644 index 00000000..e57d1c3a --- /dev/null +++ b/components/Inspector/ResultPanel.vue @@ -0,0 +1,55 @@ + + + + + + + + + mdi-check-circle-outline + + mdi-close-circle + + + {{ result.title }} + + + + + + + + + {{ issue }} + + + + + + + + + + diff --git a/package.json b/package.json index b4405cd2..67e133b6 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "version": "0.0.0-semantically-released", "main": "./nuxt.config.js", "dependencies": { - "@geode/opengeodeweb-back": "4.0.0", + "@geode/opengeodeweb-back": "4.1.0", "@geode/opengeodeweb-viewer": "0.1.1", "@kitware/vtk.js": "^30.3.1", "@mdi/font": "^7.4.47", @@ -52,7 +52,7 @@ "semver": "^7.6.0", "vue-recaptcha": "^2.0.3", "vue3-carousel": "^0.3.3", - "vuetify": "^3.5.14" + "vuetify": "^3.6.3" }, "repository": { "type": "git", diff --git a/test/components/ErrorsBanner.nuxt.test.js b/test/components/Errors/ErrorsBanner.nuxt.test.js similarity index 100% rename from test/components/ErrorsBanner.nuxt.test.js rename to test/components/Errors/ErrorsBanner.nuxt.test.js diff --git a/test/components/ErrorsSnackers.nuxt.test.js b/test/components/Errors/ErrorsSnackers.nuxt.test.js similarity index 71% rename from test/components/ErrorsSnackers.nuxt.test.js rename to test/components/Errors/ErrorsSnackers.nuxt.test.js index e8d71287..562ef795 100644 --- a/test/components/ErrorsSnackers.nuxt.test.js +++ b/test/components/Errors/ErrorsSnackers.nuxt.test.js @@ -15,11 +15,20 @@ const vuetify = createVuetify({ describe("ErrorsSnackers.vue", async () => { test(`Test delete error`, async () => { - const wrapper = await mount(ErrorsSnackers, { - global: { - plugins: [vuetify], + const wrapper = mount( + { + template: "", }, - }) + { + props: {}, + global: { + components: { + ErrorsSnackers, + }, + plugins: [vuetify], + }, + }, + ) const errors_store = use_errors_store() const error = { @@ -30,7 +39,7 @@ describe("ErrorsSnackers.vue", async () => { } await errors_store.add_error(error) expect(errors_store.errors.length).toBe(1) - const v_btn = wrapper.findComponent(components.VBtn) + const v_btn = await wrapper.findComponent(components.VBtn) await v_btn.trigger("click") expect(errors_store.errors.length).toBe(0) }) diff --git a/test/components/ExtensionSelector.nuxt.test.js b/test/components/ExtensionSelector.nuxt.test.js index 65515124..b06c8f23 100644 --- a/test/components/ExtensionSelector.nuxt.test.js +++ b/test/components/ExtensionSelector.nuxt.test.js @@ -11,8 +11,7 @@ import ExtensionSelector from "@/components/ExtensionSelector.vue" import schemas from "@geode/opengeodeweb-back/schemas.json" -const geode_objects_and_output_extensions = - schemas.opengeodeweb_back.geode_objects_and_output_extensions +const schema = schemas.opengeodeweb_back.geode_objects_and_output_extensions const vuetify = createVuetify({ components, @@ -24,8 +23,8 @@ describe("ExtensionSelector.vue", async () => { const output_geode_object = "BRep" const output_extension = "msh" - registerEndpoint(geode_objects_and_output_extensions.$id, { - method: geode_objects_and_output_extensions.methods[0], + registerEndpoint(schema.$id, { + method: schema.methods[0], handler: () => ({ geode_objects_and_output_extensions: { BRep: { msh: { is_saveable: true } }, @@ -44,7 +43,7 @@ describe("ExtensionSelector.vue", async () => { // await v_card[1].trigger("click") // expect(wrapper.emitted()).toHaveProperty("update_values") // expect(wrapper.emitted().update_values).toHaveLength(1) - // expect(wrapper.emitted().update_values[0][0]).toEqual({ + // expect(wrapper.emitted().update_values[0][0]).toStrictEqual({ // output_geode_object, // output_extension, // }) diff --git a/test/components/Inspector/InspectionButon.nuxt.test.js b/test/components/Inspector/InspectionButon.nuxt.test.js new file mode 100644 index 00000000..b694b8c7 --- /dev/null +++ b/test/components/Inspector/InspectionButon.nuxt.test.js @@ -0,0 +1,67 @@ +// @vitest-environment nuxt + +import { describe, expect, test } from "vitest" +import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime" +import { flushPromises } from "@vue/test-utils" + +import { createVuetify } from "vuetify" +import * as components from "vuetify/components" +import * as directives from "vuetify/directives" + +import InspectorInspectionButton from "@/components/Inspector/InspectionButton.vue" +import schemas from "@geode/opengeodeweb-back/schemas.json" +const schema = schemas.opengeodeweb_back.inspect_file + +const vuetify = createVuetify({ + components, + directives, +}) + +describe("Inspector/InspectionButton.vue", async () => { + test(`Test with issues`, async () => { + var inspection_result = { + title: "Brep inspection", + nb_issues: 3, + children: [ + { + title: "Brep inspection", + nb_issues: 2, + issues: ["issue 1", "issue 2"], + }, + { + title: "Brep inspection", + nb_issues: 1, + issues: ["issue 1"], + }, + ], + } + + registerEndpoint(schema.$id, { + method: schema.methods[0], + handler: () => ({ + inspection_result, + }), + }) + const input_geode_object = "BRep" + const filename = "test.txt" + + const wrapper = await mountSuspended(InspectorInspectionButton, { + global: { + plugins: [vuetify], + }, + props: { input_geode_object, filename }, + }) + + expect(wrapper.exists()).toBe(true) + const v_btn = await wrapper.findComponent(components.VBtn) + await v_btn.trigger("click") + await flushPromises() + + expect(wrapper.emitted()).toHaveProperty("update_values") + expect(wrapper.emitted().update_values).toHaveLength(1) + expect(wrapper.emitted().update_values[0][0]).toStrictEqual({ + inspection_result: [inspection_result], + }) + expect(wrapper.emitted()).toHaveProperty("increment_step") + }) +}) diff --git a/test/components/Inspector/ResultPanel.nuxt.test.js b/test/components/Inspector/ResultPanel.nuxt.test.js new file mode 100644 index 00000000..e38b6460 --- /dev/null +++ b/test/components/Inspector/ResultPanel.nuxt.test.js @@ -0,0 +1,68 @@ +// @vitest-environment nuxt + +import { describe, expect, test } from "vitest" +import { mountSuspended } from "@nuxt/test-utils/runtime" + +import { createVuetify } from "vuetify" +import * as components from "vuetify/components" +import * as directives from "vuetify/directives" + +import InspectorResultPanel from "@/components/Inspector/ResultPanel.vue" + +const vuetify = createVuetify({ + components, + directives, +}) + +describe("Inspector/ResultPanel.vue", async () => { + test(`Test with issues`, async () => { + const inspection_result = [ + { + title: "Brep inspection", + nb_issues: 26, + children: [], + }, + ] + + const wrapper = await mountSuspended(InspectorResultPanel, { + global: { + plugins: [vuetify], + }, + props: { inspection_result }, + }) + + expect(wrapper.exists()).toBe(true) + expect(wrapper.componentVM.opened_panels._value).toStrictEqual([0]) + expect(wrapper.componentVM.props.inspection_result).toStrictEqual( + inspection_result, + ) + + const child_result_panel_wrapper = + await wrapper.findComponent(InspectorResultPanel) + expect(child_result_panel_wrapper.exists()).toBe(true) + expect( + child_result_panel_wrapper.componentVM.props.inspection_result, + ).toStrictEqual(inspection_result[0].children) + }) + + test(`Test without issues`, async () => { + const inspection_result = [ + { + title: "Brep inspection", + nb_issues: 0, + }, + ] + const wrapper = await mountSuspended(InspectorResultPanel, { + global: { + plugins: [vuetify], + }, + props: { inspection_result }, + }) + + expect(wrapper.exists()).toBe(true) + expect(wrapper.componentVM.opened_panels._value).toStrictEqual([]) + expect(wrapper.componentVM.props.inspection_result).toStrictEqual( + inspection_result, + ) + }) +})