|
1 | | -import { describe, test, expect, beforeEach } from "vitest" |
| 1 | +import { describe, test, expect, expectTypeOf, beforeEach } from "vitest" |
2 | 2 | import { registerEndpoint } from "@nuxt/test-utils/runtime" |
3 | 3 | import { setActivePinia } from "pinia" |
4 | 4 | import { createTestingPinia } from "@pinia/testing" |
5 | 5 |
|
6 | | -describe("Cloud Store", () => { |
| 6 | +describe("Infra Store", () => { |
7 | 7 | const pinia = createTestingPinia({ |
8 | 8 | stubActions: false, |
9 | 9 | }) |
@@ -46,6 +46,17 @@ describe("Cloud Store", () => { |
46 | 46 | expect(infra_store.domain_name).toBe("api.geode-solutions.com") |
47 | 47 | }) |
48 | 48 | }) |
| 49 | + |
| 50 | + describe("lambda_url", () => { |
| 51 | + test("test is cloud true", () => { |
| 52 | + useRuntimeConfig().public.SITE_BRANCH = "/test" |
| 53 | + useRuntimeConfig().public.PROJECT = "/project" |
| 54 | + infra_store.is_cloud = true |
| 55 | + expect(infra_store.lambda_url).toBe( |
| 56 | + "https://api.geode-solutions.com:443/test/project/createbackend", |
| 57 | + ) |
| 58 | + }) |
| 59 | + }) |
49 | 60 | describe("is_running", () => { |
50 | 61 | test("test geode false & viewer false", () => { |
51 | 62 | geode_store.$patch({ is_running: false }) |
@@ -93,22 +104,28 @@ describe("Cloud Store", () => { |
93 | 104 | }) |
94 | 105 | }) |
95 | 106 |
|
96 | | - // describe("actions", () => { |
97 | | - // describe("create_backend", async () => { |
98 | | - // test("test without end-point", async () => { |
99 | | - // expect(geode_store.is_running).toBe(false) |
100 | | - // await infra_store.create_backend() |
101 | | - // expect(geode_store.is_running).toBe(false) |
102 | | - // }) |
103 | | - // test("test with end-point", async () => { |
104 | | - // expect(geode_store.is_running).toBe(false) |
105 | | - // registerEndpoint("/createbackend", { |
106 | | - // method: "POST", |
107 | | - // handler: () => ({ ID: "123456" }), |
108 | | - // }) |
109 | | - // await infra_store.create_backend() |
110 | | - // await flushPromises() |
111 | | - // }) |
112 | | - // }) |
113 | | - // }) |
| 107 | + describe("actions", () => { |
| 108 | + describe("create_connexion", async () => { |
| 109 | + test("test without end-point", async () => { |
| 110 | + await infra_store.create_connexion() |
| 111 | + expect(infra_store.is_connexion_launched).toBe(true) |
| 112 | + expect(feedback_store.server_error).toBe(true) |
| 113 | + }) |
| 114 | + }) |
| 115 | + describe("create_backend", async () => { |
| 116 | + test("test without end-point", async () => { |
| 117 | + await infra_store.create_backend() |
| 118 | + expect(geode_store.is_running).toBe(false) |
| 119 | + expect(feedback_store.server_error).toBe(true) |
| 120 | + }) |
| 121 | + test("test with end-point", async () => { |
| 122 | + registerEndpoint(infra_store.lambda_url, { |
| 123 | + method: "POST", |
| 124 | + handler: () => ({ ID: "123456" }), |
| 125 | + }) |
| 126 | + await infra_store.create_backend() |
| 127 | + expect(geode_store.is_running).toBe(true) |
| 128 | + }) |
| 129 | + }) |
| 130 | + }) |
114 | 131 | }) |
0 commit comments