@@ -48,35 +48,10 @@ test("renders title", () => {
48
48
const { getByRole } = renderComponent ( ) ;
49
49
50
50
expect (
51
- getByRole ( "heading" , { name : ' Workspace settings for " foo"' , level : 4 } ) ,
51
+ getByRole ( "heading" , { name : " Workspace settings for foo", level : 4 } ) ,
52
52
) . toBeVisible ( ) ;
53
53
} ) ;
54
54
55
- test ( "has a badge when editing the active workspace" , ( ) => {
56
- ( useParams as unknown as ReturnType < typeof vi . fn > ) . mockReturnValue ( {
57
- name : "baz" ,
58
- } ) ;
59
-
60
- const { getByRole } = renderComponent ( ) ;
61
-
62
- const heading = getByRole ( "heading" , {
63
- name : / .* w o r k s p a c e s e t t i n g s .* / i,
64
- level : 4 ,
65
- } ) ;
66
-
67
- expect ( within ( heading ) . getByText ( / a c t i v e / i) ) . toBeVisible ( ) ;
68
- } ) ;
69
-
70
- test ( "has no 'active workspace' badge when it's not the active workspace" , ( ) => {
71
- ( useParams as unknown as ReturnType < typeof vi . fn > ) . mockReturnValue ( {
72
- name : "another" ,
73
- } ) ;
74
-
75
- const { queryByText } = renderComponent ( ) ;
76
-
77
- expect ( queryByText ( / a c t i v e / i) ) . toBeNull ( ) ;
78
- } ) ;
79
-
80
55
test ( "renders workspace name input" , ( ) => {
81
56
const { getByRole } = renderComponent ( ) ;
82
57
@@ -105,6 +80,25 @@ test("has breadcrumbs", () => {
105
80
expect ( within ( breadcrumbs ) . getByText ( / w o r k s p a c e s e t t i n g s / i) ) . toBeVisible ( ) ;
106
81
} ) ;
107
82
83
+ test ( "rename workspace" , async ( ) => {
84
+ ( useParams as unknown as ReturnType < typeof vi . fn > ) . mockReturnValue ( {
85
+ name : "foo" ,
86
+ } ) ;
87
+ const { getByRole, getByTestId } = renderComponent ( ) ;
88
+
89
+ const workspaceName = getByRole ( "textbox" , {
90
+ name : / w o r k s p a c e n a m e / i,
91
+ } ) ;
92
+ await userEvent . type ( workspaceName , "_renamed" ) ;
93
+
94
+ const saveBtn = within ( getByTestId ( "workspace-name" ) ) . getByRole ( "button" , {
95
+ name : / s a v e / i,
96
+ } ) ;
97
+ await userEvent . click ( saveBtn ) ;
98
+ await waitFor ( ( ) => expect ( mockNavigate ) . toHaveBeenCalledTimes ( 1 ) ) ;
99
+ expect ( mockNavigate ) . toHaveBeenCalledWith ( "/workspace/foo_renamed" ) ;
100
+ } ) ;
101
+
108
102
test ( "revert changes button" , async ( ) => {
109
103
( useParams as unknown as ReturnType < typeof vi . fn > ) . mockReturnValue ( {
110
104
name : "foo" ,
@@ -152,22 +146,3 @@ test("revert changes button", async () => {
152
146
} ) ,
153
147
) . toHaveValue ( "foo" ) ;
154
148
} ) ;
155
-
156
- test ( "rename workspace" , async ( ) => {
157
- ( useParams as unknown as ReturnType < typeof vi . fn > ) . mockReturnValue ( {
158
- name : "foo" ,
159
- } ) ;
160
- const { getByRole, getByTestId } = renderComponent ( ) ;
161
-
162
- const workspaceName = getByRole ( "textbox" , {
163
- name : / w o r k s p a c e n a m e / i,
164
- } ) ;
165
- await userEvent . type ( workspaceName , "_renamed" ) ;
166
-
167
- const saveBtn = within ( getByTestId ( "workspace-name" ) ) . getByRole ( "button" , {
168
- name : / s a v e / i,
169
- } ) ;
170
- await userEvent . click ( saveBtn ) ;
171
- await waitFor ( ( ) => expect ( mockNavigate ) . toHaveBeenCalledTimes ( 1 ) ) ;
172
- expect ( mockNavigate ) . toHaveBeenCalledWith ( "/workspace/foo_renamed" ) ;
173
- } ) ;
0 commit comments