@geode/opengeodeweb-front 10.3.0 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/app/assets/geode_objects.js +1 -3
  3. package/app/components/Carousel.vue +7 -4
  4. package/app/components/CrsSelector.vue +5 -6
  5. package/app/components/DragAndDrop.vue +18 -8
  6. package/app/components/ExtensionSelector.vue +9 -17
  7. package/app/components/FeedBack/ErrorBanner.vue +1 -1
  8. package/app/components/FeedBack/Snackers.vue +4 -1
  9. package/app/components/FileSelector.vue +21 -10
  10. package/app/components/FileUploader.vue +15 -32
  11. package/app/components/HybridRenderingView.vue +5 -3
  12. package/app/components/Inspector/InspectionButton.vue +2 -2
  13. package/app/components/Inspector/ResultPanel.vue +4 -4
  14. package/app/components/Launcher.vue +1 -1
  15. package/app/components/Loading.vue +6 -6
  16. package/app/components/MissingFilesSelector.vue +23 -29
  17. package/app/components/ObjectSelector.vue +11 -10
  18. package/app/components/OptionCard.vue +1 -1
  19. package/app/components/PackagesVersions.vue +5 -3
  20. package/app/components/Recaptcha.vue +6 -4
  21. package/app/components/RemoteRenderingView.vue +4 -3
  22. package/app/components/Screenshot.vue +4 -4
  23. package/app/components/Step.vue +7 -7
  24. package/app/components/VeaseViewToolbar.vue +3 -3
  25. package/app/components/Viewer/BreadCrumb.vue +2 -4
  26. package/app/components/Viewer/ContextMenu.vue +77 -45
  27. package/app/components/Viewer/ContextMenuItem.vue +42 -33
  28. package/app/components/Viewer/EdgedCurve/PointsOptions.vue +3 -3
  29. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +5 -5
  30. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +6 -6
  31. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +5 -5
  32. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +5 -5
  33. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +6 -7
  34. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
  35. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +3 -3
  36. package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
  37. package/app/components/Viewer/Grid/2D/CellsOptions.vue +3 -3
  38. package/app/components/Viewer/Grid/2D/EdgesOptions.vue +3 -3
  39. package/app/components/Viewer/Grid/2D/PointsOptions.vue +3 -3
  40. package/app/components/Viewer/Grid/3D/CellsOptions.vue +3 -3
  41. package/app/components/Viewer/Grid/3D/EdgesOptions.vue +3 -3
  42. package/app/components/Viewer/Grid/3D/FacetsOptions.vue +3 -3
  43. package/app/components/Viewer/Grid/3D/PointsOptions.vue +3 -3
  44. package/app/components/Viewer/HybridSolid/EdgesOptions.vue +3 -3
  45. package/app/components/Viewer/HybridSolid/PointsOptions.vue +3 -3
  46. package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +3 -3
  47. package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +3 -3
  48. package/app/components/Viewer/Options/CellAttributeSelector.vue +23 -20
  49. package/app/components/Viewer/Options/ColorMapList.vue +75 -50
  50. package/app/components/Viewer/Options/ColorMapPicker.vue +38 -32
  51. package/app/components/Viewer/Options/ColorPicker.vue +3 -3
  52. package/app/components/Viewer/Options/ColoringTypeSelector.vue +29 -21
  53. package/app/components/Viewer/Options/EdgeAttributeSelector.vue +7 -7
  54. package/app/components/Viewer/Options/PolygonAttributeSelector.vue +7 -7
  55. package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +7 -7
  56. package/app/components/Viewer/Options/TextureItem.vue +5 -5
  57. package/app/components/Viewer/Options/TexturesSelector.vue +5 -5
  58. package/app/components/Viewer/Options/VertexAttributeSelector.vue +7 -7
  59. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +5 -5
  60. package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +3 -3
  61. package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +3 -3
  62. package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +6 -6
  63. package/app/components/Viewer/Solid/EdgesOptions.vue +3 -3
  64. package/app/components/Viewer/Solid/PointsOptions.vue +3 -3
  65. package/app/components/Viewer/Solid/PolygonsOptions.vue +3 -3
  66. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +6 -6
  67. package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +3 -3
  68. package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +3 -3
  69. package/app/components/Viewer/Tree/ObjectTree.vue +7 -9
  70. package/app/components/Viewer/TreeComponent.vue +9 -13
  71. package/app/components/Viewer/TreeObject.vue +8 -9
  72. package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +3 -3
  73. package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +3 -3
  74. package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +3 -3
  75. package/app/components/Wrapper.vue +1 -2
  76. package/app/components/ZScaling.vue +1 -1
  77. package/app/composables/project_manager.js +6 -6
  78. package/app/plugins/auto_store_register.js +1 -1
  79. package/app/stores/app.js +45 -41
  80. package/app/stores/data.js +52 -51
  81. package/app/stores/data_style.js +12 -11
  82. package/app/stores/feedback.js +5 -1
  83. package/app/stores/geode.js +16 -13
  84. package/app/stores/hybrid_viewer.js +72 -44
  85. package/app/stores/infra.js +18 -16
  86. package/app/stores/lambda.js +1 -9
  87. package/app/stores/menu.js +13 -13
  88. package/app/stores/treeview.js +15 -13
  89. package/app/stores/viewer.js +39 -33
  90. package/app/utils/app_mode.js +4 -3
  91. package/app/utils/default_styles.js +55 -47
  92. package/app/utils/file_import_workflow.js +4 -17
  93. package/app/utils/local.js +195 -184
  94. package/app/utils/upload_file.js +1 -2
  95. package/eslint.config.js +2 -2
  96. package/internal/database/database.js +17 -32
  97. package/internal/database/extended_database.js +25 -0
  98. package/internal/stores/data_style/mesh/cells/cell.js +3 -3
  99. package/internal/stores/data_style/mesh/cells/color.js +1 -1
  100. package/internal/stores/data_style/mesh/cells/index.js +7 -7
  101. package/internal/stores/data_style/mesh/cells/textures.js +1 -1
  102. package/internal/stores/data_style/mesh/cells/vertex.js +3 -3
  103. package/internal/stores/data_style/mesh/cells/visibility.js +1 -1
  104. package/internal/stores/data_style/mesh/edges/color.js +1 -1
  105. package/internal/stores/data_style/mesh/edges/edge.js +22 -22
  106. package/internal/stores/data_style/mesh/edges/index.js +7 -7
  107. package/internal/stores/data_style/mesh/edges/vertex.js +3 -3
  108. package/internal/stores/data_style/mesh/edges/visibility.js +1 -1
  109. package/internal/stores/data_style/mesh/edges/width.js +1 -1
  110. package/internal/stores/data_style/mesh/index.js +4 -5
  111. package/internal/stores/data_style/mesh/points/color.js +1 -1
  112. package/internal/stores/data_style/mesh/points/index.js +6 -6
  113. package/internal/stores/data_style/mesh/points/size.js +1 -1
  114. package/internal/stores/data_style/mesh/points/vertex.js +3 -3
  115. package/internal/stores/data_style/mesh/points/visibility.js +1 -1
  116. package/internal/stores/data_style/mesh/polygons/color.js +1 -1
  117. package/internal/stores/data_style/mesh/polygons/index.js +7 -7
  118. package/internal/stores/data_style/mesh/polygons/polygon.js +3 -3
  119. package/internal/stores/data_style/mesh/polygons/textures.js +1 -1
  120. package/internal/stores/data_style/mesh/polygons/vertex.js +3 -3
  121. package/internal/stores/data_style/mesh/polygons/visibility.js +1 -1
  122. package/internal/stores/data_style/mesh/polyhedra/color.js +1 -1
  123. package/internal/stores/data_style/mesh/polyhedra/index.js +6 -6
  124. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +3 -3
  125. package/internal/stores/data_style/mesh/polyhedra/vertex.js +3 -3
  126. package/internal/stores/data_style/mesh/polyhedra/visibility.js +1 -1
  127. package/internal/stores/data_style/model/edges.js +1 -1
  128. package/internal/stores/data_style/model/index.js +32 -22
  129. package/internal/utils/api_fetch.js +8 -5
  130. package/internal/utils/viewer_call.js +42 -46
  131. package/nuxt.config.js +3 -3
  132. package/package.json +1 -1
  133. package/scripts/generate_geode_objects.js +8 -7
  134. package/tests/integration/setup.js +28 -21
  135. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -10
  136. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +18 -10
  137. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +9 -5
  138. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +17 -10
  139. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +18 -10
  140. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +18 -10
  141. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -6
  142. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -6
  143. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -5
  144. package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -5
  145. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -6
  146. package/tests/integration/stores/data_style/model/points.nuxt.test.js +9 -5
  147. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -6
  148. package/tests/integration/stores/viewer.nuxt.test.js +55 -39
  149. package/tests/setup_indexeddb.js +1 -0
  150. package/tests/unit/components/CrsSelector.nuxt.test.js +18 -19
  151. package/tests/unit/components/ExtensionSelector.nuxt.test.js +24 -19
  152. package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -36
  153. package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +20 -25
  154. package/tests/unit/components/FileSelector.nuxt.test.js +27 -27
  155. package/tests/unit/components/FileUploader.nuxt.test.js +18 -17
  156. package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +9 -16
  157. package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +8 -6
  158. package/tests/unit/components/Launcher.nuxt.test.js +12 -17
  159. package/tests/unit/components/MissingFilesSelector.nuxt.test.js +16 -19
  160. package/tests/unit/components/ObjectSelector.nuxt.test.js +30 -34
  161. package/tests/unit/components/PackagesVersions.nuxt.test.js +8 -11
  162. package/tests/unit/components/Step.nuxt.test.js +8 -7
  163. package/tests/unit/components/Stepper.nuxt.test.js +14 -12
  164. package/tests/unit/composables/ProjectManager.nuxt.test.js +142 -100
  165. package/tests/unit/composables/api_fetch.nuxt.test.js +12 -39
  166. package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -61
  167. package/tests/unit/composables/upload_file.nuxt.test.js +21 -25
  168. package/tests/unit/plugins/project_load.nuxt.test.js +22 -21
  169. package/tests/unit/stores/App.nuxt.test.js +45 -43
  170. package/tests/unit/stores/Feedback.nuxt.test.js +16 -18
  171. package/tests/unit/stores/Geode.nuxt.test.js +135 -137
  172. package/tests/unit/stores/Infra.nuxt.test.js +20 -26
  173. package/tests/unit/stores/Lambda.nuxt.test.js +30 -31
  174. package/tests/unit/stores/Treeview.nuxt.test.js +53 -55
  175. package/tests/unit/stores/Viewer.nuxt.test.js +16 -23
  176. package/tests/unit/utils/validate_schema.nuxt.test.js +18 -18
  177. package/tests/utils.js +15 -2
  178. package/tests/vitest.config.js +6 -2
