1
1
import { APIClient } from '../src/core/client'
2
- import EnvironmentController from '../src/controllers/environment/environment '
2
+ import EnvironmentController from '../src/controllers/environment'
3
3
4
- describe ( 'Get Environments Tests' , ( ) => {
4
+ describe ( 'Environments Controller Tests' , ( ) => {
5
5
const backendUrl = process . env . BACKEND_URL
6
6
7
7
const client = new APIClient ( backendUrl )
@@ -10,7 +10,7 @@ describe('Get Environments Tests', () => {
10
10
const email = 'johndoe@example.com'
11
11
let projectId : string | null
12
12
let workspaceId : string | null
13
- let environment : any
13
+ let environmentId : string | null
14
14
15
15
beforeAll ( async ( ) => {
16
16
//Create the user's workspace
@@ -66,12 +66,12 @@ describe('Get Environments Tests', () => {
66
66
)
67
67
) . json ( ) ) as any
68
68
69
- environment = createEnvironmentResponse
69
+ environmentId = createEnvironmentResponse . id
70
70
} )
71
71
72
72
afterEach ( async ( ) => {
73
73
// Delete the environment
74
- await client . delete ( `/api/environment/${ environment . id } ` , {
74
+ await client . delete ( `/api/environment/${ environmentId } ` , {
75
75
'x-e2e-user-email' : email
76
76
} )
77
77
} )
@@ -112,15 +112,15 @@ describe('Get Environments Tests', () => {
112
112
const environmentResponse = (
113
113
await environmentController . getEnvironmentById (
114
114
{
115
- id : environment . id
115
+ id : environmentId
116
116
} ,
117
117
{
118
118
'x-e2e-user-email' : email
119
119
}
120
120
)
121
121
) . data
122
122
123
- expect ( environmentResponse . id ) . toBe ( environment . id )
123
+ expect ( environmentResponse . id ) . toBe ( environmentId )
124
124
expect ( environmentResponse . name ) . toBe ( 'Dev' )
125
125
} )
126
126
@@ -157,7 +157,7 @@ describe('Get Environments Tests', () => {
157
157
const updateEnvironmentResponse = (
158
158
await environmentController . updateEnvironment (
159
159
{
160
- id : environment . id ,
160
+ id : environmentId ,
161
161
name : 'Prod'
162
162
} ,
163
163
{
@@ -169,7 +169,7 @@ describe('Get Environments Tests', () => {
169
169
expect ( updateEnvironmentResponse . name ) . toBe ( 'Prod' )
170
170
171
171
const fetchEnvironmentResponse = ( await (
172
- await client . get ( `/api/environment/${ environment . id } ` , {
172
+ await client . get ( `/api/environment/${ environmentId } ` , {
173
173
'x-e2e-user-email' : email
174
174
} )
175
175
) . json ( ) ) as any
0 commit comments