Skip to content

Commit 3251b6e

Browse files
James Mtendamemacursoragent
andcommitted
test(zoo-telemetry): align with privacy policy update - drop subscription gating expectation
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 313568b commit 3251b6e

1 file changed

Lines changed: 17 additions & 20 deletions

File tree

src/services/__tests__/zoo-telemetry.test.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"
22

3-
const {
4-
mockCheckSubscriptionStatus,
5-
mockGetCachedSubscriptionStatus,
6-
mockGetCachedZooCodeToken,
7-
mockGetZooCodeBaseUrl,
8-
} = vi.hoisted(() => ({
9-
mockCheckSubscriptionStatus: vi.fn(),
10-
mockGetCachedSubscriptionStatus: vi.fn(),
3+
const { mockGetCachedZooCodeToken, mockGetZooCodeBaseUrl } = vi.hoisted(() => ({
114
mockGetCachedZooCodeToken: vi.fn(),
125
mockGetZooCodeBaseUrl: vi.fn(),
136
}))
147

158
vi.mock("../zoo-code-auth", () => ({
16-
checkSubscriptionStatus: mockCheckSubscriptionStatus,
17-
getCachedSubscriptionStatus: mockGetCachedSubscriptionStatus,
189
getCachedZooCodeToken: mockGetCachedZooCodeToken,
1910
getZooCodeBaseUrl: mockGetZooCodeBaseUrl,
2011
}))
@@ -52,21 +43,29 @@ describe("sendLlmTelemetry", () => {
5243
expect(global.fetch).not.toHaveBeenCalled()
5344
})
5445

55-
it("refreshes an unknown subscription status before sending", async () => {
56-
mockGetCachedZooCodeToken.mockReturnValue("zoo_ext_test_token")
57-
mockGetCachedSubscriptionStatus.mockReturnValue("unknown")
58-
mockCheckSubscriptionStatus.mockResolvedValue("inactive")
59-
global.fetch = vi.fn()
46+
it("sends telemetry for authenticated users regardless of subscription tier", async () => {
47+
// Privacy policy alignment: server-side retention (up to 90 days) and
48+
// plan-gated dashboard visibility are enforced on zoocode.dev. The
49+
// extension no longer filters telemetry by subscription status, so any
50+
// authenticated user — free or paid — should reach the fetch call.
51+
mockGetCachedZooCodeToken.mockReturnValue("zoo_ext_free_user_token")
52+
global.fetch = vi.fn().mockResolvedValue({ ok: true })
6053

6154
await sendLlmTelemetry(payload)
6255

63-
expect(mockCheckSubscriptionStatus).toHaveBeenCalled()
64-
expect(global.fetch).not.toHaveBeenCalled()
56+
expect(global.fetch).toHaveBeenCalledWith(
57+
"https://www.zoocode.dev/api/observability/events",
58+
expect.objectContaining({
59+
method: "POST",
60+
headers: expect.objectContaining({
61+
Authorization: "Bearer zoo_ext_free_user_token",
62+
}),
63+
}),
64+
)
6565
})
6666

6767
it("fires the observability request without waiting for it to settle", async () => {
6868
mockGetCachedZooCodeToken.mockReturnValue("zoo_ext_test_token")
69-
mockGetCachedSubscriptionStatus.mockReturnValue("active")
7069

7170
let resolveFetch: ((value: unknown) => void) | undefined
7271
global.fetch = vi.fn(
@@ -104,7 +103,6 @@ describe("sendLlmTelemetry", () => {
104103

105104
it("sends cancelled status when provided in payload", async () => {
106105
mockGetCachedZooCodeToken.mockReturnValue("zoo_ext_test_token")
107-
mockGetCachedSubscriptionStatus.mockReturnValue("active")
108106

109107
global.fetch = vi.fn().mockResolvedValue({ ok: true })
110108

@@ -119,7 +117,6 @@ describe("sendLlmTelemetry", () => {
119117

120118
it("defaults to completed status when not provided", async () => {
121119
mockGetCachedZooCodeToken.mockReturnValue("zoo_ext_test_token")
122-
mockGetCachedSubscriptionStatus.mockReturnValue("active")
123120

124121
global.fetch = vi.fn().mockResolvedValue({ ok: true })
125122

0 commit comments

Comments
 (0)