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