Skip to content

Commit fb302cf

Browse files
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWeb-Front into fix/nuxt_update
2 parents 4848d55 + b547317 commit fb302cf

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

app/stores/infra.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { appMode, getAppMode } from "@ogw_front/utils/app_mode.js"
44
export const useInfraStore = defineStore("infra", {
55
state: () => ({
66
app_mode: getAppMode(),
7+
ID: "",
78
is_captcha_validated: false,
89
status: Status.NOT_CREATED,
910
microservices: [],
@@ -66,7 +67,7 @@ export const useInfraStore = defineStore("infra", {
6667
} else if (this.app_mode == appMode.CLOUD) {
6768
console.log("[INFRA] CLOUD mode - Launching lambda...")
6869
const lambdaStore = useLambdaStore()
69-
await lambdaStore.launch()
70+
this.ID = await lambdaStore.launch()
7071
console.log("[INFRA] Lambda launched successfully")
7172
}
7273

app/stores/lambda.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const useLambdaStore = defineStore("lambda", {
4242
if (error.value || !data.value) {
4343
this.status = Status.NOT_CONNECTED
4444
feedbackStore.server_error = true
45-
console.error("[LAMBDA] Failed to launch lambda backend")
45+
console.error("[LAMBDA] Failed to launch lambda backend", error.value)
4646
throw new Error("Failed to launch lambda backend")
4747
}
4848

tests/unit/stores/Infra.nuxt.test.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -286,22 +286,25 @@ describe("Infra Store", () => {
286286
await infraStore.create_backend()
287287
expect(infraStore.status).toBe(Status.CREATED)
288288
})
289-
// test("test with end-point", async () => {
290-
// const infraStore = useInfraStore()
291-
// const geodeStore = useGeodeStore()
292-
// const viewerStore = useViewerStore()
293-
// const feedbackStore = useFeedbackStore()
294-
295-
// registerEndpoint(infraStore.lambda_url, {
296-
// method: "POST",
297-
// handler: () => ({ ID: "123456" }),
298-
// })
299-
// await infraStore.create_backend()
300-
// expect(infraStore.status).toBe(Status.CREATED)
301-
// expect(geodeStore.status).toBe(Status.NOT_CONNECTED)
302-
// expect(viewerStore.status).toBe(Status.NOT_CONNECTED)
303-
// expect(feedbackStore.server_error).toBe(true)
304-
// })
289+
test("test with end-point", async () => {
290+
const infra_store = useInfraStore()
291+
const geodeStore = useGeodeStore()
292+
const viewerStore = useViewerStore()
293+
const lambdaStore = useLambdaStore()
294+
295+
infra_store.app_mode = appMode.CLOUD
296+
const ID = "123456"
297+
registerEndpoint(lambdaStore.base_url, {
298+
method: "POST",
299+
handler: () => ({ ID }),
300+
})
301+
await infra_store.create_backend()
302+
expect(infra_store.status).toBe(Status.CREATED)
303+
expect(infra_store.ID).toBe(ID)
304+
305+
expect(geodeStore.status).toBe(Status.NOT_CONNECTED)
306+
expect(viewerStore.status).toBe(Status.NOT_CONNECTED)
307+
})
305308
})
306309
})
307310
})

0 commit comments

Comments
 (0)