@geode/opengeodeweb-front 9.11.0-rc.9 → 9.11.2
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/.github/workflows/test.yml +0 -23
- package/components/FeedBack/ErrorBanner.vue +1 -1
- package/components/FeedBack/Snackers.vue +1 -1
- package/components/HybridRenderingView.vue +12 -38
- package/components/Launcher.vue +1 -1
- package/components/PackagesVersions.vue +1 -1
- package/components/Recaptcha.vue +1 -1
- package/components/RemoteRenderingView.vue +1 -1
- package/components/Viewer/BreadCrumb.vue +1 -1
- package/components/Viewer/Tree/ObjectTree.vue +1 -1
- package/components/Viewer/TreeObject.vue +1 -1
- package/components/Wrapper.vue +1 -1
- package/composables/api_fetch.js +2 -2
- package/composables/run_function_when_microservices_connected.js +1 -1
- package/composables/upload_file.js +2 -2
- package/composables/viewer_call.js +38 -38
- package/internal_stores/mesh/edges.js +52 -49
- package/internal_stores/mesh/index.js +14 -20
- package/internal_stores/mesh/points.js +7 -9
- package/internal_stores/mesh/polygons.js +7 -9
- package/internal_stores/mesh/polyhedra.js +6 -8
- package/internal_stores/model/blocks.js +1 -1
- package/internal_stores/model/corners.js +1 -1
- package/internal_stores/model/edges.js +8 -1
- package/internal_stores/model/index.js +1 -1
- package/internal_stores/model/lines.js +2 -2
- package/internal_stores/model/points.js +2 -2
- package/internal_stores/model/surfaces.js +1 -1
- package/package.json +6 -13
- package/stores/data_base.js +1 -9
- package/stores/data_style.js +6 -7
- package/stores/feedback.js +1 -1
- package/stores/geode.js +5 -5
- package/stores/hybrid_viewer.js +1 -1
- package/stores/infra.js +10 -10
- package/stores/treeview.js +1 -1
- package/stores/viewer.js +6 -5
- package/{tests/unit → test}/components/CrsSelector.nuxt.test.js +3 -6
- package/{tests/unit → test}/components/ExtensionSelector.nuxt.test.js +3 -6
- package/{tests/unit → test}/components/FeedBack/ErrorsBanner.nuxt.test.js +3 -10
- package/{tests/unit → test}/components/FeedBack/Snackers.nuxt.test.js +21 -24
- package/{tests/unit → test}/components/FileSelector.nuxt.test.js +2 -5
- package/{tests/unit → test}/components/FileUploader.nuxt.test.js +3 -6
- package/{tests/unit → test}/components/Inspector/InspectionButton.nuxt.test.js +3 -6
- package/{tests/unit → test}/components/Launcher.nuxt.test.js +2 -9
- package/{tests/unit → test}/components/MissingFilesSelector.nuxt.test.js +3 -6
- package/{tests/unit → test}/components/ObjectSelector.nuxt.test.js +3 -6
- package/{tests/unit → test}/components/PackagesVersions.nuxt.test.js +3 -5
- package/{tests/unit → test}/components/Stepper.nuxt.test.js +0 -1
- package/{tests/unit → test}/components/Wrapper.nuxt.test.js +1 -1
- package/{tests/unit → test}/composables/api_fetch.nuxt.test.js +2 -3
- package/{tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js → test/composables/run_function_when_microservices_connected.test.js} +5 -18
- package/{tests/unit → test}/composables/upload_file.nuxt.test.js +8 -7
- package/{tests/unit → test}/stores/Feedback.nuxt.test.js +8 -12
- package/{tests/unit → test}/stores/Geode.nuxt.test.js +10 -33
- package/{tests/unit → test}/stores/Infra.nuxt.test.js +25 -58
- package/{tests/unit → test}/stores/Viewer.nuxt.test.js +20 -101
- package/{tests/unit → test}/utils/validate_schema.nuxt.test.js +0 -3
- package/vitest.config.js +13 -0
- package/geode-opengeodeweb-back-5.10.0-rc.8.tgz +0 -0
- package/geode-opengeodeweb-viewer-1.11.0-rc.4.tgz +0 -0
- package/tests/integration/data/fake_id/edged_curve.vtp +0 -20
- package/tests/integration/microservices/back/requirements.in +0 -1
- package/tests/integration/microservices/back/requirements.txt +0 -75
- package/tests/integration/microservices/viewer/requirements.in +0 -1
- package/tests/integration/microservices/viewer/requirements.txt +0 -87
- package/tests/integration/stores/DataStyle/mesh/Edges.nuxt.test.js +0 -138
- package/tests/vitest.config.js +0 -33
- package/utils/default_styles.js +0 -246
- package/utils/local.js +0 -180
- /package/{tests/unit → test}/components/Inspector/ResultPanel.nuxt.test.js +0 -0
- /package/{tests/unit → test}/components/Step.nuxt.test.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, test
|
|
1
|
+
import { describe, expect, test } from "vitest"
|
|
2
2
|
import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
|
|
3
3
|
import { flushPromises } from "@vue/test-utils"
|
|
4
4
|
|
|
@@ -18,12 +18,9 @@ const vuetify = createVuetify({
|
|
|
18
18
|
})
|
|
19
19
|
|
|
20
20
|
describe("Inspector/InspectionButton.vue", async () => {
|
|
21
|
-
const pinia = createTestingPinia(
|
|
22
|
-
stubActions: false,
|
|
23
|
-
createSpy: vi.fn,
|
|
24
|
-
})
|
|
21
|
+
const pinia = createTestingPinia()
|
|
25
22
|
setActivePinia(pinia)
|
|
26
|
-
const geode_store =
|
|
23
|
+
const geode_store = use_geode_store()
|
|
27
24
|
geode_store.base_url = ""
|
|
28
25
|
|
|
29
26
|
test(`Test with issues`, async () => {
|
|
@@ -6,9 +6,6 @@ import { createVuetify } from "vuetify"
|
|
|
6
6
|
import * as components from "vuetify/components"
|
|
7
7
|
import * as directives from "vuetify/directives"
|
|
8
8
|
|
|
9
|
-
import { setActivePinia } from "pinia"
|
|
10
|
-
import { createTestingPinia } from "@pinia/testing"
|
|
11
|
-
|
|
12
9
|
import Launcher from "@ogw_f/components/Launcher.vue"
|
|
13
10
|
|
|
14
11
|
const vuetify = createVuetify({
|
|
@@ -16,6 +13,8 @@ const vuetify = createVuetify({
|
|
|
16
13
|
directives,
|
|
17
14
|
})
|
|
18
15
|
|
|
16
|
+
const infra_store = use_infra_store()
|
|
17
|
+
|
|
19
18
|
// Mock navigator.locks API
|
|
20
19
|
const mockLockRequest = vi.fn().mockImplementation(async (name, callback) => {
|
|
21
20
|
return callback({ name })
|
|
@@ -32,12 +31,6 @@ global.ResizeObserver = require("resize-observer-polyfill")
|
|
|
32
31
|
|
|
33
32
|
describe("Launcher.vue", async () => {
|
|
34
33
|
test(`Mount`, async () => {
|
|
35
|
-
const pinia = createTestingPinia({
|
|
36
|
-
stubActions: false,
|
|
37
|
-
createSpy: vi.fn,
|
|
38
|
-
})
|
|
39
|
-
setActivePinia(pinia)
|
|
40
|
-
const infra_store = useInfraStore()
|
|
41
34
|
const spy_create_backend = vi.spyOn(infra_store, "create_backend")
|
|
42
35
|
const wrapper = await mountSuspended(Launcher, {
|
|
43
36
|
global: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, test
|
|
1
|
+
import { describe, expect, test } from "vitest"
|
|
2
2
|
import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
|
|
3
3
|
import { flushPromises } from "@vue/test-utils"
|
|
4
4
|
|
|
@@ -22,12 +22,9 @@ const vuetify = createVuetify({
|
|
|
22
22
|
})
|
|
23
23
|
|
|
24
24
|
describe("MissingFilesSelector.vue", async () => {
|
|
25
|
-
const pinia = createTestingPinia(
|
|
26
|
-
stubActions: false,
|
|
27
|
-
createSpy: vi.fn,
|
|
28
|
-
})
|
|
25
|
+
const pinia = createTestingPinia()
|
|
29
26
|
setActivePinia(pinia)
|
|
30
|
-
const geode_store =
|
|
27
|
+
const geode_store = use_geode_store()
|
|
31
28
|
geode_store.base_url = ""
|
|
32
29
|
|
|
33
30
|
test(`Select file`, async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, test
|
|
1
|
+
import { describe, expect, test } from "vitest"
|
|
2
2
|
import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
|
|
3
3
|
import { flushPromises } from "@vue/test-utils"
|
|
4
4
|
|
|
@@ -20,12 +20,9 @@ const vuetify = createVuetify({
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
describe("ObjectSelector.vue", async () => {
|
|
23
|
-
const pinia = createTestingPinia(
|
|
24
|
-
stubActions: false,
|
|
25
|
-
createSpy: vi.fn,
|
|
26
|
-
})
|
|
23
|
+
const pinia = createTestingPinia()
|
|
27
24
|
setActivePinia(pinia)
|
|
28
|
-
const geode_store =
|
|
25
|
+
const geode_store = use_geode_store()
|
|
29
26
|
geode_store.base_url = ""
|
|
30
27
|
|
|
31
28
|
test(`test loadable with one class`, async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, test
|
|
1
|
+
import { describe, expect, test } from "vitest"
|
|
2
2
|
import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
3
3
|
|
|
4
4
|
import { createVuetify } from "vuetify"
|
|
@@ -17,11 +17,9 @@ const vuetify = createVuetify({
|
|
|
17
17
|
|
|
18
18
|
describe("PackagesVersions.vue", async () => {
|
|
19
19
|
test(`Mount`, async () => {
|
|
20
|
-
const pinia = createTestingPinia(
|
|
21
|
-
createSpy: vi.fn,
|
|
22
|
-
})
|
|
20
|
+
const pinia = createTestingPinia()
|
|
23
21
|
setActivePinia(pinia)
|
|
24
|
-
const geode_store =
|
|
22
|
+
const geode_store = use_geode_store()
|
|
25
23
|
geode_store.base_url = ""
|
|
26
24
|
|
|
27
25
|
const schema = {
|
|
@@ -6,11 +6,10 @@ import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
|
6
6
|
describe("api_fetch", () => {
|
|
7
7
|
const pinia = createTestingPinia({
|
|
8
8
|
stubActions: false,
|
|
9
|
-
createSpy: vi.fn,
|
|
10
9
|
})
|
|
11
10
|
setActivePinia(pinia)
|
|
12
|
-
const geode_store =
|
|
13
|
-
const feedback_store =
|
|
11
|
+
const geode_store = use_geode_store()
|
|
12
|
+
const feedback_store = use_feedback_store()
|
|
14
13
|
geode_store.base_url = ""
|
|
15
14
|
|
|
16
15
|
const schema = {
|
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { describe, expect, test, beforeEach, vi } from "vitest"
|
|
2
2
|
import Status from "@ogw_f/utils/status.js"
|
|
3
3
|
|
|
4
|
-
import { setActivePinia } from "pinia"
|
|
5
|
-
import { createTestingPinia } from "@pinia/testing"
|
|
6
|
-
|
|
7
|
-
beforeEach(async () => {
|
|
8
|
-
const pinia = createTestingPinia({
|
|
9
|
-
stubActions: false,
|
|
10
|
-
createSpy: vi.fn,
|
|
11
|
-
})
|
|
12
|
-
setActivePinia(pinia)
|
|
13
|
-
})
|
|
14
|
-
|
|
15
4
|
describe("run_function_when_microservices_connected", () => {
|
|
5
|
+
const geode_store = use_geode_store()
|
|
6
|
+
const viewer_store = use_viewer_store()
|
|
7
|
+
|
|
16
8
|
const dumb_obj = { dumb_method: () => true }
|
|
17
9
|
|
|
18
10
|
beforeEach(async () => {
|
|
19
|
-
const geode_store = useGeodeStore()
|
|
20
|
-
const viewer_store = useViewerStore()
|
|
21
11
|
await geode_store.$patch({ status: Status.NOT_CONNECTED })
|
|
22
12
|
await viewer_store.$patch({ status: Status.NOT_CONNECTED })
|
|
23
13
|
})
|
|
14
|
+
console.log("Status.CONNECTED", Status.CONNECTED)
|
|
24
15
|
test("microservices connected", async () => {
|
|
25
|
-
const geode_store = useGeodeStore()
|
|
26
|
-
const viewer_store = useViewerStore()
|
|
27
16
|
const spy = vi.spyOn(dumb_obj, "dumb_method")
|
|
28
17
|
run_function_when_microservices_connected(dumb_obj.dumb_method)
|
|
29
18
|
await geode_store.$patch({ status: Status.CONNECTED })
|
|
@@ -32,8 +21,6 @@ describe("run_function_when_microservices_connected", () => {
|
|
|
32
21
|
})
|
|
33
22
|
|
|
34
23
|
test("microservices not connected", async () => {
|
|
35
|
-
const geode_store = useGeodeStore()
|
|
36
|
-
const viewer_store = useViewerStore()
|
|
37
24
|
const spy = vi.spyOn(dumb_obj, "dumb_method")
|
|
38
25
|
run_function_when_microservices_connected(dumb_obj.dumb_method)
|
|
39
26
|
await geode_store.$patch({ status: Status.NOT_CONNECTED })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, test, beforeEach
|
|
1
|
+
import { describe, expect, test, beforeEach } from "vitest"
|
|
2
2
|
import { setActivePinia } from "pinia"
|
|
3
3
|
import { createTestingPinia } from "@pinia/testing"
|
|
4
4
|
import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
@@ -6,17 +6,19 @@ import { upload_file } from "@ogw_f/composables/upload_file"
|
|
|
6
6
|
import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
7
7
|
const schema = schemas.opengeodeweb_back.upload_file
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
describe("upload_file.js", () => {
|
|
10
10
|
const pinia = createTestingPinia({
|
|
11
11
|
stubActions: false,
|
|
12
|
-
createSpy: vi.fn,
|
|
13
12
|
})
|
|
14
13
|
setActivePinia(pinia)
|
|
15
|
-
|
|
14
|
+
const infra_store = use_infra_store()
|
|
15
|
+
const geode_store = use_geode_store()
|
|
16
|
+
const feedback_store = use_feedback_store()
|
|
16
17
|
|
|
17
|
-
describe("upload_file.js", () => {
|
|
18
18
|
beforeEach(() => {
|
|
19
|
-
|
|
19
|
+
infra_store.$reset()
|
|
20
|
+
geode_store.$reset()
|
|
21
|
+
feedback_store.$reset()
|
|
20
22
|
geode_store.base_url = ""
|
|
21
23
|
})
|
|
22
24
|
|
|
@@ -29,7 +31,6 @@ describe("upload_file.js", () => {
|
|
|
29
31
|
})
|
|
30
32
|
|
|
31
33
|
test("onResponse", async () => {
|
|
32
|
-
const feedback_store = useFeedbackStore()
|
|
33
34
|
registerEndpoint(schema.$id, {
|
|
34
35
|
method: "PUT",
|
|
35
36
|
handler: () => ({ test: "ok" }),
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { setActivePinia } from "pinia"
|
|
2
2
|
import { createTestingPinia } from "@pinia/testing"
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { use_feedback_store } from "@ogw_f/stores/feedback"
|
|
4
|
+
import { describe, test, expect, expectTypeOf, beforeEach } from "vitest"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
describe("Feedback Store", () => {
|
|
7
7
|
const pinia = createTestingPinia({
|
|
8
8
|
stubActions: false,
|
|
9
|
-
createSpy: vi.fn,
|
|
10
9
|
})
|
|
11
10
|
setActivePinia(pinia)
|
|
12
|
-
|
|
11
|
+
const feedback_store = use_feedback_store()
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
feedback_store.$reset()
|
|
15
|
+
})
|
|
13
16
|
|
|
14
|
-
describe("Feedback Store", () => {
|
|
15
17
|
describe("state", () => {
|
|
16
18
|
test("initial state", () => {
|
|
17
|
-
const feedback_store = useFeedbackStore()
|
|
18
19
|
expectTypeOf(feedback_store.feedbacks).toEqualTypeOf([])
|
|
19
20
|
expectTypeOf(feedback_store.server_error).toBeBoolean()
|
|
20
21
|
})
|
|
@@ -22,7 +23,6 @@ describe("Feedback Store", () => {
|
|
|
22
23
|
describe("actions", () => {
|
|
23
24
|
describe("add_error", () => {
|
|
24
25
|
test("test add_error", () => {
|
|
25
|
-
const feedback_store = useFeedbackStore()
|
|
26
26
|
feedback_store.add_error(
|
|
27
27
|
500,
|
|
28
28
|
"/test",
|
|
@@ -36,7 +36,6 @@ describe("Feedback Store", () => {
|
|
|
36
36
|
|
|
37
37
|
describe("add_error", () => {
|
|
38
38
|
test("test feedbacks_timeout", () => {
|
|
39
|
-
const feedback_store = useFeedbackStore()
|
|
40
39
|
feedback_store.feedbacks_timeout_miliseconds = 500
|
|
41
40
|
feedback_store.add_error(
|
|
42
41
|
500,
|
|
@@ -53,7 +52,6 @@ describe("Feedback Store", () => {
|
|
|
53
52
|
|
|
54
53
|
describe("add_success", () => {
|
|
55
54
|
test("test add_success", () => {
|
|
56
|
-
const feedback_store = useFeedbackStore()
|
|
57
55
|
feedback_store.feedbacks_timeout_miliseconds = 500
|
|
58
56
|
feedback_store.add_success("test description")
|
|
59
57
|
expect(feedback_store.feedbacks.length).toBe(1)
|
|
@@ -66,7 +64,6 @@ describe("Feedback Store", () => {
|
|
|
66
64
|
})
|
|
67
65
|
describe("delete_feedback", () => {
|
|
68
66
|
test("test", () => {
|
|
69
|
-
const feedback_store = useFeedbackStore()
|
|
70
67
|
feedback_store.delete_feedback(0)
|
|
71
68
|
expect(feedback_store.feedbacks.length).toBe(0)
|
|
72
69
|
})
|
|
@@ -74,7 +71,6 @@ describe("Feedback Store", () => {
|
|
|
74
71
|
|
|
75
72
|
describe("delete_server_error", () => {
|
|
76
73
|
test("test", () => {
|
|
77
|
-
const feedback_store = useFeedbackStore()
|
|
78
74
|
feedback_store.$patch({ server_error: true })
|
|
79
75
|
feedback_store.delete_server_error()
|
|
80
76
|
expect(feedback_store.server_error).toBe(false)
|
|
@@ -5,18 +5,23 @@ import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
|
5
5
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
6
6
|
import Status from "@ogw_f/utils/status"
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
describe("Geode Store", () => {
|
|
9
9
|
const pinia = createTestingPinia({
|
|
10
10
|
stubActions: false,
|
|
11
|
-
createSpy: vi.fn,
|
|
12
11
|
})
|
|
13
12
|
setActivePinia(pinia)
|
|
14
|
-
|
|
13
|
+
const infra_store = use_infra_store()
|
|
14
|
+
const geode_store = use_geode_store()
|
|
15
|
+
const feedback_store = use_feedback_store()
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
infra_store.$reset()
|
|
19
|
+
geode_store.$reset()
|
|
20
|
+
feedback_store.$reset()
|
|
21
|
+
})
|
|
15
22
|
|
|
16
|
-
describe("Geode store", () => {
|
|
17
23
|
describe("state", () => {
|
|
18
24
|
test("initial state", () => {
|
|
19
|
-
const geode_store = useGeodeStore()
|
|
20
25
|
expectTypeOf(geode_store.default_local_port).toBeString()
|
|
21
26
|
expectTypeOf(geode_store.request_counter).toBeNumber()
|
|
22
27
|
expectTypeOf(geode_store.status).toBeString()
|
|
@@ -26,20 +31,14 @@ describe("Geode store", () => {
|
|
|
26
31
|
describe("getters", () => {
|
|
27
32
|
describe("protocol", () => {
|
|
28
33
|
test("test app_mode CLOUD", () => {
|
|
29
|
-
const infra_store = useInfraStore()
|
|
30
|
-
const geode_store = useGeodeStore()
|
|
31
34
|
infra_store.app_mode = appMode.appMode.CLOUD
|
|
32
35
|
expect(geode_store.protocol).toBe("https")
|
|
33
36
|
})
|
|
34
37
|
test("test app_mode BROWSER", () => {
|
|
35
|
-
const infra_store = useInfraStore()
|
|
36
|
-
const geode_store = useGeodeStore()
|
|
37
38
|
infra_store.app_mode = appMode.appMode.BROWSER
|
|
38
39
|
expect(geode_store.protocol).toBe("http")
|
|
39
40
|
})
|
|
40
41
|
test("test app_mode DESKTOP", () => {
|
|
41
|
-
const infra_store = useInfraStore()
|
|
42
|
-
const geode_store = useGeodeStore()
|
|
43
42
|
infra_store.app_mode = appMode.appMode.DESKTOP
|
|
44
43
|
expect(geode_store.protocol).toBe("http")
|
|
45
44
|
})
|
|
@@ -47,27 +46,19 @@ describe("Geode store", () => {
|
|
|
47
46
|
|
|
48
47
|
describe("port", () => {
|
|
49
48
|
test("test app_mode CLOUD", () => {
|
|
50
|
-
const infra_store = useInfraStore()
|
|
51
|
-
const geode_store = useGeodeStore()
|
|
52
49
|
infra_store.app_mode = appMode.appMode.CLOUD
|
|
53
50
|
expect(geode_store.port).toBe("443")
|
|
54
51
|
})
|
|
55
52
|
test("test app_mode BROWSER", () => {
|
|
56
|
-
const infra_store = useInfraStore()
|
|
57
|
-
const geode_store = useGeodeStore()
|
|
58
53
|
infra_store.app_mode = appMode.appMode.BROWSER
|
|
59
54
|
expect(geode_store.port).toBe(geode_store.default_local_port)
|
|
60
55
|
})
|
|
61
56
|
test("test app_mode DESKTOP", () => {
|
|
62
|
-
const infra_store = useInfraStore()
|
|
63
|
-
const geode_store = useGeodeStore()
|
|
64
57
|
infra_store.app_mode = appMode.appMode.DESKTOP
|
|
65
58
|
expect(geode_store.port).toBe(geode_store.default_local_port)
|
|
66
59
|
})
|
|
67
60
|
|
|
68
61
|
test("test override default_local_port", () => {
|
|
69
|
-
const infra_store = useInfraStore()
|
|
70
|
-
const geode_store = useGeodeStore()
|
|
71
62
|
infra_store.app_mode = appMode.appMode.DESKTOP
|
|
72
63
|
geode_store.default_local_port = "12"
|
|
73
64
|
expect(geode_store.port).toBe("12")
|
|
@@ -76,15 +67,11 @@ describe("Geode store", () => {
|
|
|
76
67
|
|
|
77
68
|
describe("base_url", () => {
|
|
78
69
|
test("test app_mode BROWSER", () => {
|
|
79
|
-
const infra_store = useInfraStore()
|
|
80
|
-
const geode_store = useGeodeStore()
|
|
81
70
|
infra_store.app_mode = appMode.appMode.BROWSER
|
|
82
71
|
infra_store.domain_name = "localhost"
|
|
83
72
|
expect(geode_store.base_url).toBe("http://localhost:5000")
|
|
84
73
|
})
|
|
85
74
|
test("test app_mode CLOUD", () => {
|
|
86
|
-
const infra_store = useInfraStore()
|
|
87
|
-
const geode_store = useGeodeStore()
|
|
88
75
|
infra_store.app_mode = appMode.appMode.CLOUD
|
|
89
76
|
infra_store.ID = "123456"
|
|
90
77
|
infra_store.domain_name = "example.com"
|
|
@@ -93,8 +80,6 @@ describe("Geode store", () => {
|
|
|
93
80
|
)
|
|
94
81
|
})
|
|
95
82
|
test("test app_mode CLOUD, ID empty", () => {
|
|
96
|
-
const infra_store = useInfraStore()
|
|
97
|
-
const geode_store = useGeodeStore()
|
|
98
83
|
infra_store.app_mode = appMode.appMode.CLOUD
|
|
99
84
|
infra_store.ID = ""
|
|
100
85
|
infra_store.domain_name = "example.com"
|
|
@@ -106,12 +91,10 @@ describe("Geode store", () => {
|
|
|
106
91
|
|
|
107
92
|
describe("is_busy", () => {
|
|
108
93
|
test("test is_busy", () => {
|
|
109
|
-
const geode_store = useGeodeStore()
|
|
110
94
|
geode_store.request_counter = 1
|
|
111
95
|
expect(geode_store.is_busy).toBe(true)
|
|
112
96
|
})
|
|
113
97
|
test("test not is_busy", () => {
|
|
114
|
-
const geode_store = useGeodeStore()
|
|
115
98
|
geode_store.request_counter = 0
|
|
116
99
|
expect(geode_store.is_busy).toBe(false)
|
|
117
100
|
})
|
|
@@ -124,8 +107,6 @@ describe("Geode store", () => {
|
|
|
124
107
|
registerEndpoint(back_schemas.opengeodeweb_back.ping.$id, getFakeCall)
|
|
125
108
|
|
|
126
109
|
test("response", async () => {
|
|
127
|
-
const geode_store = useGeodeStore()
|
|
128
|
-
const feedback_store = useFeedbackStore()
|
|
129
110
|
geode_store.base_url = ""
|
|
130
111
|
getFakeCall.mockImplementation(() => ({}))
|
|
131
112
|
await geode_store.do_ping()
|
|
@@ -133,8 +114,6 @@ describe("Geode store", () => {
|
|
|
133
114
|
expect(feedback_store.server_error).toBe(false)
|
|
134
115
|
})
|
|
135
116
|
test("response_error", async () => {
|
|
136
|
-
const geode_store = useGeodeStore()
|
|
137
|
-
const feedback_store = useFeedbackStore()
|
|
138
117
|
geode_store.base_url = ""
|
|
139
118
|
getFakeCall.mockImplementation(() => {
|
|
140
119
|
throw createError({
|
|
@@ -150,7 +129,6 @@ describe("Geode store", () => {
|
|
|
150
129
|
|
|
151
130
|
describe("start_request", () => {
|
|
152
131
|
test("test increment", async () => {
|
|
153
|
-
const geode_store = useGeodeStore()
|
|
154
132
|
expect(geode_store.request_counter).toBe(0)
|
|
155
133
|
await geode_store.start_request()
|
|
156
134
|
expect(geode_store.request_counter).toBe(1)
|
|
@@ -158,7 +136,6 @@ describe("Geode store", () => {
|
|
|
158
136
|
})
|
|
159
137
|
describe("stop_request", () => {
|
|
160
138
|
test("test decrement", async () => {
|
|
161
|
-
const geode_store = useGeodeStore()
|
|
162
139
|
geode_store.request_counter = 1
|
|
163
140
|
await geode_store.stop_request()
|
|
164
141
|
expect(geode_store.request_counter).toBe(0)
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Third party imports
|
|
1
|
+
import { describe, test, expect, expectTypeOf, beforeEach, vi } from "vitest"
|
|
4
2
|
import { registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
5
3
|
import { setActivePinia } from "pinia"
|
|
6
4
|
import { createTestingPinia } from "@pinia/testing"
|
|
7
|
-
import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
|
|
8
|
-
// Local imports
|
|
9
5
|
import Status from "@ogw_f/utils/status.js"
|
|
10
6
|
|
|
11
7
|
// Mock navigator.locks API
|
|
@@ -20,18 +16,24 @@ vi.stubGlobal("navigator", {
|
|
|
20
16
|
},
|
|
21
17
|
})
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
describe("Infra Store", () => {
|
|
24
20
|
const pinia = createTestingPinia({
|
|
25
21
|
stubActions: false,
|
|
26
|
-
createSpy: vi.fn,
|
|
27
22
|
})
|
|
28
23
|
setActivePinia(pinia)
|
|
29
|
-
|
|
24
|
+
const infra_store = use_infra_store()
|
|
25
|
+
const geode_store = use_geode_store()
|
|
26
|
+
const viewer_store = use_viewer_store()
|
|
27
|
+
const feedback_store = use_feedback_store()
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
infra_store.$reset()
|
|
31
|
+
geode_store.$reset()
|
|
32
|
+
feedback_store.$reset()
|
|
33
|
+
viewer_store.$reset()
|
|
34
|
+
})
|
|
32
35
|
describe("state", () => {
|
|
33
36
|
test("initial state", () => {
|
|
34
|
-
const infra_store = useInfraStore()
|
|
35
37
|
expectTypeOf(infra_store.ID).toBeString()
|
|
36
38
|
expectTypeOf(infra_store.is_captcha_validated).toBeBoolean()
|
|
37
39
|
expectTypeOf(infra_store.status).toBeString()
|
|
@@ -40,24 +42,20 @@ describe("Infra Store", () => {
|
|
|
40
42
|
describe("getters", () => {
|
|
41
43
|
describe("app_mode", () => {
|
|
42
44
|
test("test type", () => {
|
|
43
|
-
const infra_store = useInfraStore()
|
|
44
45
|
expectTypeOf(infra_store.app_mode).toBeString()
|
|
45
46
|
})
|
|
46
47
|
})
|
|
47
48
|
|
|
48
49
|
describe("domain_name", () => {
|
|
49
50
|
test("test app_mode BROWSER", () => {
|
|
50
|
-
const infra_store = useInfraStore()
|
|
51
51
|
infra_store.app_mode = appMode.appMode.BROWSER
|
|
52
52
|
expect(infra_store.domain_name).toBe("localhost")
|
|
53
53
|
})
|
|
54
54
|
test("test app_mode DESKTOP", () => {
|
|
55
|
-
const infra_store = useInfraStore()
|
|
56
55
|
infra_store.app_mode = appMode.appMode.DESKTOP
|
|
57
56
|
expect(infra_store.domain_name).toBe("localhost")
|
|
58
57
|
})
|
|
59
58
|
test("test app_mode CLOUD", () => {
|
|
60
|
-
const infra_store = useInfraStore()
|
|
61
59
|
infra_store.app_mode = appMode.appMode.CLOUD
|
|
62
60
|
expect(infra_store.domain_name).toBe("api.geode-solutions.com")
|
|
63
61
|
})
|
|
@@ -65,7 +63,6 @@ describe("Infra Store", () => {
|
|
|
65
63
|
|
|
66
64
|
describe("lambda_url", () => {
|
|
67
65
|
test("test is cloud true", () => {
|
|
68
|
-
const infra_store = useInfraStore()
|
|
69
66
|
useRuntimeConfig().public.SITE_BRANCH = "/test"
|
|
70
67
|
useRuntimeConfig().public.PROJECT = "/project"
|
|
71
68
|
infra_store.app_mode = appMode.appMode.CLOUD
|
|
@@ -76,33 +73,22 @@ describe("Infra Store", () => {
|
|
|
76
73
|
})
|
|
77
74
|
describe("status", () => {
|
|
78
75
|
test("test geode false & viewer false", () => {
|
|
79
|
-
const infra_store = useInfraStore()
|
|
80
|
-
const geode_store = useGeodeStore()
|
|
81
|
-
const viewer_store = useViewerStore()
|
|
82
76
|
geode_store.$patch({ status: Status.NOT_CONNECTED })
|
|
83
77
|
viewer_store.$patch({ status: Status.NOT_CONNECTED })
|
|
78
|
+
console.log("Status", Status)
|
|
84
79
|
expect(infra_store.microservices_connected).toBe(false)
|
|
85
80
|
})
|
|
86
81
|
test("test geode true & viewer false", () => {
|
|
87
|
-
const infra_store = useInfraStore()
|
|
88
|
-
const geode_store = useGeodeStore()
|
|
89
|
-
const viewer_store = useViewerStore()
|
|
90
82
|
geode_store.$patch({ status: Status.CONNECTED })
|
|
91
83
|
viewer_store.$patch({ status: Status.NOT_CONNECTED })
|
|
92
84
|
expect(infra_store.microservices_connected).toBe(false)
|
|
93
85
|
})
|
|
94
86
|
test("test geode false & viewer true", () => {
|
|
95
|
-
const infra_store = useInfraStore()
|
|
96
|
-
const geode_store = useGeodeStore()
|
|
97
|
-
const viewer_store = useViewerStore()
|
|
98
87
|
geode_store.$patch({ status: Status.NOT_CONNECTED })
|
|
99
88
|
viewer_store.$patch({ status: Status.CONNECTED })
|
|
100
89
|
expect(infra_store.microservices_connected).toBe(false)
|
|
101
90
|
})
|
|
102
91
|
test("test geode true & viewer true", () => {
|
|
103
|
-
const infra_store = useInfraStore()
|
|
104
|
-
const geode_store = useGeodeStore()
|
|
105
|
-
const viewer_store = useViewerStore()
|
|
106
92
|
geode_store.$patch({ status: Status.CONNECTED })
|
|
107
93
|
viewer_store.$patch({ status: Status.CONNECTED })
|
|
108
94
|
expect(infra_store.microservices_connected).toBe(true)
|
|
@@ -111,33 +97,21 @@ describe("Infra Store", () => {
|
|
|
111
97
|
|
|
112
98
|
describe("is_busy", () => {
|
|
113
99
|
test("test geode false & viewer false", () => {
|
|
114
|
-
const infra_store = useInfraStore()
|
|
115
|
-
const geode_store = useGeodeStore()
|
|
116
|
-
const viewer_store = useViewerStore()
|
|
117
100
|
geode_store.$patch({ request_counter: 0 })
|
|
118
101
|
viewer_store.$patch({ request_counter: 0 })
|
|
119
102
|
expect(infra_store.microservices_busy).toBe(false)
|
|
120
103
|
})
|
|
121
104
|
test("test geode true & viewer false", () => {
|
|
122
|
-
const infra_store = useInfraStore()
|
|
123
|
-
const geode_store = useGeodeStore()
|
|
124
|
-
const viewer_store = useViewerStore()
|
|
125
105
|
geode_store.$patch({ request_counter: 1 })
|
|
126
106
|
viewer_store.$patch({ request_counter: 0 })
|
|
127
107
|
expect(infra_store.microservices_busy).toBe(true)
|
|
128
108
|
})
|
|
129
109
|
test("test geode false & viewer true", () => {
|
|
130
|
-
const infra_store = useInfraStore()
|
|
131
|
-
const geode_store = useGeodeStore()
|
|
132
|
-
const viewer_store = useViewerStore()
|
|
133
110
|
geode_store.$patch({ request_counter: 0 })
|
|
134
111
|
viewer_store.$patch({ request_counter: 1 })
|
|
135
112
|
expect(infra_store.microservices_busy).toBe(true)
|
|
136
113
|
})
|
|
137
114
|
test("test geode true & viewer true", () => {
|
|
138
|
-
const infra_store = useInfraStore()
|
|
139
|
-
const geode_store = useGeodeStore()
|
|
140
|
-
const viewer_store = useViewerStore()
|
|
141
115
|
geode_store.$patch({ request_counter: 1 })
|
|
142
116
|
viewer_store.$patch({ request_counter: 1 })
|
|
143
117
|
expect(infra_store.microservices_busy).toBe(true)
|
|
@@ -148,30 +122,23 @@ describe("Infra Store", () => {
|
|
|
148
122
|
describe("actions", () => {
|
|
149
123
|
describe("create_backend", () => {
|
|
150
124
|
test("test without end-point", async () => {
|
|
151
|
-
const infra_store = useInfraStore()
|
|
152
|
-
const geode_store = useGeodeStore()
|
|
153
|
-
const viewer_store = useViewerStore()
|
|
154
125
|
await infra_store.create_backend()
|
|
126
|
+
console.log("geode_store.status", geode_store.status)
|
|
155
127
|
expect(infra_store.status).toBe(Status.NOT_CREATED)
|
|
156
128
|
expect(geode_store.status).toBe(Status.NOT_CONNECTED)
|
|
157
129
|
expect(viewer_store.status).toBe(Status.NOT_CONNECTED)
|
|
158
130
|
})
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// expect(infra_store.status).toBe(Status.CREATED)
|
|
171
|
-
// expect(geode_store.status).toBe(Status.NOT_CONNECTED)
|
|
172
|
-
// expect(viewer_store.status).toBe(Status.NOT_CONNECTED)
|
|
173
|
-
// expect(feedback_store.server_error).toBe(true)
|
|
174
|
-
// })
|
|
131
|
+
test("test with end-point", async () => {
|
|
132
|
+
registerEndpoint(infra_store.lambda_url, {
|
|
133
|
+
method: "POST",
|
|
134
|
+
handler: () => ({ ID: "123456" }),
|
|
135
|
+
})
|
|
136
|
+
await infra_store.create_backend()
|
|
137
|
+
expect(infra_store.status).toBe(Status.CREATED)
|
|
138
|
+
expect(geode_store.status).toBe(Status.NOT_CONNECTED)
|
|
139
|
+
expect(viewer_store.status).toBe(Status.NOT_CONNECTED)
|
|
140
|
+
expect(feedback_store.server_error).toBe(true)
|
|
141
|
+
})
|
|
175
142
|
})
|
|
176
143
|
})
|
|
177
144
|
})
|