@@ -2527,7 +2527,7 @@ describe('Clerk singleton', () => {
25272527} ) ;
25282528} ) ;
25292529
2530- test ( 'auto-derives proxyUrl when hostname is eligible' , ( ) => {
2530+ test ( 'auto-derives proxyUrl for production instances on eligible hosts ' , ( ) => {
25312531Object . defineProperty ( window , 'location' , {
25322532value : {
25332533 ...originalLocation ,
@@ -2538,15 +2538,30 @@ describe('Clerk singleton', () => {
25382538writable : true ,
25392539} ) ;
25402540
2541- const sut = new Clerk ( developmentPublishableKey ) ;
2541+ const sut = new Clerk ( productionPublishableKey ) ;
25422542expect ( sut . proxyUrl ) . toBe ( 'https://myapp-abc123.vercel.app/__clerk' ) ;
25432543} ) ;
25442544
2545- test ( 'does NOT auto-derive proxyUrl for ineligible domains' , ( ) => {
2545+ test ( 'does NOT auto-derive proxyUrl for development instances on eligible hosts' , ( ) => {
2546+ Object . defineProperty ( window , 'location' , {
2547+ value : {
2548+ ...originalLocation ,
2549+ hostname : 'myapp-abc123.vercel.app' ,
2550+ origin : 'https://myapp-abc123.vercel.app' ,
2551+ href : 'https://myapp-abc123.vercel.app/dashboard' ,
2552+ } ,
2553+ writable : true ,
2554+ } ) ;
2555+
25462556const sut = new Clerk ( developmentPublishableKey ) ;
25472557expect ( sut . proxyUrl ) . toBe ( '' ) ;
25482558} ) ;
25492559
2560+ test ( 'does NOT auto-derive proxyUrl for ineligible domains' , ( ) => {
2561+ const sut = new Clerk ( productionPublishableKey ) ;
2562+ expect ( sut . proxyUrl ) . toBe ( '' ) ;
2563+ } ) ;
2564+
25502565test ( 'explicit proxyUrl takes precedence over auto-detection' , ( ) => {
25512566Object . defineProperty ( window , 'location' , {
25522567value : {
@@ -2558,7 +2573,7 @@ describe('Clerk singleton', () => {
25582573writable : true ,
25592574} ) ;
25602575
2561- const sut = new Clerk ( developmentPublishableKey , {
2576+ const sut = new Clerk ( productionPublishableKey , {
25622577proxyUrl : 'https://custom-proxy.example.com/__clerk' ,
25632578} ) ;
25642579expect ( sut . proxyUrl ) . toBe ( 'https://custom-proxy.example.com/__clerk' ) ;
@@ -2575,7 +2590,7 @@ describe('Clerk singleton', () => {
25752590writable : true ,
25762591} ) ;
25772592
2578- const sut = new Clerk ( developmentPublishableKey , {
2593+ const sut = new Clerk ( productionPublishableKey , {
25792594domain : 'clerk.myapp.com' ,
25802595} ) ;
25812596expect ( sut . proxyUrl ) . toBe ( '' ) ;
0 commit comments