@geode/opengeodeweb-front 10.0.2-rc.1 → 10.0.2-rc.3
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/app/components/CrsSelector.vue +5 -7
- package/app/components/ExtensionSelector.vue +14 -19
- package/app/components/FileSelector.vue +5 -10
- package/app/components/FileUploader.vue +1 -0
- package/app/components/Inspector/InspectionButton.vue +8 -10
- package/app/components/MissingFilesSelector.vue +9 -19
- package/app/components/ObjectSelector.vue +3 -3
- package/app/components/PackagesVersions.vue +10 -22
- package/app/components/RemoteRenderingView.vue +12 -12
- package/app/components/Screenshot.vue +6 -7
- package/app/components/VeaseViewToolbar.vue +4 -7
- package/app/components/ViewToolbar.vue +6 -10
- package/app/components/Viewer/Options/CellAttributeSelector.vue +4 -5
- package/app/components/Viewer/Options/PolygonAttributeSelector.vue +4 -5
- package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +4 -7
- package/app/components/Viewer/Options/TextureItem.vue +6 -8
- package/app/components/Viewer/Options/VertexAttributeSelector.vue +3 -7
- package/app/composables/project_manager.js +8 -12
- package/app/stores/data_base.js +10 -16
- package/app/stores/data_style.js +3 -3
- package/app/stores/geode.js +30 -4
- package/app/stores/hybrid_viewer.js +18 -18
- package/app/stores/infra.js +59 -44
- package/app/stores/lambda.js +63 -0
- package/app/stores/viewer.js +34 -7
- package/app/utils/file_import_workflow.js +9 -8
- package/app/{composables → utils}/upload_file.js +6 -6
- package/{internal_stores → internal/stores}/mesh/cells.js +20 -20
- package/{internal_stores → internal/stores}/mesh/edges.js +12 -6
- package/{internal_stores → internal/stores}/mesh/index.js +4 -5
- package/{internal_stores → internal/stores}/mesh/points.js +16 -11
- package/{internal_stores → internal/stores}/mesh/polygons.js +20 -19
- package/{internal_stores → internal/stores}/mesh/polyhedra.js +17 -19
- package/{internal_stores → internal/stores}/model/blocks.js +8 -10
- package/{internal_stores → internal/stores}/model/corners.js +8 -10
- package/{internal_stores → internal/stores}/model/edges.js +4 -5
- package/{internal_stores → internal/stores}/model/index.js +8 -10
- package/{internal_stores → internal/stores}/model/lines.js +8 -10
- package/{internal_stores → internal/stores}/model/points.js +8 -10
- package/{internal_stores → internal/stores}/model/surfaces.js +8 -10
- package/{app/composables → internal/utils}/api_fetch.js +11 -11
- package/{app/composables → internal/utils}/viewer_call.js +5 -5
- package/nuxt.config.js +1 -1
- package/package.json +1 -1
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +12 -21
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +3 -6
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +9 -16
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +12 -21
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +3 -6
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +3 -6
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +6 -12
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +6 -11
- package/tests/unit/components/CrsSelector.nuxt.test.js +10 -7
- package/tests/unit/components/ExtensionSelector.nuxt.test.js +17 -2
- package/tests/unit/components/FileSelector.nuxt.test.js +2 -2
- package/tests/unit/components/FileUploader.nuxt.test.js +2 -2
- package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +12 -7
- package/tests/unit/components/MissingFilesSelector.nuxt.test.js +20 -9
- package/tests/unit/components/ObjectSelector.nuxt.test.js +2 -2
- package/tests/unit/components/PackagesVersions.nuxt.test.js +2 -2
- package/tests/unit/composables/ProjectManager.nuxt.test.js +9 -11
- package/tests/unit/composables/api_fetch.nuxt.test.js +17 -40
- package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +27 -12
- package/tests/unit/composables/upload_file.nuxt.test.js +3 -3
- package/tests/unit/plugins/project_load.nuxt.test.js +2 -3
- package/tests/unit/stores/Geode.nuxt.test.js +47 -49
- package/tests/unit/stores/Infra.nuxt.test.js +196 -66
- package/tests/unit/stores/Lambda.nuxt.test.js +131 -0
- package/tests/unit/stores/Viewer.nuxt.test.js +48 -46
- /package/{internal_stores → internal/stores}/data_style_state.js +0 -0
- /package/tests/unit/stores/{Appstore.nuxt.test.js → App.nuxt.test.js} +0 -0
|
@@ -64,115 +64,245 @@ describe("Infra Store", () => {
|
|
|
64
64
|
})
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
-
describe("
|
|
68
|
-
test("test
|
|
67
|
+
describe("microservices_connected", () => {
|
|
68
|
+
test("test no microservices registered", () => {
|
|
69
69
|
const infra_store = useInfraStore()
|
|
70
|
-
|
|
71
|
-
useRuntimeConfig().public.PROJECT = "/project"
|
|
72
|
-
infra_store.app_mode = appMode.CLOUD
|
|
73
|
-
expect(infra_store.lambda_url).toBe(
|
|
74
|
-
"https://api.geode-solutions.com:443/test/project/createbackend",
|
|
75
|
-
)
|
|
70
|
+
expect(infra_store.microservices_connected).toBe(true)
|
|
76
71
|
})
|
|
77
|
-
})
|
|
78
|
-
describe("status", () => {
|
|
79
72
|
test("test geode false & viewer false", () => {
|
|
80
73
|
const infra_store = useInfraStore()
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
const geodeStore = useGeodeStore()
|
|
75
|
+
const viewerStore = useViewerStore()
|
|
76
|
+
|
|
77
|
+
infra_store.register_microservice(geodeStore, {
|
|
78
|
+
request: vi.fn(),
|
|
79
|
+
connect: vi.fn(),
|
|
80
|
+
launch: vi.fn(),
|
|
81
|
+
})
|
|
82
|
+
infra_store.register_microservice(viewerStore, {
|
|
83
|
+
request: vi.fn(),
|
|
84
|
+
connect: vi.fn(),
|
|
85
|
+
launch: vi.fn(),
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
geodeStore.$patch({ status: Status.NOT_CONNECTED })
|
|
89
|
+
viewerStore.$patch({ status: Status.NOT_CONNECTED })
|
|
85
90
|
expect(infra_store.microservices_connected).toBe(false)
|
|
86
91
|
})
|
|
87
92
|
test("test geode true & viewer false", () => {
|
|
88
93
|
const infra_store = useInfraStore()
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
const geodeStore = useGeodeStore()
|
|
95
|
+
const viewerStore = useViewerStore()
|
|
96
|
+
|
|
97
|
+
infra_store.register_microservice(geodeStore, {
|
|
98
|
+
request: vi.fn(),
|
|
99
|
+
connect: vi.fn(),
|
|
100
|
+
launch: vi.fn(),
|
|
101
|
+
})
|
|
102
|
+
infra_store.register_microservice(viewerStore, {
|
|
103
|
+
request: vi.fn(),
|
|
104
|
+
connect: vi.fn(),
|
|
105
|
+
launch: vi.fn(),
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
geodeStore.$patch({ status: Status.CONNECTED })
|
|
109
|
+
viewerStore.$patch({ status: Status.NOT_CONNECTED })
|
|
93
110
|
expect(infra_store.microservices_connected).toBe(false)
|
|
94
111
|
})
|
|
95
112
|
test("test geode false & viewer true", () => {
|
|
96
113
|
const infra_store = useInfraStore()
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
114
|
+
const geodeStore = useGeodeStore()
|
|
115
|
+
const viewerStore = useViewerStore()
|
|
116
|
+
|
|
117
|
+
infra_store.register_microservice(geodeStore, {
|
|
118
|
+
request: vi.fn(),
|
|
119
|
+
connect: vi.fn(),
|
|
120
|
+
launch: vi.fn(),
|
|
121
|
+
})
|
|
122
|
+
infra_store.register_microservice(viewerStore, {
|
|
123
|
+
request: vi.fn(),
|
|
124
|
+
connect: vi.fn(),
|
|
125
|
+
launch: vi.fn(),
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
geodeStore.$patch({ status: Status.NOT_CONNECTED })
|
|
129
|
+
viewerStore.$patch({ status: Status.CONNECTED })
|
|
101
130
|
expect(infra_store.microservices_connected).toBe(false)
|
|
102
131
|
})
|
|
103
132
|
test("test geode true & viewer true", () => {
|
|
104
133
|
const infra_store = useInfraStore()
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
134
|
+
const geodeStore = useGeodeStore()
|
|
135
|
+
const viewerStore = useViewerStore()
|
|
136
|
+
|
|
137
|
+
infra_store.register_microservice(geodeStore, {
|
|
138
|
+
request: vi.fn(),
|
|
139
|
+
connect: vi.fn(),
|
|
140
|
+
launch: vi.fn(),
|
|
141
|
+
})
|
|
142
|
+
infra_store.register_microservice(viewerStore, {
|
|
143
|
+
request: vi.fn(),
|
|
144
|
+
connect: vi.fn(),
|
|
145
|
+
launch: vi.fn(),
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
geodeStore.$patch({ status: Status.CONNECTED })
|
|
149
|
+
viewerStore.$patch({ status: Status.CONNECTED })
|
|
109
150
|
expect(infra_store.microservices_connected).toBe(true)
|
|
110
151
|
})
|
|
111
152
|
})
|
|
112
153
|
|
|
113
|
-
describe("
|
|
154
|
+
describe("microservices_busy", () => {
|
|
155
|
+
test("test no microservices registered", () => {
|
|
156
|
+
const infra_store = useInfraStore()
|
|
157
|
+
expect(infra_store.microservices_busy).toBe(false)
|
|
158
|
+
})
|
|
114
159
|
test("test geode false & viewer false", () => {
|
|
115
160
|
const infra_store = useInfraStore()
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
161
|
+
const geodeStore = useGeodeStore()
|
|
162
|
+
const viewerStore = useViewerStore()
|
|
163
|
+
|
|
164
|
+
infra_store.register_microservice(geodeStore, {
|
|
165
|
+
request: vi.fn(),
|
|
166
|
+
connect: vi.fn(),
|
|
167
|
+
launch: vi.fn(),
|
|
168
|
+
})
|
|
169
|
+
infra_store.register_microservice(viewerStore, {
|
|
170
|
+
request: vi.fn(),
|
|
171
|
+
connect: vi.fn(),
|
|
172
|
+
launch: vi.fn(),
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
geodeStore.$patch({ request_counter: 0 })
|
|
176
|
+
viewerStore.$patch({ request_counter: 0 })
|
|
120
177
|
expect(infra_store.microservices_busy).toBe(false)
|
|
121
178
|
})
|
|
122
179
|
test("test geode true & viewer false", () => {
|
|
123
180
|
const infra_store = useInfraStore()
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
181
|
+
const geodeStore = useGeodeStore()
|
|
182
|
+
const viewerStore = useViewerStore()
|
|
183
|
+
|
|
184
|
+
infra_store.register_microservice(geodeStore, {
|
|
185
|
+
request: vi.fn(),
|
|
186
|
+
connect: vi.fn(),
|
|
187
|
+
launch: vi.fn(),
|
|
188
|
+
})
|
|
189
|
+
infra_store.register_microservice(viewerStore, {
|
|
190
|
+
request: vi.fn(),
|
|
191
|
+
connect: vi.fn(),
|
|
192
|
+
launch: vi.fn(),
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
geodeStore.$patch({ request_counter: 1 })
|
|
196
|
+
viewerStore.$patch({ request_counter: 0 })
|
|
128
197
|
expect(infra_store.microservices_busy).toBe(true)
|
|
129
198
|
})
|
|
130
199
|
test("test geode false & viewer true", () => {
|
|
131
200
|
const infra_store = useInfraStore()
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
201
|
+
const geodeStore = useGeodeStore()
|
|
202
|
+
const viewerStore = useViewerStore()
|
|
203
|
+
|
|
204
|
+
infra_store.register_microservice(geodeStore, {
|
|
205
|
+
request: vi.fn(),
|
|
206
|
+
connect: vi.fn(),
|
|
207
|
+
launch: vi.fn(),
|
|
208
|
+
})
|
|
209
|
+
infra_store.register_microservice(viewerStore, {
|
|
210
|
+
request: vi.fn(),
|
|
211
|
+
connect: vi.fn(),
|
|
212
|
+
launch: vi.fn(),
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
geodeStore.$patch({ request_counter: 0 })
|
|
216
|
+
viewerStore.$patch({ request_counter: 1 })
|
|
136
217
|
expect(infra_store.microservices_busy).toBe(true)
|
|
137
218
|
})
|
|
138
219
|
test("test geode true & viewer true", () => {
|
|
139
220
|
const infra_store = useInfraStore()
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
221
|
+
const geodeStore = useGeodeStore()
|
|
222
|
+
const viewerStore = useViewerStore()
|
|
223
|
+
|
|
224
|
+
infra_store.register_microservice(geodeStore, {
|
|
225
|
+
request: vi.fn(),
|
|
226
|
+
connect: vi.fn(),
|
|
227
|
+
launch: vi.fn(),
|
|
228
|
+
})
|
|
229
|
+
infra_store.register_microservice(viewerStore, {
|
|
230
|
+
request: vi.fn(),
|
|
231
|
+
connect: vi.fn(),
|
|
232
|
+
launch: vi.fn(),
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
geodeStore.$patch({ request_counter: 1 })
|
|
236
|
+
viewerStore.$patch({ request_counter: 1 })
|
|
144
237
|
expect(infra_store.microservices_busy).toBe(true)
|
|
145
238
|
})
|
|
146
239
|
})
|
|
147
240
|
})
|
|
148
241
|
|
|
149
242
|
describe("actions", () => {
|
|
243
|
+
describe("register_microservice", () => {
|
|
244
|
+
test("register geode microservice", () => {
|
|
245
|
+
const infra_store = useInfraStore()
|
|
246
|
+
const geodeStore = useGeodeStore()
|
|
247
|
+
|
|
248
|
+
infra_store.register_microservice(geodeStore, {
|
|
249
|
+
request: vi.fn(),
|
|
250
|
+
connect: vi.fn(),
|
|
251
|
+
launch: vi.fn(),
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
expect(infra_store.microservices.length).toBe(1)
|
|
255
|
+
expect(infra_store.microservices[0].$id).toBe("geode")
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
test("register multiple microservices", () => {
|
|
259
|
+
const infra_store = useInfraStore()
|
|
260
|
+
const geodeStore = useGeodeStore()
|
|
261
|
+
const viewerStore = useViewerStore()
|
|
262
|
+
|
|
263
|
+
infra_store.register_microservice(geodeStore, {
|
|
264
|
+
request: vi.fn(),
|
|
265
|
+
connect: vi.fn(),
|
|
266
|
+
launch: vi.fn(),
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
infra_store.register_microservice(viewerStore, {
|
|
270
|
+
request: vi.fn(),
|
|
271
|
+
connect: vi.fn(),
|
|
272
|
+
launch: vi.fn(),
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
expect(infra_store.microservices.length).toBe(2)
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
|
|
150
279
|
describe("create_backend", () => {
|
|
151
|
-
test("test without
|
|
280
|
+
test("test without microservices", async () => {
|
|
281
|
+
const infra_store = useInfraStore()
|
|
282
|
+
infra_store.app_mode = appMode.BROWSER
|
|
283
|
+
await infra_store.create_backend()
|
|
284
|
+
expect(infra_store.status).toBe(Status.CREATED)
|
|
285
|
+
})
|
|
286
|
+
test("test with end-point", async () => {
|
|
152
287
|
const infra_store = useInfraStore()
|
|
153
|
-
const
|
|
154
|
-
const
|
|
288
|
+
const geodeStore = useGeodeStore()
|
|
289
|
+
const viewerStore = useViewerStore()
|
|
290
|
+
const feedback_store = useFeedbackStore()
|
|
291
|
+
const lambdaStore = useLambdaStore()
|
|
292
|
+
|
|
293
|
+
infra_store.app_mode = appMode.CLOUD
|
|
294
|
+
const ID = "123456"
|
|
295
|
+
registerEndpoint(lambdaStore.base_url, {
|
|
296
|
+
method: "POST",
|
|
297
|
+
handler: () => ({ ID }),
|
|
298
|
+
})
|
|
155
299
|
await infra_store.create_backend()
|
|
156
|
-
expect(infra_store.status).toBe(Status.
|
|
157
|
-
expect(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// const geode_store = useGeodeStore()
|
|
163
|
-
// const viewer_store = useViewerStore()
|
|
164
|
-
// const feedback_store = useFeedbackStore()
|
|
165
|
-
|
|
166
|
-
// registerEndpoint(infra_store.lambda_url, {
|
|
167
|
-
// method: "POST",
|
|
168
|
-
// handler: () => ({ ID: "123456" }),
|
|
169
|
-
// })
|
|
170
|
-
// await infra_store.create_backend()
|
|
171
|
-
// expect(infra_store.status).toBe(Status.CREATED)
|
|
172
|
-
// expect(geode_store.status).toBe(Status.NOT_CONNECTED)
|
|
173
|
-
// expect(viewer_store.status).toBe(Status.NOT_CONNECTED)
|
|
174
|
-
// expect(feedback_store.server_error).toBe(true)
|
|
175
|
-
// })
|
|
300
|
+
expect(infra_store.status).toBe(Status.CREATED)
|
|
301
|
+
expect(infra_store.ID).toBe(ID)
|
|
302
|
+
|
|
303
|
+
expect(geodeStore.status).toBe(Status.NOT_CONNECTED)
|
|
304
|
+
expect(viewerStore.status).toBe(Status.NOT_CONNECTED)
|
|
305
|
+
})
|
|
176
306
|
})
|
|
177
307
|
})
|
|
178
308
|
})
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Global imports
|
|
2
|
+
|
|
3
|
+
// Third party imports
|
|
4
|
+
import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
5
|
+
import { setActivePinia } from "pinia"
|
|
6
|
+
import { createTestingPinia } from "@pinia/testing"
|
|
7
|
+
import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
|
|
8
|
+
|
|
9
|
+
// Local imports
|
|
10
|
+
import Status from "@ogw_front/utils/status.js"
|
|
11
|
+
|
|
12
|
+
beforeEach(async () => {
|
|
13
|
+
const pinia = createTestingPinia({
|
|
14
|
+
stubActions: false,
|
|
15
|
+
createSpy: vi.fn,
|
|
16
|
+
})
|
|
17
|
+
setActivePinia(pinia)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
describe("Lambda Store", () => {
|
|
21
|
+
describe("state", () => {
|
|
22
|
+
test("initial state", () => {
|
|
23
|
+
const lambdaStore = useLambdaStore()
|
|
24
|
+
expectTypeOf(lambdaStore.status).toBeString()
|
|
25
|
+
expect(lambdaStore.status).toBe(Status.NOT_CONNECTED)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
describe("getters", () => {
|
|
30
|
+
describe("protocol", () => {
|
|
31
|
+
test("test protocol is always https", () => {
|
|
32
|
+
const lambdaStore = useLambdaStore()
|
|
33
|
+
expect(lambdaStore.protocol).toBe("https")
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe("port", () => {
|
|
38
|
+
test("test port is always 443", () => {
|
|
39
|
+
const lambdaStore = useLambdaStore()
|
|
40
|
+
expect(lambdaStore.port).toBe("443")
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
describe("base_url", () => {
|
|
45
|
+
test("test base_url construction", () => {
|
|
46
|
+
const lambdaStore = useLambdaStore()
|
|
47
|
+
useRuntimeConfig().public.API_URL = "api.example.com"
|
|
48
|
+
useRuntimeConfig().public.SITE_BRANCH = "/test"
|
|
49
|
+
useRuntimeConfig().public.PROJECT = "/project"
|
|
50
|
+
expect(lambdaStore.base_url).toBe(
|
|
51
|
+
"https://api.example.com:443/test/project/createbackend",
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
describe("is_busy", () => {
|
|
57
|
+
test("test is_busy is always false", () => {
|
|
58
|
+
const lambdaStore = useLambdaStore()
|
|
59
|
+
expect(lambdaStore.is_busy).toBe(false)
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
describe("actions", () => {
|
|
65
|
+
describe("launch", () => {
|
|
66
|
+
const postFakeCall = vi.fn()
|
|
67
|
+
|
|
68
|
+
test("successful launch", async () => {
|
|
69
|
+
const lambdaStore = useLambdaStore()
|
|
70
|
+
const feedbackStore = useFeedbackStore()
|
|
71
|
+
|
|
72
|
+
useRuntimeConfig().public.API_URL = "api.example.com"
|
|
73
|
+
useRuntimeConfig().public.SITE_BRANCH = "/test"
|
|
74
|
+
useRuntimeConfig().public.PROJECT = "/project"
|
|
75
|
+
|
|
76
|
+
registerEndpoint(lambdaStore.base_url, {
|
|
77
|
+
method: "POST",
|
|
78
|
+
handler: postFakeCall,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
postFakeCall.mockImplementation(() => ({
|
|
82
|
+
ID: "test-id-123456",
|
|
83
|
+
}))
|
|
84
|
+
|
|
85
|
+
const id = await lambdaStore.launch()
|
|
86
|
+
|
|
87
|
+
expect(lambdaStore.status).toBe(Status.CONNECTED)
|
|
88
|
+
expect(id).toBe("test-id-123456")
|
|
89
|
+
expect(feedbackStore.server_error).toBe(false)
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
test("failed launch - error response", async () => {
|
|
93
|
+
const lambdaStore = useLambdaStore()
|
|
94
|
+
const feedbackStore = useFeedbackStore()
|
|
95
|
+
|
|
96
|
+
useRuntimeConfig().public.API_URL = "api.example.com"
|
|
97
|
+
useRuntimeConfig().public.SITE_BRANCH = "/test"
|
|
98
|
+
useRuntimeConfig().public.PROJECT = "/project"
|
|
99
|
+
|
|
100
|
+
registerEndpoint(lambdaStore.base_url, {
|
|
101
|
+
method: "POST",
|
|
102
|
+
handler: postFakeCall,
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
postFakeCall.mockImplementation(() => {
|
|
106
|
+
throw createError({
|
|
107
|
+
status: 500,
|
|
108
|
+
statusMessage: "Internal Server Error",
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
await expect(lambdaStore.launch()).rejects.toThrow(
|
|
113
|
+
"Failed to launch lambda backend",
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
expect(lambdaStore.status).toBe(Status.NOT_CONNECTED)
|
|
117
|
+
expect(feedbackStore.server_error).toBe(true)
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
describe("connect", () => {
|
|
122
|
+
test("successful connect", async () => {
|
|
123
|
+
const lambdaStore = useLambdaStore()
|
|
124
|
+
|
|
125
|
+
await lambdaStore.connect()
|
|
126
|
+
|
|
127
|
+
expect(lambdaStore.status).toBe(Status.CONNECTED)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
})
|
|
@@ -55,16 +55,16 @@ beforeEach(() => {
|
|
|
55
55
|
describe("Viewer Store", () => {
|
|
56
56
|
describe("state", () => {
|
|
57
57
|
test("initial state", () => {
|
|
58
|
-
const
|
|
59
|
-
expectTypeOf(
|
|
60
|
-
expectTypeOf(
|
|
61
|
-
expectTypeOf(
|
|
62
|
-
expectTypeOf(
|
|
58
|
+
const viewerStore = useViewerStore()
|
|
59
|
+
expectTypeOf(viewerStore.default_local_port).toBeString()
|
|
60
|
+
expectTypeOf(viewerStore.client).toEqualTypeOf({})
|
|
61
|
+
expectTypeOf(viewerStore.picking_mode).toBeBoolean()
|
|
62
|
+
expectTypeOf(viewerStore.picked_point).toEqualTypeOf({
|
|
63
63
|
x: null,
|
|
64
64
|
y: null,
|
|
65
65
|
})
|
|
66
|
-
expectTypeOf(
|
|
67
|
-
expectTypeOf(
|
|
66
|
+
expectTypeOf(viewerStore.picked_point).toBeNumber()
|
|
67
|
+
expectTypeOf(viewerStore.status).toBeString()
|
|
68
68
|
})
|
|
69
69
|
})
|
|
70
70
|
|
|
@@ -72,50 +72,50 @@ describe("Viewer Store", () => {
|
|
|
72
72
|
describe("protocol", () => {
|
|
73
73
|
test("test app_mode CLOUD", () => {
|
|
74
74
|
const infra_store = useInfraStore()
|
|
75
|
-
const
|
|
75
|
+
const viewerStore = useViewerStore()
|
|
76
76
|
infra_store.app_mode = appMode.CLOUD
|
|
77
|
-
expect(
|
|
77
|
+
expect(viewerStore.protocol).toBe("wss")
|
|
78
78
|
})
|
|
79
79
|
test("test app_mode BROWSER", () => {
|
|
80
80
|
const infra_store = useInfraStore()
|
|
81
|
-
const
|
|
81
|
+
const viewerStore = useViewerStore()
|
|
82
82
|
infra_store.app_mode = appMode.BROWSER
|
|
83
|
-
expect(
|
|
83
|
+
expect(viewerStore.protocol).toBe("ws")
|
|
84
84
|
})
|
|
85
85
|
test("test app_mode DESKTOP", () => {
|
|
86
86
|
const infra_store = useInfraStore()
|
|
87
|
-
const
|
|
87
|
+
const viewerStore = useViewerStore()
|
|
88
88
|
infra_store.app_mode = appMode.DESKTOP
|
|
89
|
-
expect(
|
|
89
|
+
expect(viewerStore.protocol).toBe("ws")
|
|
90
90
|
})
|
|
91
91
|
})
|
|
92
92
|
|
|
93
93
|
describe("port", () => {
|
|
94
94
|
test("test app_mode CLOUD", () => {
|
|
95
95
|
const infra_store = useInfraStore()
|
|
96
|
-
const
|
|
96
|
+
const viewerStore = useViewerStore()
|
|
97
97
|
infra_store.app_mode = appMode.CLOUD
|
|
98
|
-
expect(
|
|
98
|
+
expect(viewerStore.port).toBe("443")
|
|
99
99
|
})
|
|
100
100
|
test("test app_mode BROWSER", () => {
|
|
101
101
|
const infra_store = useInfraStore()
|
|
102
|
-
const
|
|
102
|
+
const viewerStore = useViewerStore()
|
|
103
103
|
infra_store.app_mode = appMode.BROWSER
|
|
104
|
-
expect(
|
|
104
|
+
expect(viewerStore.port).toBe(viewerStore.default_local_port)
|
|
105
105
|
})
|
|
106
106
|
test("test app_mode DESKTOP", () => {
|
|
107
107
|
const infra_store = useInfraStore()
|
|
108
|
-
const
|
|
108
|
+
const viewerStore = useViewerStore()
|
|
109
109
|
infra_store.app_mode = appMode.DESKTOP
|
|
110
|
-
expect(
|
|
110
|
+
expect(viewerStore.port).toBe(viewerStore.default_local_port)
|
|
111
111
|
})
|
|
112
112
|
|
|
113
113
|
test("test override default_local_port", () => {
|
|
114
114
|
const infra_store = useInfraStore()
|
|
115
|
-
const
|
|
115
|
+
const viewerStore = useViewerStore()
|
|
116
116
|
infra_store.app_mode = appMode.DESKTOP
|
|
117
|
-
|
|
118
|
-
expect(
|
|
117
|
+
viewerStore.default_local_port = "8080"
|
|
118
|
+
expect(viewerStore.port).toBe("8080")
|
|
119
119
|
})
|
|
120
120
|
})
|
|
121
121
|
describe("base_url", () => {
|
|
@@ -123,48 +123,48 @@ describe("Viewer Store", () => {
|
|
|
123
123
|
const infra_store = useInfraStore()
|
|
124
124
|
infra_store.app_mode = appMode.DESKTOP
|
|
125
125
|
infra_store.domain_name = "localhost"
|
|
126
|
-
// expect(
|
|
126
|
+
// expect(viewerStore.base_url).toBe("ws://localhost:1234/ws")
|
|
127
127
|
})
|
|
128
128
|
|
|
129
129
|
test("test app_mode CLOUD", () => {
|
|
130
130
|
const infra_store = useInfraStore()
|
|
131
|
-
const
|
|
131
|
+
const viewerStore = useViewerStore()
|
|
132
132
|
infra_store.app_mode = appMode.CLOUD
|
|
133
133
|
infra_store.ID = "123456"
|
|
134
134
|
infra_store.domain_name = "example.com"
|
|
135
|
-
expect(
|
|
135
|
+
expect(viewerStore.base_url).toBe(
|
|
136
136
|
"wss://example.com:443/123456/viewer/ws",
|
|
137
137
|
)
|
|
138
138
|
})
|
|
139
139
|
|
|
140
140
|
test("test app_mode CLOUD, ID empty", () => {
|
|
141
141
|
const infra_store = useInfraStore()
|
|
142
|
-
const
|
|
142
|
+
const viewerStore = useViewerStore()
|
|
143
143
|
infra_store.app_mode = appMode.CLOUD
|
|
144
144
|
infra_store.ID = ""
|
|
145
145
|
infra_store.domain_name = "example.com"
|
|
146
|
-
expect(() =>
|
|
146
|
+
expect(() => viewerStore.base_url).toThrowError(
|
|
147
147
|
"ID must not be empty in cloud mode",
|
|
148
148
|
)
|
|
149
149
|
})
|
|
150
150
|
})
|
|
151
151
|
describe("is_busy", () => {
|
|
152
152
|
test("test is_busy", () => {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
expect(
|
|
153
|
+
const viewerStore = useViewerStore()
|
|
154
|
+
viewerStore.request_counter = 1
|
|
155
|
+
expect(viewerStore.is_busy).toBe(true)
|
|
156
156
|
})
|
|
157
157
|
test("test not is_busy", () => {
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
expect(
|
|
158
|
+
const viewerStore = useViewerStore()
|
|
159
|
+
viewerStore.request_counter = 0
|
|
160
|
+
expect(viewerStore.is_busy).toBe(false)
|
|
161
161
|
})
|
|
162
162
|
})
|
|
163
163
|
})
|
|
164
164
|
describe("actions", () => {
|
|
165
165
|
// test("ws_connect", async () => {
|
|
166
166
|
// const infra_store = useInfraStore()
|
|
167
|
-
// const
|
|
167
|
+
// const viewerStore = useViewerStore()
|
|
168
168
|
// infra_store.app_mode = appMode.BROWSER
|
|
169
169
|
// const viewer_path = path.join(
|
|
170
170
|
// executable_path(
|
|
@@ -176,29 +176,31 @@ describe("Viewer Store", () => {
|
|
|
176
176
|
// port: 1234,
|
|
177
177
|
// data_folder_path: "./data",
|
|
178
178
|
// })
|
|
179
|
-
//
|
|
180
|
-
// await
|
|
181
|
-
// expect(
|
|
179
|
+
// viewerStore.default_local_port = viewer_port
|
|
180
|
+
// await viewerStore.ws_connect()
|
|
181
|
+
// expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
182
182
|
// }, 10000)
|
|
183
183
|
describe("toggle_picking_mode", () => {
|
|
184
184
|
test("test true", async () => {
|
|
185
|
-
const
|
|
186
|
-
await
|
|
187
|
-
expect(
|
|
185
|
+
const viewerStore = useViewerStore()
|
|
186
|
+
await viewerStore.toggle_picking_mode(true)
|
|
187
|
+
expect(viewerStore.picking_mode).toBe(true)
|
|
188
188
|
})
|
|
189
189
|
})
|
|
190
|
+
|
|
190
191
|
describe("start_request", () => {
|
|
191
192
|
test("test increment", async () => {
|
|
192
|
-
const
|
|
193
|
-
await
|
|
194
|
-
expect(
|
|
193
|
+
const viewerStore = useViewerStore()
|
|
194
|
+
await viewerStore.start_request()
|
|
195
|
+
expect(viewerStore.request_counter).toBe(1)
|
|
195
196
|
})
|
|
196
197
|
})
|
|
198
|
+
|
|
197
199
|
describe("stop_request", () => {
|
|
198
200
|
test("test decrement", async () => {
|
|
199
|
-
const
|
|
200
|
-
await
|
|
201
|
-
expect(
|
|
201
|
+
const viewerStore = useViewerStore()
|
|
202
|
+
await viewerStore.stop_request()
|
|
203
|
+
expect(viewerStore.request_counter).toBe(-1)
|
|
202
204
|
})
|
|
203
205
|
})
|
|
204
206
|
})
|
|
File without changes
|
|
File without changes
|