diff --git a/stores/infra.js b/stores/infra.js index 0c9cbbf9..b9f3d602 100644 --- a/stores/infra.js +++ b/stores/infra.js @@ -48,7 +48,7 @@ export const use_infra_store = defineStore("infra", { actions: { async create_backend() { if (this.status === Status.CREATED) return - navigator.locks.request("infra.create_backend", async (lock) => { + return navigator.locks.request("infra.create_backend", async (lock) => { this.status = Status.CREATING if (this.status === Status.CREATED) return console.log("LOCK GRANTED !", lock) diff --git a/stores/viewer.js b/stores/viewer.js index 00144818..4460b7ae 100644 --- a/stores/viewer.js +++ b/stores/viewer.js @@ -59,7 +59,7 @@ export const use_viewer_store = defineStore("viewer", { async ws_connect() { if (process.env.NODE_ENV == "test") return if (this.status === Status.CONNECTED) return - navigator.locks.request("viewer.ws_connect", async (lock) => { + return navigator.locks.request("viewer.ws_connect", async (lock) => { if (this.status === Status.CONNECTED) return console.log("VIEWER LOCK GRANTED !", lock) this.status = Status.CONNECTING diff --git a/test/stores/Infra.nuxt.test.js b/test/stores/Infra.nuxt.test.js index dec1cbbe..2c8517ce 100644 --- a/test/stores/Infra.nuxt.test.js +++ b/test/stores/Infra.nuxt.test.js @@ -123,7 +123,7 @@ describe("Infra Store", () => { test("test without end-point", async () => { await infra_store.create_backend() console.log("geode_store.status", geode_store.status) - expect(infra_store.status).toBe(Status.CREATING) + expect(infra_store.status).toBe(Status.NOT_CREATED) expect(geode_store.status).toBe(Status.NOT_CONNECTED) expect(viewer_store.status).toBe(Status.NOT_CONNECTED) }) @@ -133,10 +133,10 @@ describe("Infra Store", () => { handler: () => ({ ID: "123456" }), }) await infra_store.create_backend() - expect(infra_store.status).toBe(Status.CREATING) + expect(infra_store.status).toBe(Status.CREATED) expect(geode_store.status).toBe(Status.NOT_CONNECTED) expect(viewer_store.status).toBe(Status.NOT_CONNECTED) - expect(feedback_store.server_error).toBe(false) + expect(feedback_store.server_error).toBe(true) }) }) })