Skip to content

Commit fcab2fd

Browse files
fix(locks): return navigator.locks
1 parent 6983f42 commit fcab2fd

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

stores/infra.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const use_infra_store = defineStore("infra", {
4848
actions: {
4949
async create_backend() {
5050
if (this.status === Status.CREATED) return
51-
navigator.locks.request("infra.create_backend", async (lock) => {
51+
return navigator.locks.request("infra.create_backend", async (lock) => {
5252
this.status = Status.CREATING
5353
if (this.status === Status.CREATED) return
5454
console.log("LOCK GRANTED !", lock)

stores/viewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const use_viewer_store = defineStore("viewer", {
5959
async ws_connect() {
6060
if (process.env.NODE_ENV == "test") return
6161
if (this.status === Status.CONNECTED) return
62-
navigator.locks.request("viewer.ws_connect", async (lock) => {
62+
return navigator.locks.request("viewer.ws_connect", async (lock) => {
6363
if (this.status === Status.CONNECTED) return
6464
console.log("VIEWER LOCK GRANTED !", lock)
6565
this.status = Status.CONNECTING

test/stores/Infra.nuxt.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe("Infra Store", () => {
2727
const feedback_store = use_feedback_store()
2828

2929
beforeEach(() => {
30+
console.log("BEFORE EACH")
3031
infra_store.$reset()
3132
geode_store.$reset()
3233
feedback_store.$reset()
@@ -123,7 +124,7 @@ describe("Infra Store", () => {
123124
test("test without end-point", async () => {
124125
await infra_store.create_backend()
125126
console.log("geode_store.status", geode_store.status)
126-
expect(infra_store.status).toBe(Status.CREATING)
127+
expect(infra_store.status).toBe(Status.NOT_CREATED)
127128
expect(geode_store.status).toBe(Status.NOT_CONNECTED)
128129
expect(viewer_store.status).toBe(Status.NOT_CONNECTED)
129130
})
@@ -133,10 +134,10 @@ describe("Infra Store", () => {
133134
handler: () => ({ ID: "123456" }),
134135
})
135136
await infra_store.create_backend()
136-
expect(infra_store.status).toBe(Status.CREATING)
137+
expect(infra_store.status).toBe(Status.CREATED)
137138
expect(geode_store.status).toBe(Status.NOT_CONNECTED)
138139
expect(viewer_store.status).toBe(Status.NOT_CONNECTED)
139-
expect(feedback_store.server_error).toBe(false)
140+
expect(feedback_store.server_error).toBe(true)
140141
})
141142
})
142143
})

0 commit comments

Comments
 (0)