@@ -13,39 +13,15 @@ import OrganizationSettingsPage from "./OrganizationSettingsPage";
13
13
14
14
jest . spyOn ( console , "error" ) . mockImplementation ( ( ) => { } ) ;
15
15
16
- const renderRootPage = async ( ) => {
16
+ const renderPage = async ( ) => {
17
17
renderWithManagementSettingsLayout ( < OrganizationSettingsPage /> , {
18
18
route : "/organizations" ,
19
19
path : "/organizations/:organization?" ,
20
20
} ) ;
21
21
await waitForLoaderToBeRemoved ( ) ;
22
22
} ;
23
23
24
- const renderPage = async ( orgName : string ) => {
25
- renderWithManagementSettingsLayout ( < OrganizationSettingsPage /> , {
26
- route : `/organizations/${ orgName } ` ,
27
- path : "/organizations/:organization" ,
28
- } ) ;
29
- await waitForLoaderToBeRemoved ( ) ;
30
- } ;
31
-
32
24
describe ( "OrganizationSettingsPage" , ( ) => {
33
- it ( "has no organizations" , async ( ) => {
34
- server . use (
35
- http . get ( "/api/v2/organizations" , ( ) => {
36
- return HttpResponse . json ( [ ] ) ;
37
- } ) ,
38
- http . post ( "/api/v2/authcheck" , async ( ) => {
39
- return HttpResponse . json ( {
40
- [ `${ MockDefaultOrganization . id } .editOrganization` ] : true ,
41
- viewDeploymentValues : true ,
42
- } ) ;
43
- } ) ,
44
- ) ;
45
- await renderRootPage ( ) ;
46
- await screen . findByText ( "No organizations found" ) ;
47
- } ) ;
48
-
49
25
it ( "has no editable organizations" , async ( ) => {
50
26
server . use (
51
27
http . get ( "/api/v2/organizations" , ( ) => {
@@ -57,7 +33,7 @@ describe("OrganizationSettingsPage", () => {
57
33
} ) ;
58
34
} ) ,
59
35
) ;
60
- await renderRootPage ( ) ;
36
+ await renderPage ( ) ;
61
37
await screen . findByText ( "No organizations found" ) ;
62
38
} ) ;
63
39
@@ -75,7 +51,7 @@ describe("OrganizationSettingsPage", () => {
75
51
} ) ;
76
52
} ) ,
77
53
) ;
78
- await renderRootPage ( ) ;
54
+ await renderPage ( ) ;
79
55
const form = screen . getByTestId ( "org-settings-form" ) ;
80
56
expect ( within ( form ) . getByRole ( "textbox" , { name : "Name" } ) ) . toHaveValue (
81
57
MockDefaultOrganization . name ,
@@ -94,26 +70,10 @@ describe("OrganizationSettingsPage", () => {
94
70
} ) ;
95
71
} ) ,
96
72
) ;
97
- await renderRootPage ( ) ;
73
+ await renderPage ( ) ;
98
74
const form = screen . getByTestId ( "org-settings-form" ) ;
99
75
expect ( within ( form ) . getByRole ( "textbox" , { name : "Name" } ) ) . toHaveValue (
100
76
MockOrganization2 . name ,
101
77
) ;
102
78
} ) ;
103
-
104
- it ( "cannot find organization" , async ( ) => {
105
- server . use (
106
- http . get ( "/api/v2/organizations" , ( ) => {
107
- return HttpResponse . json ( [ MockDefaultOrganization , MockOrganization2 ] ) ;
108
- } ) ,
109
- http . post ( "/api/v2/authcheck" , async ( ) => {
110
- return HttpResponse . json ( {
111
- [ `${ MockOrganization2 . id } .editOrganization` ] : true ,
112
- viewDeploymentValues : true ,
113
- } ) ;
114
- } ) ,
115
- ) ;
116
- await renderPage ( "the-endless-void" ) ;
117
- await screen . findByText ( "Organization not found" ) ;
118
- } ) ;
119
79
} ) ;
0 commit comments