mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
Fix test
This commit is contained in:
1 parent
efb36a3d39
commit
3e2d22ea36
1 file changed
+4
-5
@@ -1,9 +1,8 @@
|
||||
import { getReturnToPath } from 'lib/gotrue'
|
||||
import { DEFAULT_HOME } from 'lib/constants'
|
||||
|
||||
describe(`getReturnToPath`, () => {
|
||||
it(`returns to /projects when no fallback is provided`, () => {
|
||||
expect(getReturnToPath()).toBe(DEFAULT_HOME)
|
||||
expect(getReturnToPath()).toBe('/projects')
|
||||
})
|
||||
|
||||
it(`returns to /custom when fallback is provided`, () => {
|
||||
@@ -34,7 +33,7 @@ describe(`getReturnToPath`, () => {
|
||||
// @ts-ignore
|
||||
window.location = { search: `?returnTo=https://google.com` }
|
||||
|
||||
expect(getReturnToPath()).toBe(DEFAULT_HOME)
|
||||
expect(getReturnToPath()).toBe('/projects')
|
||||
})
|
||||
|
||||
it(`does not allow XSS`, () => {
|
||||
@@ -43,7 +42,7 @@ describe(`getReturnToPath`, () => {
|
||||
// @ts-ignore
|
||||
window.location = { search: `?returnTo=javascript:alert(1)` }
|
||||
|
||||
expect(getReturnToPath()).toBe(DEFAULT_HOME)
|
||||
expect(getReturnToPath()).toBe('/projects')
|
||||
})
|
||||
|
||||
it(`does not allow XSS with encoded characters`, () => {
|
||||
@@ -52,6 +51,6 @@ describe(`getReturnToPath`, () => {
|
||||
// @ts-ignore
|
||||
window.location = { search: `?returnTo=javascript%3Aalert%281%29` }
|
||||
|
||||
expect(getReturnToPath()).toBe(DEFAULT_HOME)
|
||||
expect(getReturnToPath()).toBe('/projects')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user