|
| 1 | +import { describe, test, expect } from "vitest" |
| 2 | +import registerEndpoint from "@nuxt/test-utils/runtime" |
| 3 | + |
| 4 | +const cloud_store = use_cloud_store() |
| 5 | +const geode_store = use_geode_store() |
| 6 | +const websocket_store = use_websocket_store() |
| 7 | + |
| 8 | +describe("Cloud Store", () => { |
| 9 | + describe("getters", () => { |
| 10 | + test("is_running", async () => { |
| 11 | + expect(cloud_store.is_running).toBe(false) |
| 12 | + await geode_store.$patch({ is_running: true }) |
| 13 | + await websocket_store.$patch({ is_running: true }) |
| 14 | + expect(cloud_store.is_running).toBe(true) |
| 15 | + }) |
| 16 | + test("is_busy", async () => { |
| 17 | + expect(cloud_store.is_busy).toBe(false) |
| 18 | + await geode_store.start_request() |
| 19 | + await websocket_store.start_request() |
| 20 | + expect(cloud_store.is_busy).toBe(true) |
| 21 | + }) |
| 22 | + }) |
| 23 | + |
| 24 | + describe("actions", () => { |
| 25 | + test("create_backend", async () => { |
| 26 | + expect(geode_store.is_running).toBe(false) |
| 27 | + registerEndpoint("/createbackend", { |
| 28 | + method: "POST", |
| 29 | + handler: () => { |
| 30 | + console.log("createbackend") |
| 31 | + return {} |
| 32 | + }, |
| 33 | + }) |
| 34 | + await cloud_store.create_connexion() |
| 35 | + expect(geode_store.is_running).toBe(true) |
| 36 | + }) |
| 37 | + // test("create_connexion", async () => { |
| 38 | + // expect(geode_store.is_running).toBe(false) |
| 39 | + // registerEndpoint("/ping", { |
| 40 | + // method: "POST", |
| 41 | + // handler: () => { |
| 42 | + // console.log("ping") |
| 43 | + // return {} |
| 44 | + // }, |
| 45 | + // }) |
| 46 | + // await cloud_store.create_connexion() |
| 47 | + // expect(geode_store.is_running).toBe(true) |
| 48 | + // }) |
| 49 | + }) |
| 50 | +}) |
0 commit comments