diff --git a/app/components/ObjectSelector.vue b/app/components/ObjectSelector.vue index d6b0449c..4b4ec9da 100644 --- a/app/components/ObjectSelector.vue +++ b/app/components/ObjectSelector.vue @@ -21,7 +21,7 @@ const toggle_loading = useToggle(loading); function select_geode_object(object_map) { const object_keys = Object.keys(object_map); - if (object_keys.length === 0) { + if (!object_keys.length) { return undefined; } if (object_keys.length === 1 && object_map[object_keys[0]].is_loadable > 0) { @@ -56,7 +56,7 @@ async function get_allowed_objects() { const promise_array = filenames.map((filename) => geodeStore.request(schema, { filename })); const responses = await Promise.all(promise_array); const allowed_objects_list = responses.map((response) => response.allowed_objects); - const all_keys = [...new Set(allowed_objects_list.flatMap((obj) => Object.keys(obj)))]; + const all_keys = [...new Set(allowed_objects_list.flatMap(Object.keys))]; const common_keys = all_keys.filter((key) => allowed_objects_list.every((obj) => key in obj)); const final_object = {}; for (const key of common_keys) { diff --git a/app/components/Recaptcha.vue b/app/components/Recaptcha.vue index b46c8490..187c3723 100644 --- a/app/components/Recaptcha.vue +++ b/app/components/Recaptcha.vue @@ -41,11 +41,10 @@ const emailRules = [ ]; onMounted(() => { - if ( - import.meta.client && - (process.env.NODE_ENV !== "production" || infraStore.app_mode !== appMode.CLOUD) - ) { - infraStore.$patch({ is_captcha_validated: true }); + if (import.meta.client) { + if (process.env.NODE_ENV !== "production" || infraStore.app_mode !== appMode.CLOUD) { + infraStore.$patch({ is_captcha_validated: true }); + } } }); async function submit_recaptcha() { diff --git a/app/stores/app.js b/app/stores/app.js index c1e26a40..4c276375 100644 --- a/app/stores/app.js +++ b/app/stores/app.js @@ -100,7 +100,6 @@ export const useAppStore = defineStore("app", () => { }); finalURL = URL.createObjectURL(newBlob); } - // oxlint-disable-next-line no-inline-comments const extensionModule = await import(/* @vite-ignore */ finalURL); if (finalURL !== path && finalURL.startsWith("blob:")) { @@ -122,25 +121,25 @@ export const useAppStore = defineStore("app", () => { throw new Error("Extension API not initialized"); } - if (typeof extensionModule.install !== "function") { - throw new TypeError("Extension must export an install function"); + if (typeof extensionModule.install === "function") { + await extensionModule.install(extensionAPI.value, backendPath); + + const extensionData = { + module: extensionModule, + id: extensionId, + path, + backendPath, + loadedAt: new Date().toISOString(), + metadata: extensionModule.metadata, + enabled: true, + }; + loadedExtensions.value.set(extensionId, extensionData); + + console.log(`[AppStore] Extension loaded successfully: ${extensionId}`); + return extensionModule; + } else { + throw new Error("Extension must export an install function"); } - - await extensionModule.install(extensionAPI.value, backendPath); - - const extensionData = { - module: extensionModule, - id: extensionId, - path, - backendPath, - loadedAt: new Date().toISOString(), - metadata: extensionModule.metadata, - enabled: true, - }; - loadedExtensions.value.set(extensionId, extensionData); - - console.log(`[AppStore] Extension loaded successfully: ${extensionId}`); - return extensionModule; } catch (error) { console.error(`[AppStore] Failed to load extension from ${path}:`, error); throw error; @@ -258,7 +257,7 @@ export const useAppStore = defineStore("app", () => { schema, {}, { - response_function: (response) => { + response_function: async (response) => { console.log(`[APP] ${response.projectFolderPath} created`); projectFolderPath.value = response.projectFolderPath; }, diff --git a/app/stores/feedback.js b/app/stores/feedback.js index d1101281..b564d241 100644 --- a/app/stores/feedback.js +++ b/app/stores/feedback.js @@ -35,10 +35,10 @@ export const useFeedbackStore = defineStore("feedback", { this.delete_feedback(feedbackId); }, this.feedbacks_timeout_miliseconds); }, - delete_feedback(feedbackId) { + async delete_feedback(feedbackId) { this.feedbacks = this.feedbacks.filter((feedback) => feedback.id !== feedbackId); }, - delete_server_error() { + async delete_server_error() { this.server_error = false; }, }, diff --git a/app/stores/geode.js b/app/stores/geode.js index 8ff74308..8a4494cf 100644 --- a/app/stores/geode.js +++ b/app/stores/geode.js @@ -52,6 +52,7 @@ export const useGeodeStore = defineStore("geode", { }, DEFAULT_PING_INTERVAL_SECONDS * MILLISECONDS_IN_SECOND); }, ping() { + const geodeStore = this; const feedbackStore = useFeedbackStore(); return this.request( back_schemas.opengeodeweb_back.ping, @@ -59,15 +60,15 @@ export const useGeodeStore = defineStore("geode", { { request_error_function: () => { feedbackStore.$patch({ server_error: true }); - this.status = Status.NOT_CONNECTED; + geodeStore.status = Status.NOT_CONNECTED; }, response_function: () => { feedbackStore.$patch({ server_error: false }); - this.status = Status.CONNECTED; + geodeStore.status = Status.CONNECTED; }, response_error_function: () => { feedbackStore.$patch({ server_error: true }); - this.status = Status.NOT_CONNECTED; + geodeStore.status = Status.NOT_CONNECTED; }, }, ); diff --git a/app/stores/hybrid_viewer.js b/app/stores/hybrid_viewer.js index e6c20b3c..65cd6a5f 100644 --- a/app/stores/hybrid_viewer.js +++ b/app/stores/hybrid_viewer.js @@ -98,10 +98,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => { delete hybridDb[id]; } - function setVisibility(id, visibility) { - if (!hybridDb[id]) { - return; - } + async function setVisibility(id, visibility) { hybridDb[id].actor.setVisibility(visibility); const renderWindow = genericRenderWindow.value.getRenderWindow(); renderWindow.render(); diff --git a/app/stores/infra.js b/app/stores/infra.js index 45efd22c..0c3d09b8 100644 --- a/app/stores/infra.js +++ b/app/stores/infra.js @@ -32,12 +32,12 @@ export const useInfraStore = defineStore("infra", { const store_name = store.$id; console.log("[INFRA] Registering microservice:", store_name); - if (!this.microservices.some((microservice) => microservice.$id === store_name)) { + if (!this.microservices.find((microservice) => microservice.$id === store_name)) { this.microservices.push(store); console.log("[INFRA] Microservice registered:", store_name); } }, - create_backend() { + async create_backend() { console.log("[INFRA] Starting create_backend - Mode:", this.app_mode); console.log( "[INFRA] Registered microservices:", diff --git a/app/stores/lambda.js b/app/stores/lambda.js index 2fb8609c..fff9676a 100644 --- a/app/stores/lambda.js +++ b/app/stores/lambda.js @@ -45,7 +45,7 @@ export const useLambdaStore = defineStore("lambda", { console.log("[LAMBDA] Lambda launched, ID:", id); return id; }, - connect() { + async connect() { console.log("[LAMBDA] Lambda connected"); this.status = Status.CONNECTED; return Promise.resolve(); diff --git a/app/stores/treeview.js b/app/stores/treeview.js index 10e8d551..bc967fd8 100644 --- a/app/stores/treeview.js +++ b/app/stores/treeview.js @@ -69,7 +69,7 @@ export const useTreeviewStore = defineStore("treeview", () => { }; } - function importStores(snapshot) { + async function importStores(snapshot) { isAdditionnalTreeDisplayed.value = snapshot?.isAdditionnalTreeDisplayed || false; panelWidth.value = snapshot?.panelWidth || PANEL_WIDTH; model_id.value = snapshot?.model_id || ""; @@ -83,7 +83,7 @@ export const useTreeviewStore = defineStore("treeview", () => { function finalizeImportSelection() { const ids = pendingSelectionIds.value || []; const rebuilt = []; - if (ids.length === 0) { + if (!ids.length) { for (const group of items.value) { for (const child of group.children) { rebuilt.push(child); diff --git a/app/stores/viewer.js b/app/stores/viewer.js index e4bff481..dbad8815 100644 --- a/app/stores/viewer.js +++ b/app/stores/viewer.js @@ -129,7 +129,7 @@ export const useViewerStore = defineStore( request_counter.value -= 1; } - function launch(args = ({ projectFolderPath } = {})) { + function launch(args = { projectFolderPath }) { console.log("[VIEWER] Launching viewer microservice...", { args }); const appStore = useAppStore(); const schema = { diff --git a/app/utils/local/cleanup.js b/app/utils/local/cleanup.js index 66f808e5..50bc6637 100644 --- a/app/utils/local/cleanup.js +++ b/app/utils/local/cleanup.js @@ -106,11 +106,11 @@ function killWebsocketMicroservice(microservice) { function killMicroservice(microservice) { if (microservice.type === "back") { return killHttpMicroservice(microservice); - } - if (microservice.type === "viewer") { + } else if (microservice.type === "viewer") { return killWebsocketMicroservice(microservice); + } else { + throw new Error(`Unknown microservice type: ${microservice.type}`); } - throw new Error(`Unknown microservice type: ${microservice.type}`); } function killMicroservices(microservices) { diff --git a/app/utils/local/path.js b/app/utils/local/path.js index af723e20..e3c21ee9 100644 --- a/app/utils/local/path.js +++ b/app/utils/local/path.js @@ -33,7 +33,7 @@ function createPath(dirPath) { } function generateProjectFolderPath(projectName) { - return path.join(os.tmpdir(), projectName.replaceAll("/", "_"), uuidv4()); + return path.join(os.tmpdir(), projectName.replace(/\//g, "_"), uuidv4()); } export { createPath, executablePath, executableName, generateProjectFolderPath }; diff --git a/app/utils/server.js b/app/utils/server.js index 32bde76b..2b4b2ff4 100644 --- a/app/utils/server.js +++ b/app/utils/server.js @@ -5,7 +5,10 @@ import path from "node:path"; // Third party imports import JSZip from "jszip"; -async function unzipFile(zipFilePath, outputDir = zipFilePath.replace(/\.[^/.]+$/, "")) { +async function unzipFile( + zipFilePath, + outputDir = zipFilePath.replace(/\.[^/.]+$/, ""), // Remove the file extension +) { console.log("Unzipping file...", zipFilePath, outputDir); try { const data = await fs.promises.readFile(zipFilePath); diff --git a/internal/database/database.js b/internal/database/database.js index 1ad24634..009edef9 100644 --- a/internal/database/database.js +++ b/internal/database/database.js @@ -24,11 +24,11 @@ class Database extends Dexie { await tempDb.open(); const currentVersion = tempDb.verno; - const currentStores = { - [dataTable.name]: dataTable.schema, - [modelComponentsTable.name]: modelComponentsTable.schema, - [modelComponentsRelationTable.name]: modelComponentsRelationTable.schema, - }; + const currentStores = {}; + + currentStores[dataTable.name] = dataTable.schema; + currentStores[modelComponentsTable.name] = modelComponentsTable.schema; + currentStores[modelComponentsRelationTable.name] = modelComponentsRelationTable.schema; for (const table of tempDb.tables) { const keyPath = table.schema.primKey.src; diff --git a/internal/stores/data_style/mesh/cells/index.js b/internal/stores/data_style/mesh/cells/index.js index d7562117..eba260a4 100644 --- a/internal/stores/data_style/mesh/cells/index.js +++ b/internal/stores/data_style/mesh/cells/index.js @@ -28,28 +28,26 @@ export function useMeshCellsStyle() { ); if (type === "color") { return meshCellsColorStyle.setMeshCellsColor(id, meshCellsColorStyle.meshCellsColor(id)); - } - if (type === "textures") { + } else if (type === "textures") { const textures = meshCellsTexturesStore.meshCellsTextures(id); if (textures === undefined) { - return; + return Promise.resolve(); } return meshCellsTexturesStore.setMeshCellsTextures(id, textures); - } - if (type === "vertex") { + } else if (type === "vertex") { const name = meshCellsVertexAttributeStyle.meshCellsVertexAttributeName(id); if (name === undefined) { - return; + return Promise.resolve(); } return meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeName(id, name); - } - if (type === "cell") { + } else if (type === "cell") { const name = meshCellsCellAttributeStyle.meshCellsCellAttributeName(id); if (name === undefined) { - return; + return Promise.resolve(); } await meshCellsCellAttributeStyle.setMeshCellsCellAttributeName(id, name); - return; + } else { + throw new Error(`Unknown mesh cells coloring type: ${type}`); } throw new Error(`Unknown mesh cells coloring type: ${type}`); } diff --git a/internal/stores/data_style/mesh/edges/index.js b/internal/stores/data_style/mesh/edges/index.js index 680cafa5..55e170ae 100644 --- a/internal/stores/data_style/mesh/edges/index.js +++ b/internal/stores/data_style/mesh/edges/index.js @@ -18,7 +18,7 @@ export function useMeshEdgesStyle() { const meshEdgesVertexAttributeStyle = useMeshEdgesVertexAttributeStyle(); const meshEdgesEdgeAttributeStyle = useMeshEdgesEdgeAttributeStyle(); - function setMeshEdgesActiveColoring(id, type) { + async function setMeshEdgesActiveColoring(id, type) { const coloring = meshEdgesCommonStyle.meshEdgesColoring(id); coloring.active = type; console.log( @@ -28,27 +28,26 @@ export function useMeshEdgesStyle() { ); if (type === "color") { return meshEdgesColorStyle.setMeshEdgesColor(id, meshEdgesColorStyle.meshEdgesColor(id)); - } - if (type === "textures") { + } else if (type === "textures") { const textures = meshEdgesTexturesStore.meshEdgesTextures(id); if (textures === undefined) { return Promise.resolve(); } return meshEdgesTexturesStore.setMeshEdgesTextures(id, textures); - } - if (type === "vertex") { + } else if (type === "vertex") { const name = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeName(id); if (name === undefined) { return Promise.resolve(); } return meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(id, name); - } - if (type === "edge") { + } else if (type === "edge") { const name = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeName(id); if (name === undefined) { return Promise.resolve(); } return meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name); + } else { + throw new Error(`Unknown mesh edges coloring type: ${type}`); } throw new Error(`Unknown mesh edges coloring type: ${type}`); } diff --git a/internal/stores/data_style/mesh/points/index.js b/internal/stores/data_style/mesh/points/index.js index 7a7bd464..a2b32a51 100644 --- a/internal/stores/data_style/mesh/points/index.js +++ b/internal/stores/data_style/mesh/points/index.js @@ -26,30 +26,27 @@ export function useMeshPointsStyle() { ); if (type === "color") { return meshPointsColorStyle.setMeshPointsColor(id, meshPointsColorStyle.meshPointsColor(id)); - } - if (type === "textures") { + } else if (type === "textures") { const textures = meshPointsTexturesStore.meshPointsTextures(id); if (textures === undefined) { - return; + return Promise.resolve(); } return meshPointsTexturesStore.setMeshPointsTextures(id, textures); - } - if (type === "vertex") { + } else if (type === "vertex") { const name = meshPointsVertexAttributeStyle.meshPointsVertexAttributeName(id); if (name === undefined) { - return; + return Promise.resolve(); } return meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeName(id, name); - } - if (type === "polygon") { + } else if (type === "polygon") { const name = meshPointsPolygonAttributeStyleStore.meshPointsPolygonAttributeName(id); if (name === undefined) { - return; + return Promise.resolve(); } await meshPointsPolygonAttributeStyleStore.setMeshPointsPolygonAttributeName(id, name); - return; + } else { + throw new Error(`Unknown mesh points coloring type: ${type}`); } - throw new Error(`Unknown mesh points coloring type: ${type}`); } function applyMeshPointsStyle(id) { diff --git a/internal/stores/data_style/mesh/polygons/index.js b/internal/stores/data_style/mesh/polygons/index.js index 7f72fe2e..10dbdd7d 100644 --- a/internal/stores/data_style/mesh/polygons/index.js +++ b/internal/stores/data_style/mesh/polygons/index.js @@ -31,30 +31,27 @@ export function useMeshPolygonsStyle() { id, meshPolygonsColorStyle.meshPolygonsColor(id), ); - } - if (type === "textures") { + } else if (type === "textures") { const textures = meshPolygonsTexturesStyle.meshPolygonsTextures(id); if (textures === undefined) { - return; + return Promise.resolve(); } return meshPolygonsTexturesStyle.setMeshPolygonsTextures(id, textures); - } - if (type === "vertex") { + } else if (type === "vertex") { const name = meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeName(id); if (name === undefined) { - return; + return Promise.resolve(); } return meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeName(id, name); - } - if (type === "polygon") { + } else if (type === "polygon") { const name = meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeName(id); if (name === undefined) { - return; + return Promise.resolve(); } await meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeName(id, name); - return; + } else { + throw new Error(`Unknown mesh polygons coloring type: ${type}`); } - throw new Error(`Unknown mesh polygons coloring type: ${type}`); } function applyMeshPolygonsStyle(id) { diff --git a/internal/stores/data_style/mesh/polyhedra/index.js b/internal/stores/data_style/mesh/polyhedra/index.js index 421bc59c..7fa4f44e 100644 --- a/internal/stores/data_style/mesh/polyhedra/index.js +++ b/internal/stores/data_style/mesh/polyhedra/index.js @@ -29,23 +29,21 @@ export function useMeshPolyhedraStyle() { id, meshPolyhedraColorStyle.meshPolyhedraColor(id), ); - } - if (type === "vertex") { + } else if (type === "vertex") { const name = meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeName(id); if (name === undefined) { - return; + return Promise.resolve(); } return meshPolyhedraVertexAttributeStyle.setMeshPolyhedraVertexAttributeName(id, name); - } - if (type === "polyhedron") { + } else if (type === "polyhedron") { const name = meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeName(id); if (name === undefined) { - return; + return Promise.resolve(); } await meshPolyhedraPolyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttributeName(id, name); - return; + } else { + throw new Error(`Unknown mesh polyhedra coloring type: ${type}`); } - throw new Error(`Unknown mesh polyhedra coloring type: ${type}`); } function applyMeshPolyhedraStyle(id) { diff --git a/internal/stores/data_style/model/index.js b/internal/stores/data_style/model/index.js index 476cda74..25222241 100644 --- a/internal/stores/data_style/model/index.js +++ b/internal/stores/data_style/model/index.js @@ -82,14 +82,11 @@ export function useModelStyle() { function modelMeshComponentVisibility(id, component_type, component_id) { if (component_type === "Corner") { return modelCornersStyleStore.modelCornerVisibility(id, component_id); - } - if (component_type === "Line") { + } else if (component_type === "Line") { return modelLinesStyleStore.modelLineVisibility(id, component_id); - } - if (component_type === "Surface") { + } else if (component_type === "Surface") { return modelSurfacesStyleStore.modelSurfaceVisibility(id, component_id); - } - if (component_type === "Block") { + } else if (component_type === "Block") { return modelBlocksStyleStore.modelBlockVisibility(id, component_id); } throw new Error(`Unknown model component_type: ${component_type}`); @@ -115,21 +112,19 @@ export function useModelStyle() { const component_type = await dataStore.meshComponentType(id, component_geode_ids[0]); if (component_type === "Corner") { return modelCornersStyleStore.setModelCornersVisibility(id, component_geode_ids, visibility); - } - if (component_type === "Line") { + } else if (component_type === "Line") { return modelLinesStyleStore.setModelLinesVisibility(id, component_geode_ids, visibility); - } - if (component_type === "Surface") { + } else if (component_type === "Surface") { return modelSurfacesStyleStore.setModelSurfacesVisibility( id, component_geode_ids, visibility, ); - } - if (component_type === "Block") { + } else if (component_type === "Block") { return modelBlocksStyleStore.setModelBlocksVisibility(id, component_geode_ids, visibility); + } else { + throw new Error(`Unknown model component_type: ${component_type}`); } - throw new Error(`Unknown model component_type: ${component_type}`); } function applyModelStyle(id) { diff --git a/internal/utils/upload_file.js b/internal/utils/upload_file.js index bee87bca..6e6ef1a2 100644 --- a/internal/utils/upload_file.js +++ b/internal/utils/upload_file.js @@ -19,7 +19,7 @@ async function upload_file( body: body, }; microservice.start_request(); - return await $fetch(route, { + return $fetch(route, { baseURL: microservice.base_url || "", ...request_options, onRequestError({ error }) { diff --git a/scripts/generate_geode_objects.js b/scripts/generate_geode_objects.js index a7f7bec0..deffdaec 100644 --- a/scripts/generate_geode_objects.js +++ b/scripts/generate_geode_objects.js @@ -15,7 +15,7 @@ let geode_objects = "const geode_objects = {"; for (const file of files) { const geode_object = file.replace(".svg", ""); - imports += `import ${geode_object} from "@ogw_front/assets/img/geode_objects/${file}"\n`; + imports += `import ${geode_object} from "@ogw_front/assets/img/geode_objects/${file}"` + "\n"; geode_objects += `${geode_object}:{\n tooltip: "${geode_object}",\n image: ${geode_object},\n},\n`; } geode_objects += "}\n\n export default geode_objects"; diff --git a/server/api/extensions/upload.put.js b/server/api/extensions/upload.put.js index f6f7b8ab..9aa50bd3 100644 --- a/server/api/extensions/upload.put.js +++ b/server/api/extensions/upload.put.js @@ -14,7 +14,7 @@ import sanitize from "sanitize-filename"; import { addExtensionToConf, confFolderPath } from "@geode/opengeodeweb-front/app/utils/config.js"; const CODE_201 = 201; -const FILE_SIZE_LIMIT = 107_374_182; +const FILE_SIZE_LIMIT = 107_374_182; // 100 MB export default defineEventHandler(async (event) => { const projectName = "vease"; diff --git a/tests/integration/stores/data_style/model/surfaces.nuxt.test.js b/tests/integration/stores/data_style/model/surfaces.nuxt.test.js index c301f5c5..a9644c7a 100644 --- a/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +++ b/tests/integration/stores/data_style/model/surfaces.nuxt.test.js @@ -37,7 +37,7 @@ describe("model surfaces", () => { const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, surface_ids); const visibility = true; const spy = vi.spyOn(viewerStore, "request"); - spy.mockClear(); + spy.mockClear(); // Clear calls from setup (applyDefaultStyle) const result = dataStyleStore.setModelSurfacesVisibility(id, surface_ids, visibility); expect(result).toBeInstanceOf(Promise); await result; @@ -64,7 +64,7 @@ describe("model surfaces", () => { const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, surface_ids); const color = { r: 255, g: 0, b: 0 }; const spy = vi.spyOn(viewerStore, "request"); - spy.mockClear(); + spy.mockClear(); // Clear calls from setup (applyDefaultStyle) const result = dataStyleStore.setModelSurfacesColor(id, surface_ids, color); expect(result).toBeInstanceOf(Promise); await result; diff --git a/tests/integration/stores/viewer.nuxt.test.js b/tests/integration/stores/viewer.nuxt.test.js index 755dcb0a..ba437782 100644 --- a/tests/integration/stores/viewer.nuxt.test.js +++ b/tests/integration/stores/viewer.nuxt.test.js @@ -52,7 +52,7 @@ describe("Viewer Store", () => { describe("request", () => { test( "request", - () => { + async () => { const schema = opengeodeweb_viewer_schemas.opengeodeweb_viewer.viewer.render; const viewerStore = useViewerStore(); const timeout = 1; diff --git a/tests/unit/components/FileSelector.nuxt.test.js b/tests/unit/components/FileSelector.nuxt.test.js index 0ce42285..6bc8ccdf 100644 --- a/tests/unit/components/FileSelector.nuxt.test.js +++ b/tests/unit/components/FileSelector.nuxt.test.js @@ -18,7 +18,7 @@ const SECOND_INDEX = 1; const allowed_files_schema = schemas.opengeodeweb_back.allowed_files; const upload_file_schema = schemas.opengeodeweb_back.upload_file; -describe(FileSelector, () => { +describe(FileSelector, async () => { const pinia = setupActivePinia(); const geodeStore = useGeodeStore(); geodeStore.base_url = ""; diff --git a/tests/unit/components/FileUploader.nuxt.test.js b/tests/unit/components/FileUploader.nuxt.test.js index 96c61002..d31145d5 100644 --- a/tests/unit/components/FileUploader.nuxt.test.js +++ b/tests/unit/components/FileUploader.nuxt.test.js @@ -15,7 +15,7 @@ const SECOND_INDEX = 1; const upload_file_schema = schemas.opengeodeweb_back.upload_file; -describe(FileUploader, () => { +describe(FileUploader, async () => { const pinia = setupActivePinia(); const geodeStore = useGeodeStore(); geodeStore.base_url = ""; diff --git a/tests/unit/components/Inspector/InspectionButton.nuxt.test.js b/tests/unit/components/Inspector/InspectionButton.nuxt.test.js index 2d7ea6ad..0976fbc6 100644 --- a/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +++ b/tests/unit/components/Inspector/InspectionButton.nuxt.test.js @@ -9,7 +9,7 @@ import { setupActivePinia, vuetify } from "@ogw_tests/utils"; import InspectorInspectionButton from "@ogw_front/components/Inspector/InspectionButton"; import { useGeodeStore } from "@ogw_front/stores/geode"; -describe("Inspector/InspectionButton", () => { +describe("Inspector/InspectionButton", async () => { const pinia = setupActivePinia(); const geodeStore = useGeodeStore(); geodeStore.base_url = ""; diff --git a/tests/unit/components/Step.nuxt.test.js b/tests/unit/components/Step.nuxt.test.js index 289f07fb..e6f7b670 100644 --- a/tests/unit/components/Step.nuxt.test.js +++ b/tests/unit/components/Step.nuxt.test.js @@ -11,7 +11,7 @@ import { vuetify } from "@ogw_tests/utils"; globalThis.ResizeObserver = ResizeObserver; describe(Step, () => { - test(`BRep`, () => { + test(`BRep`, async () => { const geode_object_type = ref("BRep"); const files = ref([]); const stepper_tree = reactive({ @@ -30,6 +30,8 @@ describe(Step, () => { chips: computed(() => { if (geode_object_type.value === "") { return []; + } else { + return [geode_object_type.value]; } return [geode_object_type.value]; }), diff --git a/tests/unit/composables/api_fetch.nuxt.test.js b/tests/unit/composables/api_fetch.nuxt.test.js index d35fd657..ad5f9aab 100644 --- a/tests/unit/composables/api_fetch.nuxt.test.js +++ b/tests/unit/composables/api_fetch.nuxt.test.js @@ -51,7 +51,7 @@ describe("geodeStore.request()", () => { expect(() => geodeStore.request(invalid_schema, params)).toThrow("data/test must be number"); }); - test("invalid params", () => { + test("invalid params", async () => { const params = {}; expect(() => geodeStore.request(schema, params)).toThrow( "data must have required property 'test'", @@ -62,7 +62,7 @@ describe("geodeStore.request()", () => { const params = { test: "hello" }; let errorCalled = false; const callbacks = { - request_error_function: () => { + request_error_function: async () => { errorCalled = true; }, }; diff --git a/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js b/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js index 2bfc8bc9..a708b02a 100644 --- a/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +++ b/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js @@ -38,7 +38,7 @@ beforeEach(() => { }); describe("when_microservices_connected_run_function", () => { - test("microservices not connected", () => { + test("microservices not connected", async () => { const spy = vi.spyOn(dumb_obj, "dumb_method"); run_function_when_microservices_connected(dumb_obj.dumb_method); geodeStore.$patch({ status: Status.NOT_CONNECTED }); diff --git a/tests/unit/stores/lambda.nuxt.test.js b/tests/unit/stores/lambda.nuxt.test.js index 66c9dc2a..aab11c74 100644 --- a/tests/unit/stores/lambda.nuxt.test.js +++ b/tests/unit/stores/lambda.nuxt.test.js @@ -16,7 +16,7 @@ const PROJECT = "project"; const TEST_ID = "test-id-123456"; const STATUS_500 = 500; -beforeEach(() => { +beforeEach(async () => { setupActivePinia(); });