Skip to content

Commit 702a16a

Browse files
committed
Update Freebuff privacy cache test
1 parent a19eca9 commit 702a16a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

web/src/server/__tests__/free-mode-country-access-cache.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ describe('free mode country access cache', () => {
115115
expect(fetch).toHaveBeenCalledTimes(1)
116116
})
117117

118-
test('does not persist corroborated hard privacy blocks', async () => {
118+
test('stores corroborated VPN/proxy limited decisions', async () => {
119119
const cacheStore: FreeModeCountryAccessCacheStore = {
120120
get: mock(async () => null),
121121
set: mock(async () => {}),
@@ -141,7 +141,14 @@ describe('free mode country access cache', () => {
141141
expect(access.allowed).toBe(false)
142142
expect(access.spurIpPrivacy?.signals).toEqual(['vpn'])
143143
expect(access.spurStatus).toBe('suspicious')
144-
expect(cacheStore.set).not.toHaveBeenCalled()
144+
expect(cacheStore.set).toHaveBeenCalledWith({
145+
userId,
146+
access,
147+
now,
148+
})
149+
expect(expiresAtForCountryAccess(access, now).getTime() - now.getTime()).toBe(
150+
FREE_MODE_COUNTRY_CACHE_ANONYMOUS_NETWORK_TTL_MS,
151+
)
145152
})
146153

147154
test('stores transient limited decisions when Spur fails after hard IPinfo signals', async () => {

0 commit comments

Comments
 (0)