@@ -116,7 +116,7 @@ func TestFetchSnapshot(t *testing.T) {
116116func TestPushChangesToAPI (t * testing.T ) {
117117 t .Run ("Should push changes to API" , func (t * testing.T ) {
118118 // Given
119- diff := givenDiffResult ()
119+ diff := givenDiffResult ("default" )
120120 fakeApiServer := givenApiResponse (http .StatusOK , `{
121121 "version": 2,
122122 "message": "Changes applied successfully"
@@ -126,7 +126,7 @@ func TestPushChangesToAPI(t *testing.T) {
126126 apiService := NewApiService (SWITCHER_API_JWT_SECRET , fakeApiServer .URL )
127127
128128 // Test
129- response , _ := apiService .PushChanges ("domainId" , "default" , diff )
129+ response , _ := apiService .PushChanges ("domainId" , diff )
130130
131131 // Assert
132132 assert .NotNil (t , response )
@@ -136,14 +136,14 @@ func TestPushChangesToAPI(t *testing.T) {
136136
137137 t .Run ("Should return error - invalid API key" , func (t * testing.T ) {
138138 // Given
139- diff := givenDiffResult ()
139+ diff := givenDiffResult ("default" )
140140 fakeApiServer := givenApiResponse (http .StatusUnauthorized , `{ "message": "Invalid API token" }` )
141141 defer fakeApiServer .Close ()
142142
143143 apiService := NewApiService ("[INVALID_KEY]" , fakeApiServer .URL )
144144
145145 // Test
146- response , _ := apiService .PushChanges ("domainId" , "default" , diff )
146+ response , _ := apiService .PushChanges ("domainId" , diff )
147147
148148 // Assert
149149 assert .NotNil (t , response )
@@ -152,11 +152,11 @@ func TestPushChangesToAPI(t *testing.T) {
152152
153153 t .Run ("Should return error - API not accessible" , func (t * testing.T ) {
154154 // Given
155- diff := givenDiffResult ()
155+ diff := givenDiffResult ("default" )
156156 apiService := NewApiService ("[SWITCHER_API_JWT_SECRET]" , "http://localhost:8080" )
157157
158158 // Test
159- _ , err := apiService .PushChanges ("domainId" , "default" , diff )
159+ _ , err := apiService .PushChanges ("domainId" , diff )
160160
161161 // Assert
162162 assert .NotNil (t , err )
@@ -165,8 +165,9 @@ func TestPushChangesToAPI(t *testing.T) {
165165
166166// Helpers
167167
168- func givenDiffResult () model.DiffResult {
168+ func givenDiffResult (environment string ) model.DiffResult {
169169 diffResult := model.DiffResult {}
170+ diffResult .Environment = environment
170171 diffResult .Changes = append (diffResult .Changes , model.DiffDetails {
171172 Action : string (NEW ),
172173 Diff : string (CONFIG ),
0 commit comments