@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.
- package/.eslintrc.cjs +1 -0
- package/app/assets/geode_objects.js +1 -3
- package/app/components/Carousel.vue +7 -4
- package/app/components/CrsSelector.vue +5 -6
- package/app/components/DragAndDrop.vue +18 -8
- package/app/components/ExtensionSelector.vue +9 -17
- package/app/components/FeedBack/ErrorBanner.vue +1 -1
- package/app/components/FeedBack/Snackers.vue +4 -1
- package/app/components/FileSelector.vue +21 -10
- package/app/components/FileUploader.vue +15 -32
- package/app/components/HybridRenderingView.vue +5 -3
- package/app/components/Inspector/InspectionButton.vue +2 -2
- package/app/components/Inspector/ResultPanel.vue +4 -4
- package/app/components/Launcher.vue +1 -1
- package/app/components/Loading.vue +6 -6
- package/app/components/MissingFilesSelector.vue +23 -29
- package/app/components/ObjectSelector.vue +11 -10
- package/app/components/OptionCard.vue +1 -1
- package/app/components/PackagesVersions.vue +5 -3
- package/app/components/Recaptcha.vue +6 -4
- package/app/components/RemoteRenderingView.vue +4 -3
- package/app/components/Screenshot.vue +4 -4
- package/app/components/Step.vue +7 -7
- package/app/components/VeaseViewToolbar.vue +3 -3
- package/app/components/Viewer/BreadCrumb.vue +2 -4
- package/app/components/Viewer/ContextMenu.vue +77 -45
- package/app/components/Viewer/ContextMenuItem.vue +42 -33
- package/app/components/Viewer/EdgedCurve/PointsOptions.vue +3 -3
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +6 -6
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +6 -7
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
- package/app/components/Viewer/Grid/2D/CellsOptions.vue +3 -3
- package/app/components/Viewer/Grid/2D/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Grid/2D/PointsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/CellsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/FacetsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/PointsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/EdgesOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PointsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +3 -3
- package/app/components/Viewer/Options/CellAttributeSelector.vue +23 -20
- package/app/components/Viewer/Options/ColorMapList.vue +75 -50
- package/app/components/Viewer/Options/ColorMapPicker.vue +38 -32
- package/app/components/Viewer/Options/ColorPicker.vue +3 -3
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +29 -21
- package/app/components/Viewer/Options/EdgeAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/PolygonAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/TextureItem.vue +5 -5
- package/app/components/Viewer/Options/TexturesSelector.vue +5 -5
- package/app/components/Viewer/Options/VertexAttributeSelector.vue +7 -7
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +5 -5
- package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +3 -3
- package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +3 -3
- package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +6 -6
- package/app/components/Viewer/Solid/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Solid/PointsOptions.vue +3 -3
- package/app/components/Viewer/Solid/PolygonsOptions.vue +3 -3
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +6 -6
- package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +3 -3
- package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +3 -3
- package/app/components/Viewer/Tree/ObjectTree.vue +7 -9
- package/app/components/Viewer/TreeComponent.vue +9 -13
- package/app/components/Viewer/TreeObject.vue +8 -9
- package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +3 -3
- package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +3 -3
- package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +3 -3
- package/app/components/Wrapper.vue +1 -2
- package/app/components/ZScaling.vue +1 -1
- package/app/composables/project_manager.js +6 -6
- package/app/plugins/auto_store_register.js +1 -1
- package/app/stores/app.js +45 -41
- package/app/stores/data.js +52 -51
- package/app/stores/data_style.js +12 -11
- package/app/stores/feedback.js +5 -1
- package/app/stores/geode.js +16 -13
- package/app/stores/hybrid_viewer.js +72 -44
- package/app/stores/infra.js +18 -16
- package/app/stores/lambda.js +1 -9
- package/app/stores/menu.js +13 -13
- package/app/stores/treeview.js +15 -13
- package/app/stores/viewer.js +39 -33
- package/app/utils/app_mode.js +4 -3
- package/app/utils/default_styles.js +55 -47
- package/app/utils/file_import_workflow.js +4 -17
- package/app/utils/local.js +195 -184
- package/app/utils/upload_file.js +1 -2
- package/eslint.config.js +2 -2
- package/internal/database/database.js +17 -32
- package/internal/database/extended_database.js +25 -0
- package/internal/stores/data_style/mesh/cells/cell.js +3 -3
- package/internal/stores/data_style/mesh/cells/color.js +1 -1
- package/internal/stores/data_style/mesh/cells/index.js +7 -7
- package/internal/stores/data_style/mesh/cells/textures.js +1 -1
- package/internal/stores/data_style/mesh/cells/vertex.js +3 -3
- package/internal/stores/data_style/mesh/cells/visibility.js +1 -1
- package/internal/stores/data_style/mesh/edges/color.js +1 -1
- package/internal/stores/data_style/mesh/edges/edge.js +22 -22
- package/internal/stores/data_style/mesh/edges/index.js +7 -7
- package/internal/stores/data_style/mesh/edges/vertex.js +3 -3
- package/internal/stores/data_style/mesh/edges/visibility.js +1 -1
- package/internal/stores/data_style/mesh/edges/width.js +1 -1
- package/internal/stores/data_style/mesh/index.js +4 -5
- package/internal/stores/data_style/mesh/points/color.js +1 -1
- package/internal/stores/data_style/mesh/points/index.js +6 -6
- package/internal/stores/data_style/mesh/points/size.js +1 -1
- package/internal/stores/data_style/mesh/points/vertex.js +3 -3
- package/internal/stores/data_style/mesh/points/visibility.js +1 -1
- package/internal/stores/data_style/mesh/polygons/color.js +1 -1
- package/internal/stores/data_style/mesh/polygons/index.js +7 -7
- package/internal/stores/data_style/mesh/polygons/polygon.js +3 -3
- package/internal/stores/data_style/mesh/polygons/textures.js +1 -1
- package/internal/stores/data_style/mesh/polygons/vertex.js +3 -3
- package/internal/stores/data_style/mesh/polygons/visibility.js +1 -1
- package/internal/stores/data_style/mesh/polyhedra/color.js +1 -1
- package/internal/stores/data_style/mesh/polyhedra/index.js +6 -6
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +3 -3
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +3 -3
- package/internal/stores/data_style/mesh/polyhedra/visibility.js +1 -1
- package/internal/stores/data_style/model/edges.js +1 -1
- package/internal/stores/data_style/model/index.js +32 -22
- package/internal/utils/api_fetch.js +8 -5
- package/internal/utils/viewer_call.js +42 -46
- package/nuxt.config.js +3 -3
- package/package.json +1 -1
- package/scripts/generate_geode_objects.js +8 -7
- package/tests/integration/setup.js +28 -21
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +17 -10
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -6
- package/tests/integration/stores/viewer.nuxt.test.js +55 -39
- package/tests/setup_indexeddb.js +1 -0
- package/tests/unit/components/CrsSelector.nuxt.test.js +18 -19
- package/tests/unit/components/ExtensionSelector.nuxt.test.js +24 -19
- package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -36
- package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +20 -25
- package/tests/unit/components/FileSelector.nuxt.test.js +27 -27
- package/tests/unit/components/FileUploader.nuxt.test.js +18 -17
- package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +9 -16
- package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +8 -6
- package/tests/unit/components/Launcher.nuxt.test.js +12 -17
- package/tests/unit/components/MissingFilesSelector.nuxt.test.js +16 -19
- package/tests/unit/components/ObjectSelector.nuxt.test.js +30 -34
- package/tests/unit/components/PackagesVersions.nuxt.test.js +8 -11
- package/tests/unit/components/Step.nuxt.test.js +8 -7
- package/tests/unit/components/Stepper.nuxt.test.js +14 -12
- package/tests/unit/composables/ProjectManager.nuxt.test.js +142 -100
- package/tests/unit/composables/api_fetch.nuxt.test.js +12 -39
- package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -61
- package/tests/unit/composables/upload_file.nuxt.test.js +21 -25
- package/tests/unit/plugins/project_load.nuxt.test.js +22 -21
- package/tests/unit/stores/App.nuxt.test.js +45 -43
- package/tests/unit/stores/Feedback.nuxt.test.js +16 -18
- package/tests/unit/stores/Geode.nuxt.test.js +135 -137
- package/tests/unit/stores/Infra.nuxt.test.js +20 -26
- package/tests/unit/stores/Lambda.nuxt.test.js +30 -31
- package/tests/unit/stores/Treeview.nuxt.test.js +53 -55
- package/tests/unit/stores/Viewer.nuxt.test.js +16 -23
- package/tests/unit/utils/validate_schema.nuxt.test.js +18 -18
- package/tests/utils.js +15 -2
- package/tests/vitest.config.js +6 -2
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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[
|
|
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()).
|
|
58
|
+
expect(wrapper.exists()).toBeTruthy()
|
|
56
59
|
const v_card = await wrapper.findAllComponents(components.VCard)
|
|
57
|
-
await v_card[
|
|
60
|
+
await v_card[SECOND_INDEX].trigger("click")
|
|
58
61
|
expect(wrapper.emitted()).toHaveProperty("update_values")
|
|
59
|
-
expect(wrapper.emitted().update_values).toHaveLength(
|
|
60
|
-
expect(
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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: [
|
|
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).
|
|
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(
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
//
|
|
2
|
-
|
|
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
|
-
|
|
11
|
+
vi.stubGlobal("visualViewport", new EventTarget())
|
|
12
|
+
|
|
13
|
+
describe(FeedBackSnackers, async () => {
|
|
14
14
|
test(`Test delete error`, async () => {
|
|
15
|
-
const pinia =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
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: [
|
|
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 {
|
|
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
|
-
|
|
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(
|
|
20
|
-
const pinia =
|
|
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[
|
|
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[
|
|
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(
|
|
63
|
-
expect(wrapper.emitted().update_values[
|
|
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(
|
|
67
|
+
describe(FileSelector, () => {
|
|
70
68
|
registerEndpoint(allowed_files_schema.$id, {
|
|
71
|
-
method: allowed_files_schema.methods[
|
|
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[
|
|
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.
|
|
94
|
+
expect(wrapper.componentVM.files).toEqual(files)
|
|
97
95
|
expect(wrapper.emitted()).toHaveProperty("update_values")
|
|
98
|
-
expect(wrapper.emitted().update_values).toHaveLength(
|
|
99
|
-
expect(wrapper.emitted().update_values[
|
|
100
|
-
|
|
101
|
-
|
|
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.
|
|
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
|
-
|
|
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 {
|
|
6
|
-
import {
|
|
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
|
-
|
|
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(
|
|
18
|
-
const pinia =
|
|
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[
|
|
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[
|
|
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(
|
|
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(
|
|
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
|
|
5
|
-
import { setActivePinia } from "pinia"
|
|
6
|
-
import { createTestingPinia } from "@pinia/testing"
|
|
5
|
+
import { mountSuspended } from "@nuxt/test-utils/runtime"
|
|
7
6
|
|
|
8
|
-
|
|
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 =
|
|
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
|
-
|
|
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((
|
|
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()).
|
|
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()).
|
|
25
|
-
expect(wrapper.componentVM.
|
|
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()).
|
|
33
|
+
expect(child_result_panel_wrapper.exists()).toBeTruthy()
|
|
32
34
|
expect(
|
|
33
|
-
child_result_panel_wrapper.componentVM.
|
|
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()).
|
|
53
|
+
expect(wrapper.exists()).toBeTruthy()
|
|
52
54
|
|
|
53
55
|
console.log({ wrapper })
|
|
54
56
|
|
|
55
|
-
expect(wrapper.componentVM.
|
|
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
|
|
14
|
-
|
|
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
|
-
|
|
23
|
+
globalThis.ResizeObserver = ResizeObserver
|
|
25
24
|
|
|
26
|
-
describe(
|
|
25
|
+
describe(Launcher, async () => {
|
|
27
26
|
test(`Mount`, async () => {
|
|
28
|
-
const pinia =
|
|
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: [
|
|
31
|
+
plugins: [vuetify, pinia],
|
|
37
32
|
},
|
|
38
33
|
})
|
|
39
|
-
expect(wrapper.exists()).
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
20
|
-
const pinia =
|
|
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()).
|
|
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[
|
|
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(
|
|
76
|
-
expect(wrapper.emitted().update_values[
|
|
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(
|
|
76
|
+
expect(wrapper.emitted().increment_step).toHaveLength(EXPECTED_LENGTH)
|
|
80
77
|
})
|
|
81
78
|
})
|