@geode/opengeodeweb-front 6.2.1-rc.1 → 6.3.0-rc.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/.github/workflows/CD.yml +6 -0
- package/assets/geode_objects.js +46 -46
- package/assets/img/geode_objects/{section.svg → Section.svg} +1 -1
- package/components/Carousel.vue +1 -5
- package/components/CrsSelector.vue +1 -3
- package/components/ExtensionSelector.vue +76 -75
- package/components/FileSelector.vue +2 -3
- package/components/FileUploader.vue +2 -3
- package/components/MissingFilesSelector.vue +19 -19
- package/components/ObjectSelector.vue +21 -17
- package/components/PackagesVersions.vue +24 -23
- package/components/Wrapper.vue +1 -8
- package/composables/api_fetch.js +2 -7
- package/composables/runFunctionIfCloudRunning.js +1 -2
- package/composables/upload_file.js +4 -1
- package/nuxt.config.js +29 -1
- package/package.json +29 -13
- package/stores/cloud.js +19 -8
- package/stores/geode.js +7 -5
- package/test/components/CrsSelector.nuxt.test.js +51 -0
- package/test/components/ErrorsBanner.nuxt.test.js +46 -0
- package/test/components/ErrorsSnackers.nuxt.test.js +37 -0
- package/test/components/ExtensionSelector.nuxt.test.js +51 -0
- package/test/components/FileSelector.nuxt.test.js +58 -0
- package/test/components/FileUploader.nuxt.test.js +42 -0
- package/test/components/Launcher.nuxt.test.js +34 -0
- package/test/components/MissingFilesSelector.nuxt.test.js +67 -0
- package/test/components/ObjectSelector.nuxt.test.js +50 -0
- package/test/components/PackagesVersions.nuxt.test.js +47 -0
- package/test/components/Step.nuxt.test.js +58 -0
- package/test/components/Stepper.nuxt.test.js +58 -0
- package/test/components/Wrapper.nuxt.test.js +58 -0
- package/test/composables/api_fetch.nuxt.test.js +119 -0
- package/test/composables/runFunctionIfCloudRunning.nuxt.test.js +30 -0
- package/test/composables/upload_file.nuxt.test.js +51 -0
- package/test/stores/Cloud.nuxt.test.js +48 -0
- package/test/stores/Errors.test.js +36 -0
- package/test/stores/Geode.test.js +60 -0
- package/vitest.config.js +13 -0
- package/vuetify_config.js +22 -0
- package/assets/img/geode_objects/regular_grid.svg +0 -107
- package/assets/img/logos/LOGOMOSART-PME.png +0 -0
- package/assets/img/logos/logo-avenia.svg +0 -182
- package/assets/img/logos/logo_BSC.png +0 -0
- package/assets/img/logos/logo_DHI.png +0 -0
- package/assets/img/logos/logo_GSC.png +0 -0
- package/assets/img/logos/logo_NAOS.png +0 -0
- package/assets/img/logos/logo_UL.png +0 -0
- package/assets/img/logos/logo_arxitek.png +0 -0
- package/assets/img/logos/logo_banquiz.png +0 -0
- package/assets/img/logos/logo_cnrs.jpg +0 -0
- package/assets/img/logos/logo_earth_quick.jpg +0 -0
- package/assets/img/logos/logo_enerex.png +0 -0
- package/assets/img/logos/logo_geoliens.png +0 -0
- package/assets/img/logos/logo_georessources.jpg +0 -0
- package/assets/img/logos/logo_helioparc.svg +0 -182
- package/assets/img/logos/logo_pole_avenia.png +0 -0
- package/assets/img/logos/logo_region.png +0 -0
- package/assets/img/logos/logo_ring.png +0 -0
- package/assets/img/logos/logo_totalenergies.png +0 -0
- package/components/Header.vue +0 -39
- /package/assets/img/geode_objects/{cross_section.svg → CrossSection.svg} +0 -0
- /package/assets/img/geode_objects/{edged_curve2d.svg → EdgedCurve2D.svg} +0 -0
- /package/assets/img/geode_objects/{edged_curve3d.svg → EdgedCurve3D.svg} +0 -0
- /package/assets/img/geode_objects/{edged_curve.svg → Graph.svg} +0 -0
- /package/assets/img/geode_objects/{hybrid_solid.svg → HybridSolid3D.svg} +0 -0
- /package/assets/img/geode_objects/{light_regular_grid2d.svg → LightRegularGrid2D.svg} +0 -0
- /package/assets/img/geode_objects/{light_regular_grid3d.svg → LightRegularGrid3D.svg} +0 -0
- /package/assets/img/geode_objects/{point_set2d.svg → PointSet2D.svg} +0 -0
- /package/assets/img/geode_objects/{point_set3d.svg → PointSet3D.svg} +0 -0
- /package/assets/img/geode_objects/{polygonal_surface2d.svg → PolygonalSurface2D.svg} +0 -0
- /package/assets/img/geode_objects/{polygonal_surface3d.svg → PolygonalSurface3D.svg} +0 -0
- /package/assets/img/geode_objects/{polyhedral_solid.svg → PolyhedralSolid3D.svg} +0 -0
- /package/assets/img/geode_objects/{raster_image2d.svg → RasterImage2D.svg} +0 -0
- /package/assets/img/geode_objects/{raster_image3d.svg → RasterImage3D.svg} +0 -0
- /package/assets/img/geode_objects/{regular_grid2d.svg → RegularGrid2D.svg} +0 -0
- /package/assets/img/geode_objects/{regular_grid3d.svg → RegularGrid3D.svg} +0 -0
- /package/assets/img/geode_objects/{structural_model.svg → StructuralModel.svg} +0 -0
- /package/assets/img/geode_objects/{tetrahedral_solid.svg → TetrahedralSolid3D.svg} +0 -0
- /package/assets/img/geode_objects/{triangulated_surface2d.svg → TriangulatedSurface2D.svg} +0 -0
- /package/assets/img/geode_objects/{triangulated_surface3d.svg → TriangulatedSurface3D.svg} +0 -0
- /package/assets/img/geode_objects/{vertex_set.svg → VertexSet.svg} +0 -0
package/components/Wrapper.vue
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-container>
|
|
3
3
|
<v-row class="flex-column">
|
|
4
|
-
<v-col>
|
|
5
|
-
<Header :tool_name="tool_name" :cards_list="cards_list" />
|
|
6
|
-
</v-col>
|
|
7
4
|
<v-col v-if="!is_running">
|
|
8
5
|
<Launcher />
|
|
9
6
|
</v-col>
|
|
@@ -23,10 +20,6 @@
|
|
|
23
20
|
|
|
24
21
|
const props = defineProps({
|
|
25
22
|
versions_schema: { type: Object, required: true },
|
|
26
|
-
cards_list: { type: Array, required: true },
|
|
27
23
|
})
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
const stepper_tree = inject("stepper_tree")
|
|
31
|
-
const { tool_name } = stepper_tree
|
|
24
|
+
const { versions_schema } = props
|
|
32
25
|
</script>
|
package/composables/api_fetch.js
CHANGED
|
@@ -17,14 +17,13 @@ export function api_fetch(
|
|
|
17
17
|
const valid = ajv.validate(schema, body)
|
|
18
18
|
if (!valid) {
|
|
19
19
|
errors_store.add_error({
|
|
20
|
-
code:
|
|
20
|
+
code: 400,
|
|
21
21
|
route: schema.$id,
|
|
22
22
|
name: "Bad request",
|
|
23
23
|
description: ajv.errorsText(),
|
|
24
24
|
})
|
|
25
|
-
|
|
25
|
+
throw new Error(schema.$id.concat(": ", ajv.errorsText()))
|
|
26
26
|
}
|
|
27
|
-
|
|
28
27
|
geode_store.start_request()
|
|
29
28
|
|
|
30
29
|
const request_options = { method: schema["method"] }
|
|
@@ -35,12 +34,10 @@ export function api_fetch(
|
|
|
35
34
|
if (schema.max_retry) {
|
|
36
35
|
request_options.max_retry = schema.max_retry
|
|
37
36
|
}
|
|
38
|
-
|
|
39
37
|
return useFetch(schema.$id, {
|
|
40
38
|
baseURL: geode_store.base_url,
|
|
41
39
|
...request_options,
|
|
42
40
|
onRequestError({ error }) {
|
|
43
|
-
// console.log("onRequestError", error)
|
|
44
41
|
geode_store.stop_request()
|
|
45
42
|
errors_store.add_error({
|
|
46
43
|
code: error.code,
|
|
@@ -53,7 +50,6 @@ export function api_fetch(
|
|
|
53
50
|
}
|
|
54
51
|
},
|
|
55
52
|
onResponse({ response }) {
|
|
56
|
-
// console.log(response)
|
|
57
53
|
if (response.ok) {
|
|
58
54
|
geode_store.stop_request()
|
|
59
55
|
if (response_function) {
|
|
@@ -62,7 +58,6 @@ export function api_fetch(
|
|
|
62
58
|
}
|
|
63
59
|
},
|
|
64
60
|
onResponseError({ response }) {
|
|
65
|
-
// console.log(response)
|
|
66
61
|
geode_store.stop_request()
|
|
67
62
|
errors_store.add_error({
|
|
68
63
|
code: response.status,
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
export function upload_file(
|
|
1
|
+
export async function upload_file(
|
|
2
2
|
{ route, file },
|
|
3
3
|
{ request_error_function, response_function, response_error_function } = {},
|
|
4
4
|
) {
|
|
5
5
|
const errors_store = use_errors_store()
|
|
6
6
|
const geode_store = use_geode_store()
|
|
7
|
+
if (!(file instanceof File)) {
|
|
8
|
+
throw new Error("file must be a instance of File")
|
|
9
|
+
}
|
|
7
10
|
|
|
8
11
|
const body = new FormData()
|
|
9
12
|
body.append("file", file)
|
package/nuxt.config.js
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
export default defineNuxtConfig({
|
|
2
|
+
runtimeConfig: {
|
|
3
|
+
public: {
|
|
4
|
+
VIEWER_PROTOCOL: process.env.NODE_ENV === "production" ? "wss" : "ws",
|
|
5
|
+
GEODE_PROTOCOL: process.env.NODE_ENV === "production" ? "https" : "http",
|
|
6
|
+
VIEWER_PORT: process.env.NODE_ENV === "production" ? "443" : "1234",
|
|
7
|
+
GEODE_PORT: process.env.NODE_ENV === "production" ? "443" : "5000",
|
|
8
|
+
SITE_BRANCH:
|
|
9
|
+
process.env.NODE_ENV === "production" ? process.env.SITE_BRANCH : "",
|
|
10
|
+
PROJECT: process.env.NODE_ENV === "production" ? process.env.PROJECT : "",
|
|
11
|
+
NODE_ENV: process.env.NODE_ENV,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
modules: [["@pinia/nuxt", { autoImports: ["defineStore"] }], "@vueuse/nuxt"],
|
|
2
16
|
imports: {
|
|
3
17
|
dirs: ["stores"],
|
|
4
18
|
},
|
|
5
19
|
|
|
6
|
-
|
|
20
|
+
// ** Global CSS
|
|
21
|
+
css: ["vuetify/lib/styles/main.sass"],
|
|
22
|
+
|
|
23
|
+
// ** Build configuration
|
|
24
|
+
build: {
|
|
25
|
+
transpile: ["vuetify"],
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
vue: {
|
|
29
|
+
compilerOptions: {
|
|
30
|
+
isCustomElement: (tag) => ["md-linedivider"].includes(tag),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
testUtils: {},
|
|
7
35
|
})
|
package/package.json
CHANGED
|
@@ -1,40 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geode/opengeodeweb-front",
|
|
3
3
|
"scripts": {
|
|
4
|
-
"lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore ."
|
|
4
|
+
"lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore .",
|
|
5
|
+
"test": "vitest",
|
|
6
|
+
"coverage": "vitest run --coverage"
|
|
5
7
|
},
|
|
6
8
|
"devDependencies": {
|
|
9
|
+
"@nuxt/test-utils": "^3.11.0",
|
|
10
|
+
"@vitejs/plugin-vue": "^5.0.3",
|
|
11
|
+
"@vitest/coverage-v8": "^1.2.2",
|
|
12
|
+
"@vue/test-utils": "^2.4.4",
|
|
7
13
|
"eslint": "^8.56.0",
|
|
8
14
|
"eslint-plugin-import": "^2.29.1",
|
|
9
15
|
"eslint-plugin-nuxt": "^4.0.0",
|
|
10
|
-
"eslint-plugin-prettier": "^5.
|
|
16
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
11
17
|
"eslint-plugin-prettier-vue": "^5.0.0",
|
|
12
|
-
"eslint-plugin-vue": "^9.
|
|
18
|
+
"eslint-plugin-vue": "^9.21.0",
|
|
13
19
|
"eslint-plugin-vuetify": "^2.1.1",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
20
|
+
"happy-dom": "^13.3.8",
|
|
21
|
+
"jsdom": "^24.0.0",
|
|
22
|
+
"nuxt": "^3.10.0",
|
|
23
|
+
"playwright-core": "^1.41.1",
|
|
24
|
+
"prettier": "3.2.4",
|
|
25
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
26
|
+
"vite": "^5.0.12",
|
|
27
|
+
"vite-plugin-vuetify": "^2.0.1",
|
|
28
|
+
"vitest": "^1.2.2",
|
|
29
|
+
"vitest-environment-nuxt": "^1.0.0"
|
|
16
30
|
},
|
|
17
31
|
"overrides": {
|
|
18
32
|
"vue": "latest"
|
|
19
33
|
},
|
|
20
34
|
"description": "OpenSource Vue/Vuetify framework for web applications",
|
|
21
35
|
"type": "module",
|
|
22
|
-
"version": "6.
|
|
36
|
+
"version": "6.3.0-rc.1",
|
|
23
37
|
"main": "./nuxt.config.js",
|
|
24
38
|
"dependencies": {
|
|
25
|
-
"@kitware/vtk.js": "^29.
|
|
26
|
-
"@mdi/font": "^7.
|
|
39
|
+
"@kitware/vtk.js": "^29.4.6",
|
|
40
|
+
"@mdi/font": "^7.4.47",
|
|
27
41
|
"@pinia/nuxt": "^0.5.1",
|
|
28
|
-
"@types/node": "^20.
|
|
29
|
-
"@vueuse/components": "^10.7.
|
|
30
|
-
"@vueuse/core": "^10.7.
|
|
42
|
+
"@types/node": "^20.11.13",
|
|
43
|
+
"@vueuse/components": "^10.7.2",
|
|
44
|
+
"@vueuse/core": "^10.7.2",
|
|
45
|
+
"@vueuse/nuxt": "^10.7.2",
|
|
31
46
|
"ajv": "^8.12.0",
|
|
32
47
|
"lodash": "^4.17.21",
|
|
33
48
|
"pinia": "^2.1.7",
|
|
34
|
-
"sass": "^1.
|
|
49
|
+
"sass": "^1.70.0",
|
|
35
50
|
"semver": "^7.5.4",
|
|
36
51
|
"vue-recaptcha": "^2.0.3",
|
|
37
|
-
"
|
|
52
|
+
"vue3-carousel": "^0.3.1",
|
|
53
|
+
"vuetify": "^3.5.1",
|
|
38
54
|
"wslink": "^1.12.4"
|
|
39
55
|
},
|
|
40
56
|
"repository": {
|
package/stores/cloud.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useStorage } from "@vueuse/core"
|
|
1
|
+
import { useFetch, useStorage } from "@vueuse/core"
|
|
2
2
|
|
|
3
3
|
export const use_cloud_store = defineStore("cloud", {
|
|
4
4
|
state: () => ({
|
|
@@ -7,6 +7,14 @@ export const use_cloud_store = defineStore("cloud", {
|
|
|
7
7
|
is_connexion_launched: false,
|
|
8
8
|
}),
|
|
9
9
|
getters: {
|
|
10
|
+
api_url: () => {
|
|
11
|
+
const public_runtime_config = useRuntimeConfig().public
|
|
12
|
+
if (public_runtime_config.NODE_ENV == "test") {
|
|
13
|
+
return ""
|
|
14
|
+
}
|
|
15
|
+
var api_url = `${public_runtime_config.GEODE_PROTOCOL}://${public_runtime_config.API_URL}:${public_runtime_config.GEODE_PORT}`
|
|
16
|
+
return api_url
|
|
17
|
+
},
|
|
10
18
|
is_running: () => {
|
|
11
19
|
return use_geode_store().is_running && use_websocket_store().is_running
|
|
12
20
|
},
|
|
@@ -31,7 +39,6 @@ export const use_cloud_store = defineStore("cloud", {
|
|
|
31
39
|
const { data, error } = await useFetch(`${geode_store.base_url}/ping`, {
|
|
32
40
|
method: "POST",
|
|
33
41
|
})
|
|
34
|
-
console.log("error", error)
|
|
35
42
|
if (data.value !== null) {
|
|
36
43
|
geode_store.is_running = true
|
|
37
44
|
return geode_store.ping_task()
|
|
@@ -43,16 +50,20 @@ export const use_cloud_store = defineStore("cloud", {
|
|
|
43
50
|
async create_backend() {
|
|
44
51
|
const geode_store = use_geode_store()
|
|
45
52
|
const errors_store = use_errors_store()
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
const public_runtime_config = useRuntimeConfig().public
|
|
54
|
+
const url = this.api_url.concat(
|
|
55
|
+
public_runtime_config.PROJECT,
|
|
56
|
+
public_runtime_config.SITE_BRANCH,
|
|
57
|
+
"/createbackend",
|
|
51
58
|
)
|
|
59
|
+
const { data, error } = await useFetch(url, {
|
|
60
|
+
method: "POST",
|
|
61
|
+
})
|
|
52
62
|
if (data.value !== null) {
|
|
63
|
+
console.log("DATA", data)
|
|
53
64
|
this.ID = data.value.ID
|
|
54
65
|
localStorage.setItem("ID", data.value.ID)
|
|
55
|
-
geode_store
|
|
66
|
+
geode_store.$patch({ is_running: true })
|
|
56
67
|
return geode_store.ping_task()
|
|
57
68
|
} else {
|
|
58
69
|
console.log("error : ", error)
|
package/stores/geode.js
CHANGED
|
@@ -6,9 +6,10 @@ export const use_geode_store = defineStore("geode", {
|
|
|
6
6
|
getters: {
|
|
7
7
|
base_url: () => {
|
|
8
8
|
const cloud_store = use_cloud_store()
|
|
9
|
+
const api_url = cloud_store.api_url
|
|
10
|
+
var geode_url = `${api_url}`
|
|
9
11
|
const public_runtime_config = useRuntimeConfig().public
|
|
10
|
-
|
|
11
|
-
if (process.env.NODE_ENV == "production") {
|
|
12
|
+
if (public_runtime_config.NODE_ENV == "production") {
|
|
12
13
|
geode_url += `/${cloud_store.ID}/geode`
|
|
13
14
|
}
|
|
14
15
|
return geode_url
|
|
@@ -23,14 +24,15 @@ export const use_geode_store = defineStore("geode", {
|
|
|
23
24
|
},
|
|
24
25
|
async do_ping() {
|
|
25
26
|
const errors_store = use_errors_store()
|
|
26
|
-
const { data
|
|
27
|
+
const { data } = await useFetch(`${this.base_url}/ping`, {
|
|
27
28
|
method: "POST",
|
|
28
29
|
})
|
|
29
30
|
if (data.value !== null) {
|
|
30
31
|
this.is_running = true
|
|
32
|
+
return
|
|
31
33
|
} else {
|
|
32
|
-
errors_store
|
|
33
|
-
|
|
34
|
+
errors_store.$patch({ server_error: true })
|
|
35
|
+
return
|
|
34
36
|
}
|
|
35
37
|
},
|
|
36
38
|
start_request() {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @vitest-environment nuxt
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test } from "vitest"
|
|
4
|
+
import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
|
|
5
|
+
|
|
6
|
+
import { createVuetify } from "vuetify"
|
|
7
|
+
import * as components from "vuetify/components"
|
|
8
|
+
import * as directives from "vuetify/directives"
|
|
9
|
+
|
|
10
|
+
import CrsSelector from "@/components/CrsSelector.vue"
|
|
11
|
+
import schema from "@/assets/schemas/CrsSelector.json"
|
|
12
|
+
|
|
13
|
+
const vuetify = createVuetify({
|
|
14
|
+
components,
|
|
15
|
+
directives,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
global.ResizeObserver = require("resize-observer-polyfill")
|
|
19
|
+
|
|
20
|
+
describe("CrsSelector.vue", async () => {
|
|
21
|
+
test(`BRep`, async () => {
|
|
22
|
+
const crs_list = [
|
|
23
|
+
{
|
|
24
|
+
authority: "EPSG",
|
|
25
|
+
code: "2000",
|
|
26
|
+
name: "Anguilla 1957 / British West Indies Grid",
|
|
27
|
+
},
|
|
28
|
+
]
|
|
29
|
+
registerEndpoint(schema.$id, {
|
|
30
|
+
method: schema.method,
|
|
31
|
+
handler: () => ({
|
|
32
|
+
crs_list,
|
|
33
|
+
}),
|
|
34
|
+
})
|
|
35
|
+
const key_to_update = "key"
|
|
36
|
+
const wrapper = await mountSuspended(CrsSelector, {
|
|
37
|
+
global: {
|
|
38
|
+
plugins: [vuetify],
|
|
39
|
+
},
|
|
40
|
+
props: { input_geode_object: "BRep", key_to_update },
|
|
41
|
+
})
|
|
42
|
+
const td = await wrapper.find("td")
|
|
43
|
+
const imput = await td.find("input")
|
|
44
|
+
await imput.trigger("click")
|
|
45
|
+
expect(wrapper.emitted()).toHaveProperty("update_values")
|
|
46
|
+
expect(wrapper.emitted().update_values).toHaveLength(1)
|
|
47
|
+
expect(wrapper.emitted().update_values[0][0]).toEqual({
|
|
48
|
+
[key_to_update]: crs_list[0],
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// @vitest-environment nuxt
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test, vi } from "vitest"
|
|
4
|
+
import { mount } from "@vue/test-utils"
|
|
5
|
+
import { createVuetify } from "vuetify"
|
|
6
|
+
import * as components from "vuetify/components"
|
|
7
|
+
import * as directives from "vuetify/directives"
|
|
8
|
+
|
|
9
|
+
import ErrorsBanner from "@/components/Errors/Banner.vue"
|
|
10
|
+
|
|
11
|
+
const vuetify = createVuetify({
|
|
12
|
+
components,
|
|
13
|
+
directives,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
describe("ErrorsBanner.vue", async () => {
|
|
17
|
+
test(`Test reload`, async () => {
|
|
18
|
+
const wrapper = mount(ErrorsBanner, {
|
|
19
|
+
global: {
|
|
20
|
+
plugins: [vuetify],
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
const reload_spy = vi.spyOn(wrapper.vm, "reload")
|
|
24
|
+
const errors_store = use_errors_store()
|
|
25
|
+
await errors_store.$patch({ server_error: true })
|
|
26
|
+
expect(errors_store.server_error).toBe(true)
|
|
27
|
+
const v_btn = wrapper.findAll(".v-btn")
|
|
28
|
+
await v_btn[0].trigger("click")
|
|
29
|
+
|
|
30
|
+
expect(reload_spy).toHaveBeenCalledTimes(1)
|
|
31
|
+
}),
|
|
32
|
+
test(`Test delete error`, async () => {
|
|
33
|
+
const wrapper = mount(ErrorsBanner, {
|
|
34
|
+
global: {
|
|
35
|
+
plugins: [vuetify],
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const errors_store = use_errors_store()
|
|
40
|
+
await errors_store.$patch({ server_error: true })
|
|
41
|
+
expect(errors_store.server_error).toBe(true)
|
|
42
|
+
const v_btn = wrapper.findAll(".v-btn")
|
|
43
|
+
await v_btn[1].trigger("click")
|
|
44
|
+
expect(errors_store.server_error).toBe(false)
|
|
45
|
+
})
|
|
46
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @vitest-environment nuxt
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test } from "vitest"
|
|
4
|
+
import { mount } from "@vue/test-utils"
|
|
5
|
+
import { createVuetify } from "vuetify"
|
|
6
|
+
import * as components from "vuetify/components"
|
|
7
|
+
import * as directives from "vuetify/directives"
|
|
8
|
+
|
|
9
|
+
import ErrorsSnackers from "@/components/Errors/Snackers.vue"
|
|
10
|
+
|
|
11
|
+
const vuetify = createVuetify({
|
|
12
|
+
components,
|
|
13
|
+
directives,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
describe("ErrorsSnackers.vue", async () => {
|
|
17
|
+
test(`Test delete error`, async () => {
|
|
18
|
+
const wrapper = await mount(ErrorsSnackers, {
|
|
19
|
+
global: {
|
|
20
|
+
plugins: [vuetify],
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const errors_store = use_errors_store()
|
|
25
|
+
const error = {
|
|
26
|
+
code: 404,
|
|
27
|
+
route: "/test",
|
|
28
|
+
name: "Test message",
|
|
29
|
+
description: "Test desription",
|
|
30
|
+
}
|
|
31
|
+
await errors_store.add_error(error)
|
|
32
|
+
expect(errors_store.errors.length).toBe(1)
|
|
33
|
+
const v_btn = wrapper.findComponent(components.VBtn)
|
|
34
|
+
await v_btn.trigger("click")
|
|
35
|
+
expect(errors_store.errors.length).toBe(0)
|
|
36
|
+
})
|
|
37
|
+
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @vitest-environment nuxt
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test } from "vitest"
|
|
4
|
+
import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
|
|
5
|
+
|
|
6
|
+
import { createVuetify } from "vuetify"
|
|
7
|
+
import * as components from "vuetify/components"
|
|
8
|
+
import * as directives from "vuetify/directives"
|
|
9
|
+
|
|
10
|
+
import ExtensionSelector from "@/components/ExtensionSelector.vue"
|
|
11
|
+
import schema from "@/assets/schemas/ExtensionSelector.json"
|
|
12
|
+
import { flushPromises } from "@vue/test-utils"
|
|
13
|
+
|
|
14
|
+
const vuetify = createVuetify({
|
|
15
|
+
components,
|
|
16
|
+
directives,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
global.ResizeObserver = require("resize-observer-polyfill")
|
|
20
|
+
|
|
21
|
+
describe("ExtensionSelector.vue", async () => {
|
|
22
|
+
test(`Select geode_object & extension`, async () => {
|
|
23
|
+
const output_geode_object = "BRep"
|
|
24
|
+
const output_extension = "msh"
|
|
25
|
+
|
|
26
|
+
registerEndpoint(schema.$id, {
|
|
27
|
+
method: schema.method,
|
|
28
|
+
handler: () => ({
|
|
29
|
+
geode_objects_and_output_extensions: {
|
|
30
|
+
BRep: { msh: { is_saveable: true } },
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
})
|
|
34
|
+
const wrapper = await mountSuspended(ExtensionSelector, {
|
|
35
|
+
global: {
|
|
36
|
+
plugins: [vuetify],
|
|
37
|
+
},
|
|
38
|
+
props: { input_geode_object: "BRep", filenames: ["test.toto"] },
|
|
39
|
+
})
|
|
40
|
+
await nextTick()
|
|
41
|
+
expect(wrapper.exists()).toBe(true)
|
|
42
|
+
const v_card = await wrapper.findAllComponents(components.VCard)
|
|
43
|
+
await v_card[1].trigger("click")
|
|
44
|
+
expect(wrapper.emitted()).toHaveProperty("update_values")
|
|
45
|
+
expect(wrapper.emitted().update_values).toHaveLength(1)
|
|
46
|
+
expect(wrapper.emitted().update_values[0][0]).toEqual({
|
|
47
|
+
output_geode_object,
|
|
48
|
+
output_extension,
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
})
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// @vitest-environment nuxt
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test } from "vitest"
|
|
4
|
+
import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
|
|
5
|
+
import { flushPromises } from "@vue/test-utils"
|
|
6
|
+
|
|
7
|
+
import { createVuetify } from "vuetify"
|
|
8
|
+
import * as components from "vuetify/components"
|
|
9
|
+
import * as directives from "vuetify/directives"
|
|
10
|
+
|
|
11
|
+
import FileSelector from "@/components/FileSelector.vue"
|
|
12
|
+
import FileUploader from "@/components/FileUploader.vue"
|
|
13
|
+
import schema from "@/assets/schemas/FileSelector.json"
|
|
14
|
+
|
|
15
|
+
const vuetify = createVuetify({
|
|
16
|
+
components,
|
|
17
|
+
directives,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
global.ResizeObserver = require("resize-observer-polyfill")
|
|
21
|
+
|
|
22
|
+
describe("FileSelector.vue", async () => {
|
|
23
|
+
test(`Select file`, async () => {
|
|
24
|
+
registerEndpoint(schema.$id, {
|
|
25
|
+
method: schema.method,
|
|
26
|
+
handler: () => ({
|
|
27
|
+
extensions: ["1", "2", "3"],
|
|
28
|
+
}),
|
|
29
|
+
})
|
|
30
|
+
const wrapper = await mountSuspended(FileSelector, {
|
|
31
|
+
global: {
|
|
32
|
+
plugins: [vuetify],
|
|
33
|
+
},
|
|
34
|
+
props: { multiple: false, key: "test", route: "/upload" },
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const file_uploader = wrapper.findComponent(FileUploader)
|
|
38
|
+
|
|
39
|
+
registerEndpoint("/upload", {
|
|
40
|
+
method: "PUT",
|
|
41
|
+
handler: () => ({}),
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const v_file_input = file_uploader.findComponent(components.VFileInput)
|
|
45
|
+
await v_file_input.trigger("click")
|
|
46
|
+
const files = [new File(["fake_file"], "fake_file.txt")]
|
|
47
|
+
await v_file_input.setValue(files)
|
|
48
|
+
await v_file_input.trigger("change")
|
|
49
|
+
const v_btn = wrapper.findComponent(components.VBtn)
|
|
50
|
+
await v_btn.trigger("click")
|
|
51
|
+
await flushPromises()
|
|
52
|
+
expect(wrapper.emitted()).toHaveProperty("update_values")
|
|
53
|
+
expect(wrapper.emitted().update_values).toHaveLength(1)
|
|
54
|
+
expect(wrapper.emitted().update_values[0][0]).toEqual({
|
|
55
|
+
files,
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
})
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @vitest-environment nuxt
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test } from "vitest"
|
|
4
|
+
import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
|
|
5
|
+
import { flushPromises } from "@vue/test-utils"
|
|
6
|
+
|
|
7
|
+
import { createVuetify } from "vuetify"
|
|
8
|
+
import * as components from "vuetify/components"
|
|
9
|
+
import * as directives from "vuetify/directives"
|
|
10
|
+
|
|
11
|
+
import FileUploader from "@/components/FileUploader.vue"
|
|
12
|
+
|
|
13
|
+
const vuetify = createVuetify({
|
|
14
|
+
components,
|
|
15
|
+
directives,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
global.ResizeObserver = require("resize-observer-polyfill")
|
|
19
|
+
|
|
20
|
+
describe("FileUploader.vue", async () => {
|
|
21
|
+
test(`Upload file`, async () => {
|
|
22
|
+
registerEndpoint("/upload", {
|
|
23
|
+
method: "PUT",
|
|
24
|
+
handler: () => ({}),
|
|
25
|
+
})
|
|
26
|
+
const wrapper = await mountSuspended(FileUploader, {
|
|
27
|
+
global: {
|
|
28
|
+
plugins: [vuetify],
|
|
29
|
+
},
|
|
30
|
+
props: { multiple: false, accept: "*.txt", route: "/upload" },
|
|
31
|
+
})
|
|
32
|
+
const v_file_input = wrapper.findComponent(components.VFileInput)
|
|
33
|
+
await v_file_input.trigger("click")
|
|
34
|
+
const files = [new File(["fake_file"], "fake_file.txt")]
|
|
35
|
+
await v_file_input.setValue(files)
|
|
36
|
+
await v_file_input.trigger("change")
|
|
37
|
+
const v_btn = wrapper.findComponent(components.VBtn)
|
|
38
|
+
await v_btn.trigger("click")
|
|
39
|
+
await flushPromises()
|
|
40
|
+
expect(wrapper.emitted().files_uploaded[0][0]).toEqual(files)
|
|
41
|
+
})
|
|
42
|
+
})
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @vitest-environment nuxt
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test, vi } from "vitest"
|
|
4
|
+
import { flushPromises, mount } from "@vue/test-utils"
|
|
5
|
+
|
|
6
|
+
import { createVuetify } from "vuetify"
|
|
7
|
+
import * as components from "vuetify/components"
|
|
8
|
+
import * as directives from "vuetify/directives"
|
|
9
|
+
|
|
10
|
+
import Launcher from "@/components/Launcher.vue"
|
|
11
|
+
|
|
12
|
+
const vuetify = createVuetify({
|
|
13
|
+
components,
|
|
14
|
+
directives,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const cloud_store = use_cloud_store()
|
|
18
|
+
|
|
19
|
+
global.ResizeObserver = require("resize-observer-polyfill")
|
|
20
|
+
|
|
21
|
+
describe("Launcher.vue", async () => {
|
|
22
|
+
test(`Mount`, async () => {
|
|
23
|
+
const spy_cloud_store = vi.spyOn(cloud_store, "create_connexion")
|
|
24
|
+
const wrapper = mount(Launcher, {
|
|
25
|
+
global: {
|
|
26
|
+
plugins: [vuetify],
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
expect(wrapper.exists()).toBe(true)
|
|
30
|
+
await cloud_store.$patch({ is_captcha_validated: true })
|
|
31
|
+
flushPromises()
|
|
32
|
+
expect(spy_cloud_store).toHaveBeenCalled()
|
|
33
|
+
})
|
|
34
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// @vitest-environment nuxt
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test } from "vitest"
|
|
4
|
+
import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
|
|
5
|
+
import { flushPromises } from "@vue/test-utils"
|
|
6
|
+
|
|
7
|
+
import { createVuetify } from "vuetify"
|
|
8
|
+
import * as components from "vuetify/components"
|
|
9
|
+
import * as directives from "vuetify/directives"
|
|
10
|
+
|
|
11
|
+
import MissingFilesSelector from "@/components/MissingFilesSelector.vue"
|
|
12
|
+
import FileUploader from "@/components/FileUploader.vue"
|
|
13
|
+
|
|
14
|
+
import schema from "@/assets/schemas/MissingFilesSelector.json"
|
|
15
|
+
|
|
16
|
+
const vuetify = createVuetify({
|
|
17
|
+
components,
|
|
18
|
+
directives,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
global.ResizeObserver = require("resize-observer-polyfill")
|
|
22
|
+
|
|
23
|
+
describe("MissingFilesSelector.vue", async () => {
|
|
24
|
+
test(`Select file`, async () => {
|
|
25
|
+
registerEndpoint(schema.$id, {
|
|
26
|
+
method: schema.method,
|
|
27
|
+
handler: () => ({
|
|
28
|
+
has_missing_files: true,
|
|
29
|
+
mandatory_files: ["fake_file.txt"],
|
|
30
|
+
additional_files: ["fake_file_2.txt"],
|
|
31
|
+
}),
|
|
32
|
+
})
|
|
33
|
+
const wrapper = await mountSuspended(MissingFilesSelector, {
|
|
34
|
+
global: {
|
|
35
|
+
plugins: [vuetify],
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
multiple: false,
|
|
39
|
+
input_geode_object: "BRep",
|
|
40
|
+
filenames: ["fake_file.txt"],
|
|
41
|
+
route: "/upload_file",
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const file_uploader = wrapper.findComponent(FileUploader)
|
|
46
|
+
expect(file_uploader.exists()).toBe(true)
|
|
47
|
+
|
|
48
|
+
const v_file_input = file_uploader.findComponent(components.VFileInput)
|
|
49
|
+
await v_file_input.trigger("click")
|
|
50
|
+
const files = [new File(["fake_file"], "fake_file.txt")]
|
|
51
|
+
await v_file_input.setValue(files)
|
|
52
|
+
await v_file_input.trigger("change")
|
|
53
|
+
const v_btn = file_uploader.findComponent(components.VBtn)
|
|
54
|
+
|
|
55
|
+
registerEndpoint("/upload_file", {
|
|
56
|
+
method: "PUT",
|
|
57
|
+
handler: () => ({}),
|
|
58
|
+
})
|
|
59
|
+
await v_btn.trigger("click")
|
|
60
|
+
await flushPromises()
|
|
61
|
+
expect(wrapper.emitted()).toHaveProperty("update_values")
|
|
62
|
+
expect(wrapper.emitted().update_values).toHaveLength(1)
|
|
63
|
+
expect(wrapper.emitted().update_values[0][0]).toEqual({
|
|
64
|
+
additional_files: files,
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
})
|