File tree 5 files changed +19
-8
lines changed
5 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { cleanup } from "@testing-library/react"
3
3
import crypto from "crypto"
4
4
import * as util from "util"
5
5
import { server } from "./src/testHelpers/server"
6
+ import "jest-location-mock"
6
7
7
8
// Polyfill the getRandomValues that is used on utils/random.ts
8
9
Object . defineProperty ( global . self , "crypto" , {
Original file line number Diff line number Diff line change 55
55
"front-matter" : " 4.0.2" ,
56
56
"history" : " 5.3.0" ,
57
57
"i18next" : " 21.9.1" ,
58
+ "jest-location-mock" : " 1.0.9" ,
58
59
"js-untar" : " 2.0.0" ,
59
60
"just-debounce-it" : " 3.1.1" ,
60
61
"playwright" : " ^1.29.2" ,
Original file line number Diff line number Diff line change @@ -94,8 +94,6 @@ describe("Setup Page", () => {
94
94
)
95
95
96
96
await fillForm ( )
97
- await waitFor ( ( ) =>
98
- expect ( history . location . pathname ) . toEqual ( "/workspaces" ) ,
99
- )
97
+ await waitFor ( ( ) => expect ( window . location ) . toBeAt ( "/workspaces" ) )
100
98
} )
101
99
} )
Original file line number Diff line number Diff line change 1
1
import { useActor , useMachine } from "@xstate/react"
2
2
import { FC , useContext , useEffect } from "react"
3
3
import { Helmet } from "react-helmet-async"
4
- import { useNavigate } from "react-router-dom"
5
4
import { pageTitle } from "util/page"
6
5
import { setupMachine } from "xServices/setup/setupXService"
7
6
import { XServiceContext } from "xServices/StateContext"
8
7
import { SetupPageView } from "./SetupPageView"
9
8
10
9
export const SetupPage : FC = ( ) => {
11
- const navigate = useNavigate ( )
12
10
const xServices = useContext ( XServiceContext )
13
11
const [ authState , authSend ] = useActor ( xServices . authXService )
14
12
const [ setupState , setupSend ] = useMachine ( setupMachine , {
@@ -30,9 +28,9 @@ export const SetupPage: FC = () => {
30
28
31
29
useEffect ( ( ) => {
32
30
if ( authState . matches ( "signedIn" ) ) {
33
- return navigate ( "/workspaces" )
31
+ window . location . assign ( "/workspaces" )
34
32
}
35
- } , [ authState , navigate ] )
33
+ } , [ authState ] )
36
34
37
35
return (
38
36
< >
Original file line number Diff line number Diff line change 1378
1378
resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98"
1379
1379
integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==
1380
1380
1381
+ "@jedmao/location@^3.0.0":
1382
+ version "3.0.0"
1383
+ resolved "https://registry.yarnpkg.com/@jedmao/location/-/location-3.0.0.tgz#f2b24e937386f95252f3a1fefbf7ca2e0a4b87e9"
1384
+ integrity sha512-p7mzNlgJbCioUYLUEKds3cQG4CHONVFJNYqMe6ocEtENCL/jYmMo1Q3ApwsMmU+L0ZkaDJEyv4HokaByLoPwlQ==
1385
+
1381
1386
"@jest/console@^27.5.1":
1382
1387
version "27.5.1"
1383
1388
resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.5.1.tgz#260fe7239602fe5130a94f1aa386eff54b014bba"
@@ -8671,7 +8676,7 @@ jest-config@^27.5.1:
8671
8676
slash "^3.0.0"
8672
8677
strip-json-comments "^3.1.1"
8673
8678
8674
- jest-diff@^27.5.1:
8679
+ jest-diff@^27.0.1, jest-diff@^27. 5.1:
8675
8680
version "27.5.1"
8676
8681
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.5.1.tgz#a07f5011ac9e6643cf8a95a462b7b1ecf6680def"
8677
8682
integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==
@@ -8839,6 +8844,14 @@ jest-leak-detector@^27.5.1:
8839
8844
jest-get-type "^27.5.1"
8840
8845
pretty-format "^27.5.1"
8841
8846
8847
+
8848
+ version "1.0.9"
8849
+ resolved "https://registry.yarnpkg.com/jest-location-mock/-/jest-location-mock-1.0.9.tgz#f4466362423b273e12ca3716467a3d478ce78fa8"
8850
+ integrity sha512-DN/v7Zsa3N4uGgWTCrMrPPxhZORr/4N5gi+u7Tk6sLdORYplrC0//wfFN5FOtx4ZdQzDVfY6rLa4d+wfTKzQHw==
8851
+ dependencies:
8852
+ "@jedmao/location" "^3.0.0"
8853
+ jest-diff "^27.0.1"
8854
+
8842
8855
jest-matcher-utils@^27.0.0, jest-matcher-utils@^27.5.1:
8843
8856
version "27.5.1"
8844
8857
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz#9c0cdbda8245bc22d2331729d1091308b40cf8ab"
You can’t perform that action at this time.
0 commit comments