@@ -39,13 +39,16 @@ export const testPathRouting = test.extend<{ rootDomain: string, baseURL: string
39
39
testPathRouting . skip ( )
40
40
return
41
41
}
42
+ if ( process . env . KUBO_GATEWAY == null || process . env . KUBO_GATEWAY === '' ) {
43
+ throw new Error ( 'KUBO_GATEWAY not set' )
44
+ }
42
45
await page . goto ( 'http://127.0.0.1:3333' , { waitUntil : 'networkidle' } )
43
46
await waitForServiceWorker ( page )
44
47
await setConfig ( {
45
48
page,
46
49
config : {
47
- gateways : [ process . env . KUBO_GATEWAY as string ] ,
48
- routers : [ process . env . KUBO_GATEWAY as string ] ,
50
+ gateways : [ process . env . KUBO_GATEWAY ] ,
51
+ routers : [ process . env . KUBO_GATEWAY ] ,
49
52
dnsJsonResolvers : {
50
53
'.' : 'https://delegated-ipfs.dev/dns-query'
51
54
}
@@ -73,6 +76,8 @@ export const testPathRouting = test.extend<{ rootDomain: string, baseURL: string
73
76
* })
74
77
* })
75
78
* ```
79
+ *
80
+ * TODO: do not set config on subdomains automatically.. this should be done by the application
76
81
*/
77
82
export const testSubdomainRouting = test . extend < { rootDomain : string , baseURL : string , protocol : string } > ( {
78
83
rootDomain : [ rootDomain , { scope : 'test' } ] ,
@@ -81,6 +86,10 @@ export const testSubdomainRouting = test.extend<{ rootDomain: string, baseURL: s
81
86
await page . goto ( baseURL , { waitUntil : 'networkidle' } )
82
87
await waitForServiceWorker ( page )
83
88
89
+ if ( process . env . KUBO_GATEWAY == null || process . env . KUBO_GATEWAY === '' ) {
90
+ throw new Error ( 'KUBO_GATEWAY not set' )
91
+ }
92
+ const kuboGateway = process . env . KUBO_GATEWAY
84
93
const oldPageGoto = page . goto . bind ( page )
85
94
page . goto = async ( url : Parameters < Page [ 'goto' ] > [ 0 ] , options : Parameters < Page [ 'goto' ] > [ 1 ] ) : ReturnType < Page [ 'goto' ] > => {
86
95
const response = await oldPageGoto ( url , options )
@@ -89,8 +98,8 @@ export const testSubdomainRouting = test.extend<{ rootDomain: string, baseURL: s
89
98
page,
90
99
config : {
91
100
autoReload : true ,
92
- gateways : [ process . env . KUBO_GATEWAY as string ] ,
93
- routers : [ process . env . KUBO_GATEWAY as string ] ,
101
+ gateways : [ kuboGateway ] ,
102
+ routers : [ kuboGateway ] ,
94
103
dnsJsonResolvers : {
95
104
'.' : 'https://delegated-ipfs.dev/dns-query'
96
105
}
@@ -107,8 +116,8 @@ export const testSubdomainRouting = test.extend<{ rootDomain: string, baseURL: s
107
116
page,
108
117
config : {
109
118
autoReload : true ,
110
- gateways : [ process . env . KUBO_GATEWAY as string ] ,
111
- routers : [ process . env . KUBO_GATEWAY as string ] ,
119
+ gateways : [ kuboGateway ] ,
120
+ routers : [ kuboGateway ] ,
112
121
dnsJsonResolvers : {
113
122
'.' : 'https://delegated-ipfs.dev/dns-query'
114
123
}
0 commit comments