@@ -1,26 +1,27 @@
1
- import { describe, expect, test, vi } from "vitest"
2
- import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
3
- import { setActivePinia } from "pinia"
4
- import { createTestingPinia } from "@pinia/testing"
1
+ // Third party imports
5
2
  import * as components from "vuetify/components"
6
-
7
3
  import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
4
+ import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
5
+ import { beforeEach, describe, expect, test, vi } from "vitest"
6
+ import { nextTick } from "vue"
7
+
8
+ // Local imports
9
+ import { setupActivePinia, vuetify } from "../../utils"
8
10
  import ExtensionSelector from "@ogw_front/components/ExtensionSelector"
9
11
  import { useGeodeStore } from "@ogw_front/stores/geode"
10
- import { vuetify } from "../../utils"
12
+
13
+ const EXPECTED_LENGTH = 1
14
+ const FIRST_INDEX = 0
15
+ const SECOND_INDEX = 1
11
16
 
12
17
  const schema = schemas.opengeodeweb_back.geode_objects_and_output_extensions
13
18
 
14
- describe("ExtensionSelector", async () => {
15
- const pinia = createTestingPinia({
16
- stubActions: false,
17
- createSpy: vi.fn,
18
- })
19
- setActivePinia(pinia)
20
- const geodeStore = useGeodeStore()
19
+ const pinia = setupActivePinia()
20
+ const geodeStore = useGeodeStore()
21
+
22
+ beforeEach(() => {
21
23
  geodeStore.base_url = ""
22
24
 
23
- // Mock the request method to simulate API call
24
25
  geodeStore.request = vi.fn((schema, params, callbacks) => {
25
26
  const response = {
26
27
  geode_objects_and_output_extensions: {
@@ -32,13 +33,15 @@ describe("ExtensionSelector", async () => {
32
33
  }
33
34
  return Promise.resolve(response)
34
35
  })
36
+ })
35
37
 
38
+ describe(ExtensionSelector, () => {
36
39
  test(`Select geode_object & extension`, async () => {
37
40
  const output_geode_object = "BRep"
38
41
  const output_extension = "msh"
39
42
 
40
43
  registerEndpoint(schema.$id, {
41
- method: schema.methods[0],
44
+ method: schema.methods[FIRST_INDEX],
42
45
  handler: () => ({
43
46
  geode_objects_and_output_extensions: {
44
47
  BRep: { msh: { is_saveable: true } },
@@ -52,12 +55,14 @@ describe("ExtensionSelector", async () => {
52
55
  props: { geode_object_type: "BRep", filenames: ["test.toto"] },
53
56
  })
54
57
  await nextTick()
55
- expect(wrapper.exists()).toBe(true)
58
+ expect(wrapper.exists()).toBeTruthy()
56
59
  const v_card = await wrapper.findAllComponents(components.VCard)
57
- await v_card[1].trigger("click")
60
+ await v_card[SECOND_INDEX].trigger("click")
58
61
  expect(wrapper.emitted()).toHaveProperty("update_values")
59
- expect(wrapper.emitted().update_values).toHaveLength(1)
60
- expect(wrapper.emitted().update_values[0][0]).toStrictEqual({
62
+ expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH)
63
+ expect(
64
+ wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX],
65
+ ).toStrictEqual({
61
66
  output_geode_object,
62
67
  output_extension,
63
68
  })
@@ -1,53 +1,40 @@
1
+ // Third party imports
1
2
  import { describe, expect, test, vi } from "vitest"
2
3
  import { mount } from "@vue/test-utils"
3
- import { createTestingPinia } from "@pinia/testing"
4
- import { setActivePinia } from "pinia"
5
4
 
5
+ // Local imports
6
+ import { setupActivePinia, vuetify } from "../../../utils"
6
7
  import FeedBackErrorBanner from "@ogw_front/components/FeedBack/ErrorBanner"
7
8
  import { useFeedbackStore } from "@ogw_front/stores/feedback"
8
- import { vuetify } from "../../../utils"
9
9
 
10
- describe("FeedBackErrorBanner", async () => {
11
- ;(test(`Test reload`, async () => {
12
- const pinia = createTestingPinia({
13
- stubActions: false,
14
- createSpy: vi.fn,
15
- })
16
- setActivePinia(pinia)
10
+ const CALLED_TIMES = 1
11
+
12
+ describe(FeedBackErrorBanner, () => {
13
+ const pinia = setupActivePinia()
14
+ test(`Test reload`, async () => {
17
15
  const wrapper = mount(FeedBackErrorBanner, {
18
16
  global: {
19
- plugins: [pinia, vuetify],
17
+ plugins: [vuetify, pinia],
20
18
  },
21
19
  })
22
20
  const reload_spy = vi.spyOn(wrapper.vm, "reload")
23
21
  const feedbackStore = useFeedbackStore()
24
22
  await feedbackStore.$patch({ server_error: true })
25
- expect(feedbackStore.server_error).toBe(true)
23
+ expect(feedbackStore.server_error).toBeTruthy()
26
24
  const v_btn = wrapper.findAll(".v-btn")
27
25
  await v_btn[0].trigger("click")
28
- expect(reload_spy).toHaveBeenCalledTimes(1)
29
- }),
30
- test(`Test delete error`, async () => {
31
- const wrapper = mount(FeedBackErrorBanner, {
32
- global: {
33
- plugins: [
34
- createTestingPinia({
35
- initialState: {
36
- feedback: {
37
- server_error: true,
38
- },
39
- },
40
- stubActions: false,
41
- createSpy: vi.fn,
42
- }),
43
- vuetify,
44
- ],
45
- },
46
- })
26
+ expect(reload_spy).toHaveBeenCalledTimes(CALLED_TIMES)
27
+ })
47
28
 
48
- const feedbackStore = useFeedbackStore()
49
- const v_btn = wrapper.findAll(".v-btn")
50
- await v_btn[1].trigger("click")
51
- expect(feedbackStore.server_error).toBe(false)
52
- }))
29
+ test(`Test delete error`, async () => {
30
+ const wrapper = mount(FeedBackErrorBanner, {
31
+ global: {
32
+ plugins: [vuetify, pinia],
33
+ },
34
+ })
35
+ const feedbackStore = useFeedbackStore()
36
+ const v_btn = wrapper.findAll(".v-btn")
37
+ await v_btn[1].trigger("click")
38
+ expect(feedbackStore.server_error).toBeFalsy()
39
+ })
53
40
  })
@@ -1,36 +1,31 @@
1
- // @vitest-environment nuxt
2
- vi.stubGlobal("visualViewport", new EventTarget())
1
+ // Third party imports
2
+ import * as components from "vuetify/components"
3
3
  import { describe, expect, test, vi } from "vitest"
4
4
  import { mount } from "@vue/test-utils"
5
- import * as components from "vuetify/components"
6
- import { setActivePinia } from "pinia"
7
- import { createTestingPinia } from "@pinia/testing"
8
5
 
6
+ // Local imports
7
+ import { setupActivePinia, vuetify } from "../../../utils"
9
8
  import FeedBackSnackers from "@ogw_front/components/FeedBack/Snackers"
10
9
  import { useFeedbackStore } from "@ogw_front/stores/feedback"
11
- import { vuetify } from "../../../utils"
12
10
 
13
- describe("FeedBackSnackers", async () => {
11
+ vi.stubGlobal("visualViewport", new EventTarget())
12
+
13
+ describe(FeedBackSnackers, async () => {
14
14
  test(`Test delete error`, async () => {
15
- const pinia = createTestingPinia({
16
- initialState: {
17
- feedback: {
18
- feedbacks: [
19
- {
20
- type: "error",
21
- code: 500,
22
- route: "/test",
23
- name: "test message",
24
- description: "test description",
25
- },
26
- ],
15
+ const pinia = setupActivePinia()
16
+ const feedbackStore = useFeedbackStore()
17
+ feedbackStore.$patch({
18
+ feedbacks: [
19
+ {
20
+ type: "error",
21
+ code: 500,
22
+ route: "/test",
23
+ name: "test message",
24
+ description: "test description",
27
25
  },
28
- },
29
- stubActions: false,
30
- createSpy: vi.fn,
26
+ ],
31
27
  })
32
- setActivePinia(pinia)
33
- const feedbackStore = useFeedbackStore()
28
+
34
29
  const wrapper = mount(
35
30
  {
36
31
  template: "<v-layout><FeedBackSnackers/></v-layout>",
@@ -41,7 +36,7 @@ describe("FeedBackSnackers", async () => {
41
36
  components: {
42
37
  FeedBackSnackers,
43
38
  },
44
- plugins: [pinia, vuetify],
39
+ plugins: [vuetify, pinia],
45
40
  },
46
41
  },
47
42
  )
@@ -1,33 +1,31 @@
1
+ // Third party imports
2
+ import * as components from "vuetify/components"
1
3
  import { describe, expect, test, vi } from "vitest"
2
- import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
4
+ import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
3
5
  import { flushPromises } from "@vue/test-utils"
4
- import * as components from "vuetify/components"
5
-
6
- import { setActivePinia } from "pinia"
7
- import { createTestingPinia } from "@pinia/testing"
8
-
9
6
  import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
10
7
 
8
+ // Local imports
9
+ import { setupActivePinia, vuetify } from "../../utils"
11
10
  import FileSelector from "@ogw_front/components/FileSelector"
12
11
  import FileUploader from "@ogw_front/components/FileUploader"
13
12
  import { useGeodeStore } from "@ogw_front/stores/geode"
14
- import { vuetify } from "../../utils"
13
+
14
+ const EXPECTED_LENGTH = 1
15
+ const FIRST_INDEX = 0
16
+ const SECOND_INDEX = 1
15
17
 
16
18
  const allowed_files_schema = schemas.opengeodeweb_back.allowed_files
17
19
  const upload_file_schema = schemas.opengeodeweb_back.upload_file
18
20
 
19
- describe("FileSelector", async () => {
20
- const pinia = createTestingPinia({
21
- stubActions: false,
22
- createSpy: vi.fn,
23
- })
24
- setActivePinia(pinia)
21
+ describe(FileSelector, async () => {
22
+ const pinia = setupActivePinia()
25
23
  const geodeStore = useGeodeStore()
26
24
  geodeStore.base_url = ""
27
25
 
28
26
  test(`Select file`, async () => {
29
27
  registerEndpoint(allowed_files_schema.$id, {
30
- method: allowed_files_schema.methods[0],
28
+ method: allowed_files_schema.methods[FIRST_INDEX],
31
29
  handler: () => ({
32
30
  extensions: ["1", "2", "3"],
33
31
  }),
@@ -42,7 +40,7 @@ describe("FileSelector", async () => {
42
40
  const file_uploader = wrapper.findComponent(FileUploader)
43
41
 
44
42
  registerEndpoint(upload_file_schema.$id, {
45
- method: upload_file_schema.methods[1],
43
+ method: upload_file_schema.methods[SECOND_INDEX],
46
44
  handler: () => ({}),
47
45
  })
48
46
 
@@ -59,23 +57,23 @@ describe("FileSelector", async () => {
59
57
  await flushPromises()
60
58
  await flushPromises()
61
59
  expect(wrapper.emitted()).toHaveProperty("update_values")
62
- expect(wrapper.emitted().update_values).toHaveLength(1)
63
- expect(wrapper.emitted().update_values[0][0]).toEqual({
60
+ expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH)
61
+ expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toEqual({
64
62
  files,
65
63
  auto_upload,
66
64
  })
67
65
  })
68
66
 
69
- describe(`Files prop`, () => {
67
+ describe(FileSelector, () => {
70
68
  registerEndpoint(allowed_files_schema.$id, {
71
- method: allowed_files_schema.methods[0],
69
+ method: allowed_files_schema.methods[FIRST_INDEX],
72
70
  handler: () => ({
73
71
  extensions: ["1", "2", "3"],
74
72
  }),
75
73
  })
76
74
 
77
75
  registerEndpoint(upload_file_schema.$id, {
78
- method: upload_file_schema.methods[1],
76
+ method: upload_file_schema.methods[SECOND_INDEX],
79
77
  handler: () => ({}),
80
78
  })
81
79
 
@@ -93,13 +91,15 @@ describe("FileSelector", async () => {
93
91
  })
94
92
 
95
93
  await flushPromises()
96
- expect(wrapper.componentVM.props.files).toEqual(files)
94
+ expect(wrapper.componentVM.files).toEqual(files)
97
95
  expect(wrapper.emitted()).toHaveProperty("update_values")
98
- expect(wrapper.emitted().update_values).toHaveLength(1)
99
- expect(wrapper.emitted().update_values[0][0]).toEqual({
100
- files,
101
- auto_upload: false,
102
- })
96
+ expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH)
97
+ expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toEqual(
98
+ {
99
+ files,
100
+ auto_upload: false,
101
+ },
102
+ )
103
103
  })
104
104
 
105
105
  test("auto_upload false", async () => {
@@ -117,7 +117,7 @@ describe("FileSelector", async () => {
117
117
  await flushPromises()
118
118
 
119
119
  const file_uploader = wrapper.findComponent(FileUploader)
120
- expect(wrapper.vm.props.files).toEqual(files)
120
+ expect(wrapper.vm.files).toEqual(files)
121
121
  const upload_files = vi.spyOn(file_uploader.vm, "upload_files")
122
122
  expect(upload_files).not.toHaveBeenCalled()
123
123
  })
@@ -1,34 +1,31 @@
1
- import { describe, expect, test, vi } from "vitest"
2
- import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
3
- import { flushPromises } from "@vue/test-utils"
1
+ // Third party imports
4
2
  import * as components from "vuetify/components"
5
- import { setActivePinia } from "pinia"
6
- import { createTestingPinia } from "@pinia/testing"
7
-
3
+ import { describe, expect, test } from "vitest"
4
+ import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
5
+ import { flushPromises } from "@vue/test-utils"
8
6
  import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
9
7
 
8
+ // Local imports
9
+ import { setupActivePinia, vuetify } from "../../utils"
10
10
  import FileUploader from "@ogw_front/components/FileUploader"
11
11
  import { useGeodeStore } from "@ogw_front/stores/geode"
12
12
 
13
- import { vuetify } from "../../utils"
13
+ const FIRST_INDEX = 0
14
+ const SECOND_INDEX = 1
14
15
 
15
16
  const upload_file_schema = schemas.opengeodeweb_back.upload_file
16
17
 
17
- describe("FileUploader", async () => {
18
- const pinia = createTestingPinia({
19
- stubActions: false,
20
- createSpy: vi.fn,
21
- })
22
- setActivePinia(pinia)
18
+ describe(FileUploader, async () => {
19
+ const pinia = setupActivePinia()
23
20
  const geodeStore = useGeodeStore()
24
21
  geodeStore.base_url = ""
25
22
 
26
23
  registerEndpoint(upload_file_schema.$id, {
27
- method: upload_file_schema.methods[0],
24
+ method: upload_file_schema.methods[FIRST_INDEX],
28
25
  handler: () => ({}),
29
26
  })
30
27
  registerEndpoint(upload_file_schema.$id, {
31
- method: upload_file_schema.methods[1],
28
+ method: upload_file_schema.methods[SECOND_INDEX],
32
29
  handler: () => ({}),
33
30
  })
34
31
 
@@ -54,7 +51,9 @@ describe("FileUploader", async () => {
54
51
  await v_btn.trigger("click")
55
52
  await flushPromises()
56
53
  await flushPromises()
57
- expect(wrapper.emitted().files_uploaded[0][0]).toEqual(files)
54
+ expect(
55
+ wrapper.emitted().files_uploaded[FIRST_INDEX][FIRST_INDEX],
56
+ ).toEqual(files)
58
57
  })
59
58
 
60
59
  test(`prop auto_upload true`, async () => {
@@ -65,7 +64,9 @@ describe("FileUploader", async () => {
65
64
  props: { multiple: false, accept: "*.txt", files, auto_upload: true },
66
65
  })
67
66
  await flushPromises()
68
- expect(wrapper.emitted().files_uploaded[0][0]).toEqual(files)
67
+ expect(
68
+ wrapper.emitted().files_uploaded[FIRST_INDEX][FIRST_INDEX],
69
+ ).toEqual(files)
69
70
  })
70
71
  })
71
72
  })
@@ -1,28 +1,21 @@
1
+ // Third party imports
2
+ import * as components from "vuetify/components"
1
3
  import { describe, expect, test, vi } from "vitest"
2
- import { mountSuspended } from "@nuxt/test-utils/runtime"
3
4
  import { flushPromises } from "@vue/test-utils"
4
- import * as components from "vuetify/components"
5
- import { setActivePinia } from "pinia"
6
- import { createTestingPinia } from "@pinia/testing"
5
+ import { mountSuspended } from "@nuxt/test-utils/runtime"
7
6
 
8
- import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
7
+ // Local imports
8
+ import { setupActivePinia, vuetify } from "../../../utils"
9
9
  import InspectorInspectionButton from "@ogw_front/components/Inspector/InspectionButton"
10
10
  import { useGeodeStore } from "@ogw_front/stores/geode"
11
- import { vuetify } from "../../../utils"
12
-
13
- const schema = schemas.opengeodeweb_back.inspect_file
14
11
 
15
12
  describe("Inspector/InspectionButton", async () => {
16
- const pinia = createTestingPinia({
17
- stubActions: false,
18
- createSpy: vi.fn,
19
- })
20
- setActivePinia(pinia)
13
+ const pinia = setupActivePinia()
21
14
  const geodeStore = useGeodeStore()
22
15
  geodeStore.base_url = ""
23
16
 
24
17
  test(`Test with issues`, async () => {
25
- var inspection_result = {
18
+ const inspection_result = {
26
19
  title: "Brep inspection",
27
20
  nb_issues: 3,
28
21
  children: [
@@ -39,7 +32,7 @@ describe("Inspector/InspectionButton", async () => {
39
32
  ],
40
33
  }
41
34
 
42
- geodeStore.request = vi.fn((schema, params, callbacks) => {
35
+ geodeStore.request = vi.fn((_schema, params, callbacks) => {
43
36
  if (callbacks?.response_function) {
44
37
  callbacks.response_function({
45
38
  inspection_result,
@@ -60,7 +53,7 @@ describe("Inspector/InspectionButton", async () => {
60
53
  props: { geode_object_type, filename },
61
54
  })
62
55
 
63
- expect(wrapper.exists()).toBe(true)
56
+ expect(wrapper.exists()).toBeTruthy()
64
57
  const v_btn = await wrapper.findComponent(components.VBtn)
65
58
  await v_btn.trigger("click")
66
59
  await flushPromises()
@@ -1,6 +1,8 @@
1
+ // Third party imports
1
2
  import { describe, expect, test } from "vitest"
2
3
  import { mountSuspended } from "@nuxt/test-utils/runtime"
3
4
 
5
+ // Local imports
4
6
  import InspectorResultPanel from "@ogw_front/components/Inspector/ResultPanel"
5
7
  import { vuetify } from "../../../utils"
6
8
 
@@ -21,16 +23,16 @@ describe("Inspector/ResultPanel", async () => {
21
23
  props: { inspection_result },
22
24
  })
23
25
 
24
- expect(wrapper.exists()).toBe(true)
25
- expect(wrapper.componentVM.props.inspection_result).toStrictEqual(
26
+ expect(wrapper.exists()).toBeTruthy()
27
+ expect(wrapper.componentVM.inspection_result).toStrictEqual(
26
28
  inspection_result,
27
29
  )
28
30
 
29
31
  const child_result_panel_wrapper =
30
32
  await wrapper.findComponent(InspectorResultPanel)
31
- expect(child_result_panel_wrapper.exists()).toBe(true)
33
+ expect(child_result_panel_wrapper.exists()).toBeTruthy()
32
34
  expect(
33
- child_result_panel_wrapper.componentVM.props.inspection_result,
35
+ child_result_panel_wrapper.componentVM.inspection_result,
34
36
  ).toStrictEqual(inspection_result[0].children)
35
37
  })
36
38
 
@@ -48,11 +50,11 @@ describe("Inspector/ResultPanel", async () => {
48
50
  props: { inspection_result },
49
51
  })
50
52
 
51
- expect(wrapper.exists()).toBe(true)
53
+ expect(wrapper.exists()).toBeTruthy()
52
54
 
53
55
  console.log({ wrapper })
54
56
 
55
- expect(wrapper.componentVM.props.inspection_result).toStrictEqual(
57
+ expect(wrapper.componentVM.inspection_result).toStrictEqual(
56
58
  inspection_result,
57
59
  )
58
60
  })
@@ -1,18 +1,17 @@
1
1
  import { describe, expect, test, vi } from "vitest"
2
- import { flushPromises } from "@vue/test-utils"
3
- import { mountSuspended } from "@nuxt/test-utils/runtime"
4
- import { setActivePinia } from "pinia"
5
- import { createTestingPinia } from "@pinia/testing"
6
2
 
7
3
  import Launcher from "@ogw_front/components/Launcher"
4
+ import ResizeObserver from "resize-observer-polyfill"
5
+ import { flushPromises } from "@vue/test-utils"
6
+ import { mountSuspended } from "@nuxt/test-utils/runtime"
8
7
 
9
8
  import { useInfraStore } from "@ogw_front/stores/infra"
10
- import { vuetify } from "../../utils"
9
+ import { setupActivePinia, vuetify } from "../../utils"
11
10
 
12
11
  // Mock navigator.locks API
13
- const mockLockRequest = vi.fn().mockImplementation(async (name, callback) => {
14
- return callback({ name })
15
- })
12
+ const mockLockRequest = vi
13
+ .fn()
14
+ .mockImplementation(async (name, task) => await task({ name }))
16
15
 
17
16
  vi.stubGlobal("navigator", {
18
17
  ...navigator,
@@ -21,22 +20,18 @@ vi.stubGlobal("navigator", {
21
20
  },
22
21
  })
23
22
 
24
- global.ResizeObserver = require("resize-observer-polyfill")
23
+ globalThis.ResizeObserver = ResizeObserver
25
24
 
26
- describe("Launcher", async () => {
25
+ describe(Launcher, async () => {
27
26
  test(`Mount`, async () => {
28
- const pinia = createTestingPinia({
29
- stubActions: false,
30
- createSpy: vi.fn,
31
- })
32
- setActivePinia(pinia)
27
+ const pinia = setupActivePinia()
33
28
  const infraStore = useInfraStore()
34
29
  const wrapper = await mountSuspended(Launcher, {
35
30
  global: {
36
- plugins: [pinia, vuetify],
31
+ plugins: [vuetify, pinia],
37
32
  },
38
33
  })
39
- expect(wrapper.exists()).toBe(true)
34
+ expect(wrapper.exists()).toBeTruthy()
40
35
  await infraStore.$patch({ is_captcha_validated: true })
41
36
  await flushPromises()
42
37
  expect(infraStore.create_backend).toHaveBeenCalled()
@@ -1,27 +1,24 @@
1
+ // Third party imports
2
+ import * as components from "vuetify/components"
1
3
  import { describe, expect, test, vi } from "vitest"
2
- import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
4
+ import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
3
5
  import { flushPromises } from "@vue/test-utils"
4
- import * as components from "vuetify/components"
5
- import { setActivePinia } from "pinia"
6
- import { createTestingPinia } from "@pinia/testing"
7
-
8
6
  import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
9
7
 
10
- import MissingFilesSelector from "@ogw_front/components/MissingFilesSelector"
8
+ // Local imports
9
+ import { setupActivePinia, vuetify } from "../../utils"
11
10
  import FileUploader from "@ogw_front/components/FileUploader"
11
+ import MissingFilesSelector from "@ogw_front/components/MissingFilesSelector"
12
12
  import { useGeodeStore } from "@ogw_front/stores/geode"
13
13
 
14
- import { vuetify } from "../../utils"
14
+ const EXPECTED_LENGTH = 1
15
+ const FIRST_INDEX = 0
16
+ const SECOND_INDEX = 1
15
17
 
16
- const missing_files_schema = schemas.opengeodeweb_back.missing_files
17
18
  const upload_file_schema = schemas.opengeodeweb_back.upload_file
18
19
 
19
- describe("MissingFilesSelector", async () => {
20
- const pinia = createTestingPinia({
21
- stubActions: false,
22
- createSpy: vi.fn,
23
- })
24
- setActivePinia(pinia)
20
+ describe(MissingFilesSelector, () => {
21
+ const pinia = setupActivePinia()
25
22
  const geodeStore = useGeodeStore()
26
23
  geodeStore.base_url = ""
27
24
 
@@ -53,7 +50,7 @@ describe("MissingFilesSelector", async () => {
53
50
  })
54
51
 
55
52
  const file_uploader = wrapper.findComponent(FileUploader)
56
- expect(file_uploader.exists()).toBe(true)
53
+ expect(file_uploader.exists()).toBeTruthy()
57
54
 
58
55
  const v_file_input = file_uploader.find('input[type="file"]')
59
56
  const files = [new File(["fake_file"], "fake_file.txt")]
@@ -65,17 +62,17 @@ describe("MissingFilesSelector", async () => {
65
62
  const v_btn = file_uploader.findComponent(components.VBtn)
66
63
 
67
64
  registerEndpoint(upload_file_schema.$id, {
68
- method: upload_file_schema.methods[1],
65
+ method: upload_file_schema.methods[SECOND_INDEX],
69
66
  handler: () => ({}),
70
67
  })
71
68
  await v_btn.trigger("click")
72
69
  await flushPromises()
73
70
  await flushPromises()
74
71
  expect(wrapper.emitted()).toHaveProperty("update_values")
75
- expect(wrapper.emitted().update_values).toHaveLength(1)
76
- expect(wrapper.emitted().update_values[0][0]).toEqual({
72
+ expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH)
73
+ expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toEqual({
77
74
  additional_files: files,
78
75
  })
79
- expect(wrapper.emitted().increment_step).toHaveLength(1)
76
+ expect(wrapper.emitted().increment_step).toHaveLength(EXPECTED_LENGTH)
80
77
  })
81
78
  })