|
1 | 1 | import { afterEach, beforeEach, describe, expect, it } from 'vitest'; |
2 | 2 |
|
3 | | -import { |
4 | | - isHttpOrHttps, |
5 | | - isProxyUrlRelative, |
6 | | - isValidProxyUrl, |
7 | | - isVercelPreviewDeploy, |
8 | | - proxyUrlToAbsoluteURL, |
9 | | -} from '../proxy'; |
| 3 | +import { isHttpOrHttps, isProxyUrlRelative, isValidProxyUrl, proxyUrlToAbsoluteURL, shouldAutoProxy } from '../proxy'; |
10 | 4 |
|
11 | 5 | describe('isValidProxyUrl(key)', () => { |
12 | 6 | it('returns true if the proxyUrl is valid', () => { |
@@ -44,25 +38,25 @@ describe('isHttpOrHttps(key)', () => { |
44 | 38 | }); |
45 | 39 | }); |
46 | 40 |
|
47 | | -describe('isVercelPreviewDeploy(hostname)', () => { |
| 41 | +describe('shouldAutoProxy(hostname)', () => { |
48 | 42 | it('returns true for a .vercel.app subdomain', () => { |
49 | | - expect(isVercelPreviewDeploy('myapp.vercel.app')).toBe(true); |
| 43 | + expect(shouldAutoProxy('myapp.vercel.app')).toBe(true); |
50 | 44 | }); |
51 | 45 |
|
52 | 46 | it('returns true for a git branch preview subdomain', () => { |
53 | | - expect(isVercelPreviewDeploy('myapp-git-branch.vercel.app')).toBe(true); |
| 47 | + expect(shouldAutoProxy('myapp-git-branch.vercel.app')).toBe(true); |
54 | 48 | }); |
55 | 49 |
|
56 | 50 | it('returns false for the bare vercel.app domain', () => { |
57 | | - expect(isVercelPreviewDeploy('vercel.app')).toBe(false); |
| 51 | + expect(shouldAutoProxy('vercel.app')).toBe(false); |
58 | 52 | }); |
59 | 53 |
|
60 | 54 | it('returns false for a custom domain', () => { |
61 | | - expect(isVercelPreviewDeploy('myapp.com')).toBe(false); |
| 55 | + expect(shouldAutoProxy('myapp.com')).toBe(false); |
62 | 56 | }); |
63 | 57 |
|
64 | 58 | it('returns false for a domain that contains vercel.app but is not a subdomain', () => { |
65 | | - expect(isVercelPreviewDeploy('vercel.app.evil.com')).toBe(false); |
| 59 | + expect(shouldAutoProxy('vercel.app.evil.com')).toBe(false); |
66 | 60 | }); |
67 | 61 | }); |
68 | 62 |
|
|
0 commit comments