mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
* feat(studio): track completed preview editing gestures * fix(studio): preserve gesture receipts and suppress duplicate usage * fix(studio): count semantic keyframe writes once per gesture * fix(studio): isolate recording state during pending saves * fix(studio): count marquee selection changes from owner receipts * fix(studio): retain accurate empty marquee receipts * refactor(studio): simplify recording transitions and selection tests * refactor(studio): share recording timing and marquee fixtures * fix(studio): preserve recording targets and batch attribution * fix(studio): retain per-member telemetry suppression * style(studio): format batch receipt attribution * test(studio): match writer receipts and animation metadata * docs(studio): clarify paused position save rejection * fix(studio): replace telemetry route names with route identity * style(studio): format route identity regression * Use random tab-local route identities in Studio telemetry * Preserve route identities inherited through session storage * Separate route storage validation from token creation
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
import { trackPreviewEditResult } from "./previewFeatureUsage";
|
|
import { trackStudioEvent } from "./studioTelemetry";
|
|
vi.mock("./studioTelemetry", () => ({ trackStudioEvent: vi.fn() }));
|
|
beforeEach(() => vi.clearAllMocks());
|
|
describe("preview write usage", () => {
|
|
it.each([
|
|
{ ok: true, changed: true },
|
|
{
|
|
ok: true,
|
|
persistence: { changed: true, sourceFile: "private.html", content: "private text" },
|
|
},
|
|
])("sends only gesture metadata after a changed result", (result) => {
|
|
trackPreviewEditResult("resize", "drag", result);
|
|
expect(trackStudioEvent).toHaveBeenCalledExactlyOnceWith("feature_used", {
|
|
feature: "resize",
|
|
surface: "preview",
|
|
method: "drag",
|
|
});
|
|
});
|
|
it.each([
|
|
undefined,
|
|
null,
|
|
{},
|
|
{ ok: false, changed: true },
|
|
{ changed: false },
|
|
{ persistence: { changed: false } },
|
|
])("does not count unavailable, failed or unchanged results (%j)", (result) => {
|
|
trackPreviewEditResult("move", "drag", result);
|
|
expect(trackStudioEvent).not.toHaveBeenCalled();
|
|
});
|
|
});
|