@hyperframes/studio 0.9.33 → 0.9.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { act, type ComponentProps } from "react";
2
2
  import { createRoot, type Root } from "react-dom/client";
3
- import { afterEach, vi } from "vitest";
3
+ import { afterEach, expect, vi } from "vitest";
4
4
  import { thumbnailScheduler } from "../../player/lib/thumbnailScheduler";
5
5
  import { usePlayerStore } from "../../player/store/playerStore";
6
6
  import { CompositionsTab } from "./CompositionsTab";
@@ -37,3 +37,18 @@ export function mountCompositionsTab(props: Partial<ComponentProps<typeof Compos
37
37
  });
38
38
  return host;
39
39
  }
40
+
41
+ export const FRAME_TOKEN = "T".repeat(43);
42
+
43
+ export function stubFrameTokenFetch(token: string | null = FRAME_TOKEN) {
44
+ return vi.spyOn(globalThis, "fetch").mockImplementation(async (input) => {
45
+ expect(String(input)).toBe("/api/projects/demo/frame-token");
46
+ return { ok: token !== null, json: async () => ({ token }) } as Response;
47
+ });
48
+ }
49
+
50
+ export async function settleFrameToken() {
51
+ await act(async () => {
52
+ for (let i = 0; i < 10; i += 1) await Promise.resolve();
53
+ });
54
+ }