@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,164 +1,162 @@
|
|
|
1
|
-
|
|
2
|
-
import { createTestingPinia } from "@pinia/testing"
|
|
3
|
-
import { describe, test, expect, expectTypeOf, beforeEach, vi } from "vitest"
|
|
4
|
-
import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
1
|
+
// Third party imports
|
|
5
2
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
6
|
-
import
|
|
3
|
+
import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
4
|
+
import { describe, expect, expectTypeOf, test, vi } from "vitest"
|
|
5
|
+
|
|
6
|
+
// Local imports
|
|
7
7
|
import { appMode } from "@ogw_front/utils/app_mode"
|
|
8
|
-
import {
|
|
8
|
+
import { setupActivePinia } from "../../utils"
|
|
9
|
+
import Status from "@ogw_front/utils/status"
|
|
9
10
|
import { useGeodeStore } from "@ogw_front/stores/geode"
|
|
11
|
+
import { useInfraStore } from "@ogw_front/stores/infra"
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
// CONSTANTS
|
|
14
|
+
const PORT_443 = "443"
|
|
15
|
+
const PORT_12 = "12"
|
|
16
|
+
const PORT_5000 = "5000"
|
|
17
|
+
const CLOUD_ID = "123456"
|
|
18
|
+
const STATUS_500 = 500
|
|
19
|
+
const EXPECTED_ONE_REQUEST = 1
|
|
20
|
+
const EXPECTED_NO_REQUEST = 0
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
setupActivePinia()
|
|
17
24
|
})
|
|
18
25
|
|
|
19
|
-
describe("
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
describe("geode store", () => {
|
|
27
|
+
test("state", () => {
|
|
28
|
+
const geodeStore = useGeodeStore()
|
|
29
|
+
expectTypeOf(geodeStore.default_local_port).toBeString()
|
|
30
|
+
expectTypeOf(geodeStore.request_counter).toBeNumber()
|
|
31
|
+
expectTypeOf(geodeStore.status).toBeString()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe("protocol", () => {
|
|
35
|
+
test("app_mode CLOUD", () => {
|
|
36
|
+
const infraStore = useInfraStore()
|
|
37
|
+
const geodeStore = useGeodeStore()
|
|
38
|
+
infraStore.app_mode = appMode.CLOUD
|
|
39
|
+
expect(geodeStore.protocol).toBe("https")
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
test("app_mode BROWSER/DESKTOP", () => {
|
|
43
|
+
const infraStore = useInfraStore()
|
|
22
44
|
const geodeStore = useGeodeStore()
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
infraStore.app_mode = appMode.BROWSER
|
|
46
|
+
expect(geodeStore.protocol).toBe("http")
|
|
47
|
+
infraStore.app_mode = appMode.DESKTOP
|
|
48
|
+
expect(geodeStore.protocol).toBe("http")
|
|
26
49
|
})
|
|
27
50
|
})
|
|
28
51
|
|
|
29
|
-
describe("
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
expect(geodeStore.protocol).toBe("https")
|
|
36
|
-
})
|
|
37
|
-
test("test app_mode BROWSER", () => {
|
|
38
|
-
const infraStore = useInfraStore()
|
|
39
|
-
const geodeStore = useGeodeStore()
|
|
40
|
-
infraStore.app_mode = appMode.BROWSER
|
|
41
|
-
expect(geodeStore.protocol).toBe("http")
|
|
42
|
-
})
|
|
43
|
-
test("test app_mode DESKTOP", () => {
|
|
44
|
-
const infraStore = useInfraStore()
|
|
45
|
-
const geodeStore = useGeodeStore()
|
|
46
|
-
infraStore.app_mode = appMode.DESKTOP
|
|
47
|
-
expect(geodeStore.protocol).toBe("http")
|
|
48
|
-
})
|
|
52
|
+
describe("port", () => {
|
|
53
|
+
test("app_mode CLOUD", () => {
|
|
54
|
+
const infraStore = useInfraStore()
|
|
55
|
+
const geodeStore = useGeodeStore()
|
|
56
|
+
infraStore.app_mode = appMode.CLOUD
|
|
57
|
+
expect(geodeStore.port).toBe(PORT_443)
|
|
49
58
|
})
|
|
50
59
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const infraStore = useInfraStore()
|
|
60
|
-
const geodeStore = useGeodeStore()
|
|
61
|
-
infraStore.app_mode = appMode.BROWSER
|
|
62
|
-
expect(geodeStore.port).toBe(geodeStore.default_local_port)
|
|
63
|
-
})
|
|
64
|
-
test("test app_mode DESKTOP", () => {
|
|
65
|
-
const infraStore = useInfraStore()
|
|
66
|
-
const geodeStore = useGeodeStore()
|
|
67
|
-
infraStore.app_mode = appMode.DESKTOP
|
|
68
|
-
expect(geodeStore.port).toBe(geodeStore.default_local_port)
|
|
69
|
-
})
|
|
60
|
+
test("app_mode BROWSER/DESKTOP", () => {
|
|
61
|
+
const infraStore = useInfraStore()
|
|
62
|
+
const geodeStore = useGeodeStore()
|
|
63
|
+
infraStore.app_mode = appMode.BROWSER
|
|
64
|
+
expect(geodeStore.port).toBe(geodeStore.default_local_port)
|
|
65
|
+
infraStore.app_mode = appMode.DESKTOP
|
|
66
|
+
expect(geodeStore.port).toBe(geodeStore.default_local_port)
|
|
67
|
+
})
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
})
|
|
69
|
+
test("override default_local_port", () => {
|
|
70
|
+
const infraStore = useInfraStore()
|
|
71
|
+
const geodeStore = useGeodeStore()
|
|
72
|
+
infraStore.app_mode = appMode.DESKTOP
|
|
73
|
+
geodeStore.default_local_port = PORT_12
|
|
74
|
+
expect(geodeStore.port).toBe(PORT_12)
|
|
78
75
|
})
|
|
76
|
+
})
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})
|
|
88
|
-
test("test app_mode CLOUD", () => {
|
|
89
|
-
const infraStore = useInfraStore()
|
|
90
|
-
const geodeStore = useGeodeStore()
|
|
91
|
-
infraStore.app_mode = appMode.CLOUD
|
|
92
|
-
infraStore.ID = "123456"
|
|
93
|
-
infraStore.domain_name = "example.com"
|
|
94
|
-
expect(geodeStore.base_url).toBe("https://example.com:443/123456/geode")
|
|
95
|
-
})
|
|
96
|
-
test("test app_mode CLOUD, ID empty", () => {
|
|
97
|
-
const infraStore = useInfraStore()
|
|
98
|
-
const geodeStore = useGeodeStore()
|
|
99
|
-
infraStore.app_mode = appMode.CLOUD
|
|
100
|
-
infraStore.ID = ""
|
|
101
|
-
infraStore.domain_name = "example.com"
|
|
102
|
-
expect(() => geodeStore.base_url).toThrowError(
|
|
103
|
-
"ID must not be empty in cloud mode",
|
|
104
|
-
)
|
|
105
|
-
})
|
|
78
|
+
describe("base_url", () => {
|
|
79
|
+
test("app_mode BROWSER", () => {
|
|
80
|
+
const infraStore = useInfraStore()
|
|
81
|
+
const geodeStore = useGeodeStore()
|
|
82
|
+
infraStore.app_mode = appMode.BROWSER
|
|
83
|
+
infraStore.domain_name = "localhost"
|
|
84
|
+
expect(geodeStore.base_url).toBe(`http://localhost:${PORT_5000}`)
|
|
106
85
|
})
|
|
107
86
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
87
|
+
test("app_mode CLOUD", () => {
|
|
88
|
+
const infraStore = useInfraStore()
|
|
89
|
+
const geodeStore = useGeodeStore()
|
|
90
|
+
infraStore.app_mode = appMode.CLOUD
|
|
91
|
+
infraStore.ID = CLOUD_ID
|
|
92
|
+
infraStore.domain_name = "example.com"
|
|
93
|
+
expect(geodeStore.base_url).toBe(
|
|
94
|
+
`https://example.com:${PORT_443}/${CLOUD_ID}/geode`,
|
|
95
|
+
)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
test("app_mode CLOUD, ID empty", () => {
|
|
99
|
+
const infraStore = useInfraStore()
|
|
100
|
+
const geodeStore = useGeodeStore()
|
|
101
|
+
infraStore.app_mode = appMode.CLOUD
|
|
102
|
+
infraStore.ID = ""
|
|
103
|
+
infraStore.domain_name = "example.com"
|
|
104
|
+
expect(() => geodeStore.base_url).toThrow(
|
|
105
|
+
"ID must not be empty in cloud mode",
|
|
106
|
+
)
|
|
119
107
|
})
|
|
120
108
|
})
|
|
121
109
|
|
|
122
|
-
describe("
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
test("response", async () => {
|
|
128
|
-
const geodeStore = useGeodeStore()
|
|
129
|
-
geodeStore.base_url = ""
|
|
130
|
-
getFakeCall.mockImplementation(() => ({}))
|
|
131
|
-
await geodeStore.ping()
|
|
132
|
-
expect(geodeStore.status).toBe(Status.CONNECTED)
|
|
133
|
-
})
|
|
134
|
-
test("response_error", async () => {
|
|
135
|
-
const geodeStore = useGeodeStore()
|
|
136
|
-
geodeStore.base_url = ""
|
|
137
|
-
getFakeCall.mockImplementation(() => {
|
|
138
|
-
throw createError({
|
|
139
|
-
status: 500,
|
|
140
|
-
})
|
|
141
|
-
})
|
|
142
|
-
await expect(geodeStore.ping()).rejects.toThrow()
|
|
143
|
-
expect(geodeStore.status).toBe(Status.NOT_CONNECTED)
|
|
144
|
-
})
|
|
110
|
+
describe("is_busy", () => {
|
|
111
|
+
test("is_busy", () => {
|
|
112
|
+
const geodeStore = useGeodeStore()
|
|
113
|
+
geodeStore.request_counter = EXPECTED_ONE_REQUEST
|
|
114
|
+
expect(geodeStore.is_busy).toBeTruthy()
|
|
145
115
|
})
|
|
146
116
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
await geodeStore.start_request()
|
|
152
|
-
expect(geodeStore.request_counter).toBe(1)
|
|
153
|
-
})
|
|
117
|
+
test("not is_busy", () => {
|
|
118
|
+
const geodeStore = useGeodeStore()
|
|
119
|
+
geodeStore.request_counter = EXPECTED_NO_REQUEST
|
|
120
|
+
expect(geodeStore.is_busy).toBeFalsy()
|
|
154
121
|
})
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
describe("geode store actions", () => {
|
|
126
|
+
const getFakeCall = vi.fn()
|
|
127
|
+
|
|
128
|
+
beforeEach(() => {
|
|
129
|
+
registerEndpoint(back_schemas.opengeodeweb_back.ping.$id, getFakeCall)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
describe("ping", () => {
|
|
133
|
+
test("response", async () => {
|
|
134
|
+
const geodeStore = useGeodeStore()
|
|
135
|
+
geodeStore.base_url = ""
|
|
136
|
+
getFakeCall.mockImplementation(() => ({}))
|
|
137
|
+
await geodeStore.ping()
|
|
138
|
+
expect(geodeStore.status).toBe(Status.CONNECTED)
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
test("response_error", async () => {
|
|
142
|
+
const geodeStore = useGeodeStore()
|
|
143
|
+
geodeStore.base_url = ""
|
|
144
|
+
getFakeCall.mockImplementation(() => {
|
|
145
|
+
throw createError({ status: STATUS_500 })
|
|
161
146
|
})
|
|
147
|
+
await expect(geodeStore.ping()).rejects.toThrow("500")
|
|
148
|
+
expect(geodeStore.status).toBe(Status.NOT_CONNECTED)
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
describe("request counter", () => {
|
|
153
|
+
test("increment/decrement", async () => {
|
|
154
|
+
const geodeStore = useGeodeStore()
|
|
155
|
+
expect(geodeStore.request_counter).toBe(EXPECTED_NO_REQUEST)
|
|
156
|
+
await geodeStore.start_request()
|
|
157
|
+
expect(geodeStore.request_counter).toBe(EXPECTED_ONE_REQUEST)
|
|
158
|
+
await geodeStore.stop_request()
|
|
159
|
+
expect(geodeStore.request_counter).toBe(EXPECTED_NO_REQUEST)
|
|
162
160
|
})
|
|
163
161
|
})
|
|
164
162
|
})
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
// Global imports
|
|
2
|
-
|
|
3
1
|
// Third party imports
|
|
4
|
-
import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
5
|
-
import { setActivePinia } from "pinia"
|
|
6
|
-
import { createTestingPinia } from "@pinia/testing"
|
|
7
2
|
import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
|
|
3
|
+
import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
4
|
+
|
|
8
5
|
// Local imports
|
|
9
6
|
import Status from "@ogw_front/utils/status"
|
|
10
7
|
import { appMode } from "@ogw_front/utils/app_mode"
|
|
11
|
-
import {
|
|
8
|
+
import { setupActivePinia } from "../../utils"
|
|
12
9
|
import { useGeodeStore } from "@ogw_front/stores/geode"
|
|
13
|
-
import {
|
|
10
|
+
import { useInfraStore } from "@ogw_front/stores/infra"
|
|
14
11
|
import { useLambdaStore } from "@ogw_front/stores/lambda"
|
|
12
|
+
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
15
13
|
|
|
16
14
|
// Mock navigator.locks API
|
|
17
|
-
const mockLockRequest = vi
|
|
18
|
-
|
|
19
|
-
})
|
|
15
|
+
const mockLockRequest = vi
|
|
16
|
+
.fn()
|
|
17
|
+
.mockImplementation(async (name, handler) => await handler({ name }))
|
|
20
18
|
|
|
21
19
|
vi.stubGlobal("navigator", {
|
|
22
20
|
...navigator,
|
|
@@ -25,12 +23,8 @@ vi.stubGlobal("navigator", {
|
|
|
25
23
|
},
|
|
26
24
|
})
|
|
27
25
|
|
|
28
|
-
beforeEach(
|
|
29
|
-
|
|
30
|
-
stubActions: false,
|
|
31
|
-
createSpy: vi.fn,
|
|
32
|
-
})
|
|
33
|
-
setActivePinia(pinia)
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
setupActivePinia()
|
|
34
28
|
})
|
|
35
29
|
|
|
36
30
|
describe("Infra Store", () => {
|
|
@@ -71,7 +65,7 @@ describe("Infra Store", () => {
|
|
|
71
65
|
describe("microservices_connected", () => {
|
|
72
66
|
test("test no microservices registered", () => {
|
|
73
67
|
const infraStore = useInfraStore()
|
|
74
|
-
expect(infraStore.microservices_connected).
|
|
68
|
+
expect(infraStore.microservices_connected).toBeTruthy()
|
|
75
69
|
})
|
|
76
70
|
test("test geode false & viewer false", () => {
|
|
77
71
|
const infraStore = useInfraStore()
|
|
@@ -91,7 +85,7 @@ describe("Infra Store", () => {
|
|
|
91
85
|
|
|
92
86
|
geodeStore.$patch({ status: Status.NOT_CONNECTED })
|
|
93
87
|
viewerStore.$patch({ status: Status.NOT_CONNECTED })
|
|
94
|
-
expect(infraStore.microservices_connected).
|
|
88
|
+
expect(infraStore.microservices_connected).toBeFalsy()
|
|
95
89
|
})
|
|
96
90
|
test("test geode true & viewer false", () => {
|
|
97
91
|
const infraStore = useInfraStore()
|
|
@@ -111,7 +105,7 @@ describe("Infra Store", () => {
|
|
|
111
105
|
|
|
112
106
|
geodeStore.$patch({ status: Status.CONNECTED })
|
|
113
107
|
viewerStore.$patch({ status: Status.NOT_CONNECTED })
|
|
114
|
-
expect(infraStore.microservices_connected).
|
|
108
|
+
expect(infraStore.microservices_connected).toBeFalsy()
|
|
115
109
|
})
|
|
116
110
|
test("test geode false & viewer true", () => {
|
|
117
111
|
const infraStore = useInfraStore()
|
|
@@ -131,7 +125,7 @@ describe("Infra Store", () => {
|
|
|
131
125
|
|
|
132
126
|
geodeStore.$patch({ status: Status.NOT_CONNECTED })
|
|
133
127
|
viewerStore.$patch({ status: Status.CONNECTED })
|
|
134
|
-
expect(infraStore.microservices_connected).
|
|
128
|
+
expect(infraStore.microservices_connected).toBeFalsy()
|
|
135
129
|
})
|
|
136
130
|
test("test geode true & viewer true", () => {
|
|
137
131
|
const infraStore = useInfraStore()
|
|
@@ -151,14 +145,14 @@ describe("Infra Store", () => {
|
|
|
151
145
|
|
|
152
146
|
geodeStore.$patch({ status: Status.CONNECTED })
|
|
153
147
|
viewerStore.$patch({ status: Status.CONNECTED })
|
|
154
|
-
expect(infraStore.microservices_connected).
|
|
148
|
+
expect(infraStore.microservices_connected).toBeTruthy()
|
|
155
149
|
})
|
|
156
150
|
})
|
|
157
151
|
|
|
158
152
|
describe("microservices_busy", () => {
|
|
159
153
|
test("test no microservices registered", () => {
|
|
160
154
|
const infraStore = useInfraStore()
|
|
161
|
-
expect(infraStore.microservices_busy).
|
|
155
|
+
expect(infraStore.microservices_busy).toBeFalsy()
|
|
162
156
|
})
|
|
163
157
|
test("test geode false & viewer false", () => {
|
|
164
158
|
const infraStore = useInfraStore()
|
|
@@ -178,7 +172,7 @@ describe("Infra Store", () => {
|
|
|
178
172
|
|
|
179
173
|
geodeStore.$patch({ request_counter: 0 })
|
|
180
174
|
viewerStore.$patch({ request_counter: 0 })
|
|
181
|
-
expect(infraStore.microservices_busy).
|
|
175
|
+
expect(infraStore.microservices_busy).toBeFalsy()
|
|
182
176
|
})
|
|
183
177
|
test("test geode true & viewer false", () => {
|
|
184
178
|
const infraStore = useInfraStore()
|
|
@@ -198,7 +192,7 @@ describe("Infra Store", () => {
|
|
|
198
192
|
|
|
199
193
|
geodeStore.$patch({ request_counter: 1 })
|
|
200
194
|
viewerStore.$patch({ request_counter: 0 })
|
|
201
|
-
expect(infraStore.microservices_busy).
|
|
195
|
+
expect(infraStore.microservices_busy).toBeTruthy()
|
|
202
196
|
})
|
|
203
197
|
test("test geode false & viewer true", () => {
|
|
204
198
|
const infraStore = useInfraStore()
|
|
@@ -218,7 +212,7 @@ describe("Infra Store", () => {
|
|
|
218
212
|
|
|
219
213
|
geodeStore.$patch({ request_counter: 0 })
|
|
220
214
|
viewerStore.$patch({ request_counter: 1 })
|
|
221
|
-
expect(infraStore.microservices_busy).
|
|
215
|
+
expect(infraStore.microservices_busy).toBeTruthy()
|
|
222
216
|
})
|
|
223
217
|
test("test geode true & viewer true", () => {
|
|
224
218
|
const infraStore = useInfraStore()
|
|
@@ -238,7 +232,7 @@ describe("Infra Store", () => {
|
|
|
238
232
|
|
|
239
233
|
geodeStore.$patch({ request_counter: 1 })
|
|
240
234
|
viewerStore.$patch({ request_counter: 1 })
|
|
241
|
-
expect(infraStore.microservices_busy).
|
|
235
|
+
expect(infraStore.microservices_busy).toBeTruthy()
|
|
242
236
|
})
|
|
243
237
|
})
|
|
244
238
|
})
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
// Global imports
|
|
2
|
-
|
|
3
1
|
// Third party imports
|
|
4
|
-
import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
5
|
-
import { setActivePinia } from "pinia"
|
|
6
|
-
import { createTestingPinia } from "@pinia/testing"
|
|
7
2
|
import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
|
|
3
|
+
import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
8
4
|
|
|
5
|
+
// Local imports
|
|
6
|
+
import Status from "@ogw_front/utils/status"
|
|
7
|
+
import { setupActivePinia } from "../../utils"
|
|
9
8
|
import { useFeedbackStore } from "@ogw_front/stores/feedback"
|
|
10
9
|
import { useLambdaStore } from "@ogw_front/stores/lambda"
|
|
11
10
|
|
|
12
|
-
//
|
|
13
|
-
|
|
11
|
+
// CONSTANTS
|
|
12
|
+
const PORT_443 = "443"
|
|
13
|
+
const API_URL = "api.example.com"
|
|
14
|
+
const SITE_BRANCH = "/test"
|
|
15
|
+
const PROJECT = "/project"
|
|
16
|
+
const TEST_ID = "test-id-123456"
|
|
17
|
+
const STATUS_500 = 500
|
|
14
18
|
|
|
15
19
|
beforeEach(async () => {
|
|
16
|
-
|
|
17
|
-
stubActions: false,
|
|
18
|
-
createSpy: vi.fn,
|
|
19
|
-
})
|
|
20
|
-
setActivePinia(pinia)
|
|
20
|
+
setupActivePinia()
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
+
function setupConfig() {
|
|
24
|
+
const config = useRuntimeConfig()
|
|
25
|
+
config.public.API_URL = API_URL
|
|
26
|
+
config.public.SITE_BRANCH = SITE_BRANCH
|
|
27
|
+
config.public.PROJECT = PROJECT
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
describe("Lambda Store", () => {
|
|
24
31
|
describe("state", () => {
|
|
25
32
|
test("initial state", () => {
|
|
@@ -40,18 +47,16 @@ describe("Lambda Store", () => {
|
|
|
40
47
|
describe("port", () => {
|
|
41
48
|
test("test port is always 443", () => {
|
|
42
49
|
const lambdaStore = useLambdaStore()
|
|
43
|
-
expect(lambdaStore.port).toBe(
|
|
50
|
+
expect(lambdaStore.port).toBe(PORT_443)
|
|
44
51
|
})
|
|
45
52
|
})
|
|
46
53
|
|
|
47
54
|
describe("base_url", () => {
|
|
48
55
|
test("test base_url construction", () => {
|
|
56
|
+
setupConfig()
|
|
49
57
|
const lambdaStore = useLambdaStore()
|
|
50
|
-
useRuntimeConfig().public.API_URL = "api.example.com"
|
|
51
|
-
useRuntimeConfig().public.SITE_BRANCH = "/test"
|
|
52
|
-
useRuntimeConfig().public.PROJECT = "/project"
|
|
53
58
|
expect(lambdaStore.base_url).toBe(
|
|
54
|
-
|
|
59
|
+
`https://${API_URL}:${PORT_443}${SITE_BRANCH}${PROJECT}/createbackend`,
|
|
55
60
|
)
|
|
56
61
|
})
|
|
57
62
|
})
|
|
@@ -59,7 +64,7 @@ describe("Lambda Store", () => {
|
|
|
59
64
|
describe("is_busy", () => {
|
|
60
65
|
test("test is_busy is always false", () => {
|
|
61
66
|
const lambdaStore = useLambdaStore()
|
|
62
|
-
expect(lambdaStore.is_busy).
|
|
67
|
+
expect(lambdaStore.is_busy).toBeFalsy()
|
|
63
68
|
})
|
|
64
69
|
})
|
|
65
70
|
})
|
|
@@ -69,13 +74,10 @@ describe("Lambda Store", () => {
|
|
|
69
74
|
const postFakeCall = vi.fn()
|
|
70
75
|
|
|
71
76
|
test("successful launch", async () => {
|
|
77
|
+
setupConfig()
|
|
72
78
|
const lambdaStore = useLambdaStore()
|
|
73
79
|
const feedbackStore = useFeedbackStore()
|
|
74
80
|
|
|
75
|
-
useRuntimeConfig().public.API_URL = "api.example.com"
|
|
76
|
-
useRuntimeConfig().public.SITE_BRANCH = "/test"
|
|
77
|
-
useRuntimeConfig().public.PROJECT = "/project"
|
|
78
|
-
|
|
79
81
|
lambdaStore.base_url = "test-base-url"
|
|
80
82
|
registerEndpoint(lambdaStore.base_url, {
|
|
81
83
|
method: "POST",
|
|
@@ -83,24 +85,21 @@ describe("Lambda Store", () => {
|
|
|
83
85
|
})
|
|
84
86
|
|
|
85
87
|
postFakeCall.mockImplementation(() => ({
|
|
86
|
-
ID:
|
|
88
|
+
ID: TEST_ID,
|
|
87
89
|
}))
|
|
88
90
|
|
|
89
91
|
const id = await lambdaStore.launch()
|
|
90
92
|
|
|
91
93
|
expect(lambdaStore.status).toBe(Status.CONNECTED)
|
|
92
|
-
expect(id).toBe(
|
|
93
|
-
expect(feedbackStore.server_error).
|
|
94
|
+
expect(id).toBe(TEST_ID)
|
|
95
|
+
expect(feedbackStore.server_error).toBeFalsy()
|
|
94
96
|
})
|
|
95
97
|
|
|
96
98
|
test("failed launch - error response", async () => {
|
|
99
|
+
setupConfig()
|
|
97
100
|
const lambdaStore = useLambdaStore()
|
|
98
101
|
const feedbackStore = useFeedbackStore()
|
|
99
102
|
|
|
100
|
-
useRuntimeConfig().public.API_URL = "api.example.com"
|
|
101
|
-
useRuntimeConfig().public.SITE_BRANCH = "/test"
|
|
102
|
-
useRuntimeConfig().public.PROJECT = "/project"
|
|
103
|
-
|
|
104
103
|
registerEndpoint(lambdaStore.base_url, {
|
|
105
104
|
method: "POST",
|
|
106
105
|
handler: postFakeCall,
|
|
@@ -108,7 +107,7 @@ describe("Lambda Store", () => {
|
|
|
108
107
|
|
|
109
108
|
postFakeCall.mockImplementation(() => {
|
|
110
109
|
throw createError({
|
|
111
|
-
status:
|
|
110
|
+
status: STATUS_500,
|
|
112
111
|
statusMessage: "Internal Server Error",
|
|
113
112
|
})
|
|
114
113
|
})
|
|
@@ -118,7 +117,7 @@ describe("Lambda Store", () => {
|
|
|
118
117
|
)
|
|
119
118
|
|
|
120
119
|
expect(lambdaStore.status).toBe(Status.NOT_CONNECTED)
|
|
121
|
-
expect(feedbackStore.server_error).
|
|
120
|
+
expect(feedbackStore.server_error).toBeTruthy()
|
|
122
121
|
})
|
|
123
122
|
})
|
|
124
123
|
|