Skip to content

Commit 015158e

Browse files
committed
test: update image-proxy tests
1 parent 828ab9f commit 015158e

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

test/unit/server/utils/image-proxy.spec.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ describe('Image Proxy Utils', () => {
1818
).toBe(true)
1919
})
2020

21-
it('trusts GitHub user images', () => {
22-
expect(isTrustedImageDomain('https://user-images.githubusercontent.com/123/image.png')).toBe(
23-
true,
24-
)
25-
})
26-
2721
it('trusts shields.io badge URLs', () => {
2822
expect(isTrustedImageDomain('https://img.shields.io/badge/test-passing-green')).toBe(true)
2923
})
@@ -36,8 +30,8 @@ describe('Image Proxy Utils', () => {
3630
expect(isTrustedImageDomain('https://npmx.dev/images/logo.png')).toBe(true)
3731
})
3832

39-
it('trusts subdomain of trusted domains', () => {
40-
expect(isTrustedImageDomain('https://sub.gitlab.com/image.png')).toBe(true)
33+
it('does not trust subdomain of trusted domains', () => {
34+
expect(isTrustedImageDomain('https://sub.gitlab.com/image.png')).toBe(false)
4135
})
4236

4337
it('does not trust arbitrary domains', () => {
@@ -265,7 +259,7 @@ describe('Image Proxy Utils', () => {
265259
})
266260

267261
it('does not proxy GitHub blob URLs', () => {
268-
const url = 'https://github.com/owner/repo/blob/main/assets/logo.png'
262+
const url = 'https://cloud.githubusercontent.com/assets/123/logo.png'
269263
expect(toProxiedImageUrl(url, TEST_SECRET)).toBe(url)
270264
})
271265

0 commit comments

Comments
 (0)