From bfccd1ea5330bfaa7be766fd51e602acdfc4bb15 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Mon, 31 Jul 2023 11:43:09 +0800 Subject: [PATCH] Update test --- studio/tests/unit/get-return-to-path.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/studio/tests/unit/get-return-to-path.test.ts b/studio/tests/unit/get-return-to-path.test.ts index f7951444c17..5b11a40ae13 100644 --- a/studio/tests/unit/get-return-to-path.test.ts +++ b/studio/tests/unit/get-return-to-path.test.ts @@ -1,8 +1,9 @@ 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('/projects') + expect(getReturnToPath()).toBe(DEFAULT_HOME) }) it(`returns to /custom when fallback is provided`, () => { @@ -33,7 +34,7 @@ describe(`getReturnToPath`, () => { // @ts-ignore window.location = { search: `?returnTo=https://google.com` } - expect(getReturnToPath()).toBe('/projects') + expect(getReturnToPath()).toBe(DEFAULT_HOME) }) it(`does not allow XSS`, () => { @@ -42,7 +43,7 @@ describe(`getReturnToPath`, () => { // @ts-ignore window.location = { search: `?returnTo=javascript:alert(1)` } - expect(getReturnToPath()).toBe('/projects') + expect(getReturnToPath()).toBe(DEFAULT_HOME) }) it(`does not allow XSS with encoded characters`, () => { @@ -51,6 +52,6 @@ describe(`getReturnToPath`, () => { // @ts-ignore window.location = { search: `?returnTo=javascript%3Aalert%281%29` } - expect(getReturnToPath()).toBe('/projects') + expect(getReturnToPath()).toBe(DEFAULT_HOME) }) })