Skip to content

Commit b6437f8

Browse files
fix unit tests
1 parent df45a96 commit b6437f8

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/components/request_interceptor.test.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const makeNavigationEvent = (url: string) =>
2828

2929
describe("makeRequestInterceptor", () => {
3030
test("it returns a navigation event handler", () => {
31-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
31+
const fn = makeRequestInterceptor("https://mx.com/", {
3232
onIntercept: (url) => handler(url, {}),
3333
})
3434
const req = makeNavigationEvent("https://mx.com/page2")
@@ -38,7 +38,7 @@ describe("makeRequestInterceptor", () => {
3838

3939
describe("actions", () => {
4040
test("it bubbles the widget url back up to be loaded in the webview", () => {
41-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
41+
const fn = makeRequestInterceptor("https://mx.com/", {
4242
onIntercept: (url) => handler(url, {}),
4343
})
4444
const req = makeNavigationEvent("https://mx.com/")
@@ -47,7 +47,7 @@ describe("makeRequestInterceptor", () => {
4747
})
4848

4949
test("it intercepts other urls", () => {
50-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
50+
const fn = makeRequestInterceptor("https://mx.com/", {
5151
onIntercept: (url) => handler(url, {}),
5252
})
5353
const req = makeNavigationEvent("https://mx.com/page2")
@@ -56,16 +56,16 @@ describe("makeRequestInterceptor", () => {
5656
})
5757

5858
test("it intercepts post message urls", () => {
59-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
59+
const fn = makeRequestInterceptor("https://mx.com/", {
6060
onIntercept: (url) => handler(url, {}),
6161
})
62-
const req = makeNavigationEvent("appscheme://connect/loaded")
62+
const req = makeNavigationEvent("mx://connect/loaded")
6363

6464
expect(fn(req)).toBe(false)
6565
})
6666

6767
test("it calls loadUrlInBrowser for external urls", () => {
68-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
68+
const fn = makeRequestInterceptor("https://mx.com/", {
6969
onIntercept: (url) => handler(url, {}),
7070
})
7171
const externalUrl = "https://example.com/page"
@@ -85,8 +85,8 @@ describe("makeRequestInterceptor", () => {
8585
}
8686

8787
const metadata = encodeURIComponent(JSON.stringify({}))
88-
const newUrl = `appscheme://load?metadata=${metadata}`
89-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
88+
const newUrl = `mx://load?metadata=${metadata}`
89+
const fn = makeRequestInterceptor("https://mx.com/", {
9090
onIntercept: (url) => handler(url, callbacks),
9191
})
9292
const req = makeNavigationEvent(newUrl)
@@ -104,8 +104,8 @@ describe("makeRequestInterceptor", () => {
104104
}
105105

106106
const metadata = encodeURIComponent(JSON.stringify({}))
107-
const newUrl = `appscheme://load?metadata=${metadata}`
108-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
107+
const newUrl = `mx://load?metadata=${metadata}`
108+
const fn = makeRequestInterceptor("https://mx.com/", {
109109
onIntercept: (url) => handler(url, callbacks),
110110
})
111111
const req = makeNavigationEvent(newUrl)
@@ -122,8 +122,8 @@ describe("makeRequestInterceptor", () => {
122122
}
123123

124124
const metadata = encodeURIComponent(JSON.stringify({ guid }))
125-
const newUrl = `appscheme://account/created?metadata=${metadata}`
126-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
125+
const newUrl = `mx://account/created?metadata=${metadata}`
126+
const fn = makeRequestInterceptor("https://mx.com/", {
127127
onIntercept: (url) => handler(url, callbacks),
128128
})
129129
const req = makeNavigationEvent(newUrl)
@@ -147,8 +147,8 @@ describe("makeRequestInterceptor", () => {
147147
}
148148

149149
const metadata = encodeURIComponent(JSON.stringify({ user_guid, session_guid, initial_step }))
150-
const newUrl = `appscheme://connect/loaded?metadata=${metadata}`
151-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
150+
const newUrl = `mx://connect/loaded?metadata=${metadata}`
151+
const fn = makeRequestInterceptor("https://mx.com/", {
152152
onIntercept: (url) => handler(url, callbacks),
153153
})
154154
const req = makeNavigationEvent(newUrl)
@@ -168,8 +168,8 @@ describe("makeRequestInterceptor", () => {
168168
}
169169

170170
const metadata = encodeURIComponent(JSON.stringify({ user_guid, session_guid }))
171-
const newUrl = `appscheme://connect/loaded?metadata=${metadata}`
172-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
171+
const newUrl = `mx://connect/loaded?metadata=${metadata}`
172+
const fn = makeRequestInterceptor("https://mx.com/", {
173173
onIntercept: (url) => handler(url, callbacks),
174174
})
175175
const req = makeNavigationEvent(newUrl)
@@ -184,8 +184,8 @@ describe("makeRequestInterceptor", () => {
184184
onInvalidMessageError: (url: string, _error: Error) => expect(url).toBe(newUrl),
185185
}
186186

187-
const newUrl = "appscheme://connect/notARealMessage?metadata="
188-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
187+
const newUrl = "mx://connect/notARealMessage?metadata="
188+
const fn = makeRequestInterceptor("https://mx.com/", {
189189
onIntercept: (url) => handler(url, callbacks),
190190
})
191191
const req = makeNavigationEvent(newUrl)
@@ -220,8 +220,8 @@ describe("makeRequestInterceptor", () => {
220220
}),
221221
)
222222

223-
const newUrl = `appscheme://connect/updateCredentials?metadata=${metadata}`
224-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
223+
const newUrl = `mx://connect/updateCredentials?metadata=${metadata}`
224+
const fn = makeRequestInterceptor("https://mx.com/", {
225225
onIntercept: (url) => handler(url, callbacks),
226226
})
227227
const req = makeNavigationEvent(newUrl)
@@ -238,8 +238,8 @@ describe("makeRequestInterceptor", () => {
238238
}
239239

240240
const metadata = encodeURIComponent(JSON.stringify({}))
241-
const newUrl = `appscheme://load?metadata=${metadata}`
242-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
241+
const newUrl = `mx://load?metadata=${metadata}`
242+
const fn = makeRequestInterceptor("https://mx.com/", {
243243
onIntercept: (url) => handler(url, callbacks),
244244
})
245245
const req = makeNavigationEvent(newUrl)
@@ -255,8 +255,8 @@ describe("makeRequestInterceptor", () => {
255255
onInvalidMessageError: (url: string, _error: Error) => expect(url).toBeDefined(),
256256
}
257257

258-
const newUrl = "appscheme://connect/notARealMessage?metadata="
259-
const fn = makeRequestInterceptor("https://mx.com/", "appscheme", {
258+
const newUrl = "mx://connect/notARealMessage?metadata="
259+
const fn = makeRequestInterceptor("https://mx.com/", {
260260
onIntercept: (url) => handler(url, callbacks),
261261
})
262262
const req = makeNavigationEvent(newUrl)

0 commit comments

Comments
 (0)