mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
Add versioned telemetry events
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
2ac40aba56
commit
37b6ad42ea
16 changed files with 577 additions and 0 deletions
|
|
@ -33,6 +33,25 @@ describe("TelemetryClient periodic flush", () => {
|
|||
|
||||
await vi.advanceTimersByTimeAsync(1000);
|
||||
expect(fetch).toHaveBeenCalledTimes(1);
|
||||
const lastCall = vi.mocked(fetch).mock.calls.at(-1);
|
||||
expect(lastCall?.[0]).toBe("http://localhost:9999/ingest");
|
||||
const requestInit = lastCall?.[1] as RequestInit | undefined;
|
||||
expect(requestInit?.method).toBe("POST");
|
||||
expect(requestInit?.headers).toEqual({ "Content-Type": "application/json" });
|
||||
const body = JSON.parse(String(requestInit?.body ?? "{}"));
|
||||
expect(body).toMatchObject({
|
||||
app: "paperclip",
|
||||
schemaVersion: "1",
|
||||
installId: "test-install",
|
||||
version: "0.0.0-test",
|
||||
events: [
|
||||
{
|
||||
name: "install.started",
|
||||
dimensions: {},
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(body.events[0]?.occurredAt).toEqual(expect.any(String));
|
||||
|
||||
// Second tick with no new events — no additional call
|
||||
await vi.advanceTimersByTimeAsync(1000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue