Commit c175eb6
fix(audience): convert remaining setConsent comparisons + fix mock
Convert the 3 remaining raw consent string comparisons in sdk.ts
setConsent() to use the capability functions:
- level === 'none' (queue stop) → !canTrack(level)
- level === 'none' (cookie delete) → !canTrack(level)
- level === 'anonymous' && previous === 'full' (userId clear)
→ canIdentify(previous) && !canIdentify(level)
These were left as raw comparisons in the initial refactor because
they're state transitions, but they gate the same capabilities as the
query functions. If a future consent level blocks tracking (like
'none' does), these would silently diverge without this change.
Also fix canTrack mock in pixel.test.ts from a bare arrow to
jest.fn().mockImplementation() so it can be overridden per-test.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b2c9562 commit c175eb6
2 files changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
| 365 | + | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
374 | | - | |
| 374 | + | |
375 | 375 | | |
376 | 376 | | |
377 | | - | |
| 377 | + | |
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
| |||
0 commit comments