@@ -32,8 +32,10 @@ func TestNewProjectFromNative(t *testing.T) {
32
32
Key : types .StringValue ("my-project" ),
33
33
Name : types .StringValue ("my project" ),
34
34
35
- EnableSearchIndexProducts : types .BoolValue (false ),
36
- EnableSearchIndexOrders : types .BoolValue (false ),
35
+ EnableSearchIndexProducts : types .BoolValue (false ),
36
+ EnableSearchIndexOrders : types .BoolValue (false ),
37
+ EnableSearchIndexCustomers : types .BoolValue (false ),
38
+ EnableSearchIndexProductSearch : types .BoolValue (false ),
37
39
38
40
ExternalOAuth : []ExternalOAuth {},
39
41
Carts : []Carts {
@@ -157,17 +159,15 @@ func TestUpdateActions(t *testing.T) {
157
159
},
158
160
},
159
161
{
160
- name : "Create with bool unknown " ,
162
+ name : "Update with search index orders activated " ,
161
163
state : Project {
162
- Version : types .Int64Value (1 ),
163
- EnableSearchIndexOrders : types .BoolValue (false ),
164
- EnableSearchIndexProducts : types .BoolValue (false ),
164
+ Version : types .Int64Value (1 ),
165
+ EnableSearchIndexOrders : types .BoolValue (false ),
165
166
},
166
167
plan : Project {
167
168
Version : types .Int64Value (1 ),
168
169
169
- EnableSearchIndexOrders : types .BoolValue (true ),
170
- EnableSearchIndexProducts : types .BoolUnknown (),
170
+ EnableSearchIndexOrders : types .BoolValue (true ),
171
171
},
172
172
action : platform.ProjectUpdate {
173
173
Version : 1 ,
@@ -176,6 +176,167 @@ func TestUpdateActions(t *testing.T) {
176
176
},
177
177
},
178
178
},
179
+ {
180
+ name : "Update with search index orders deactivated" ,
181
+ state : Project {
182
+ Version : types .Int64Value (1 ),
183
+ EnableSearchIndexOrders : types .BoolValue (true ),
184
+ },
185
+ plan : Project {
186
+ Version : types .Int64Value (1 ),
187
+ EnableSearchIndexOrders : types .BoolValue (false ),
188
+ },
189
+ action : platform.ProjectUpdate {
190
+ Version : 1 ,
191
+ Actions : []platform.ProjectUpdateAction {
192
+ platform.ProjectChangeOrderSearchStatusAction {Status : platform .OrderSearchStatusDeactivated },
193
+ },
194
+ },
195
+ },
196
+ {
197
+ name : "Update with search index orders no changes" ,
198
+ state : Project {
199
+ Version : types .Int64Value (1 ),
200
+ EnableSearchIndexOrders : types .BoolValue (false ),
201
+ },
202
+ plan : Project {
203
+ Version : types .Int64Value (1 ),
204
+ EnableSearchIndexOrders : types .BoolValue (false ),
205
+ },
206
+ action : platform.ProjectUpdate {
207
+ Version : 1 ,
208
+ Actions : []platform.ProjectUpdateAction {},
209
+ },
210
+ },
211
+ {
212
+ name : "Update with search index customers activated" ,
213
+ state : Project {
214
+ Version : types .Int64Value (1 ),
215
+ EnableSearchIndexCustomers : types .BoolValue (false ),
216
+ },
217
+ plan : Project {
218
+ Version : types .Int64Value (1 ),
219
+ EnableSearchIndexCustomers : types .BoolValue (true ),
220
+ },
221
+ action : platform.ProjectUpdate {
222
+ Version : 1 ,
223
+ Actions : []platform.ProjectUpdateAction {
224
+ platform.ProjectChangeCustomerSearchStatusAction {Status : platform .CustomerSearchStatusActivated },
225
+ },
226
+ },
227
+ },
228
+ {
229
+ name : "Update with search index customers deactivated" ,
230
+ state : Project {
231
+ Version : types .Int64Value (1 ),
232
+ EnableSearchIndexCustomers : types .BoolValue (true ),
233
+ },
234
+ plan : Project {
235
+ Version : types .Int64Value (1 ),
236
+ EnableSearchIndexCustomers : types .BoolValue (false ),
237
+ },
238
+ action : platform.ProjectUpdate {
239
+ Version : 1 ,
240
+ Actions : []platform.ProjectUpdateAction {
241
+ platform.ProjectChangeCustomerSearchStatusAction {Status : platform .CustomerSearchStatusDeactivated },
242
+ },
243
+ },
244
+ },
245
+ {
246
+ name : "Update with search index customers no changes" ,
247
+ state : Project {
248
+ Version : types .Int64Value (1 ),
249
+ EnableSearchIndexCustomers : types .BoolValue (false ),
250
+ },
251
+ plan : Project {
252
+ Version : types .Int64Value (1 ),
253
+ EnableSearchIndexCustomers : types .BoolValue (false ),
254
+ },
255
+ action : platform.ProjectUpdate {
256
+ Version : 1 ,
257
+ Actions : []platform.ProjectUpdateAction {},
258
+ },
259
+ },
260
+ {
261
+ name : "Update with search index products activated" ,
262
+ state : Project {
263
+ Version : types .Int64Value (1 ),
264
+ EnableSearchIndexProducts : types .BoolValue (false ),
265
+ },
266
+ plan : Project {
267
+ Version : types .Int64Value (1 ),
268
+ EnableSearchIndexProducts : types .BoolValue (true ),
269
+ },
270
+ action : platform.ProjectUpdate {
271
+ Version : 1 ,
272
+ Actions : []platform.ProjectUpdateAction {
273
+ platform.ProjectChangeProductSearchIndexingEnabledAction {
274
+ Enabled : true ,
275
+ Mode : utils .GetRef (platform .ProductSearchIndexingModeProductProjectionsSearch ),
276
+ },
277
+ },
278
+ },
279
+ },
280
+ {
281
+ name : "Update with search index products deactivated" ,
282
+ state : Project {
283
+ Version : types .Int64Value (1 ),
284
+ EnableSearchIndexProducts : types .BoolValue (true ),
285
+ },
286
+ plan : Project {
287
+ Version : types .Int64Value (1 ),
288
+ EnableSearchIndexProducts : types .BoolValue (false ),
289
+ },
290
+ action : platform.ProjectUpdate {
291
+ Version : 1 ,
292
+ Actions : []platform.ProjectUpdateAction {
293
+ platform.ProjectChangeProductSearchIndexingEnabledAction {
294
+ Enabled : false ,
295
+ Mode : utils .GetRef (platform .ProductSearchIndexingModeProductProjectionsSearch ),
296
+ },
297
+ },
298
+ },
299
+ },
300
+ {
301
+ name : "Update with search index product search activated" ,
302
+ state : Project {
303
+ Version : types .Int64Value (1 ),
304
+ EnableSearchIndexProductSearch : types .BoolValue (false ),
305
+ },
306
+ plan : Project {
307
+ Version : types .Int64Value (1 ),
308
+ EnableSearchIndexProductSearch : types .BoolValue (true ),
309
+ },
310
+ action : platform.ProjectUpdate {
311
+ Version : 1 ,
312
+ Actions : []platform.ProjectUpdateAction {
313
+ platform.ProjectChangeProductSearchIndexingEnabledAction {
314
+ Enabled : true ,
315
+ Mode : utils .GetRef (platform .ProductSearchIndexingModeProductsSearch ),
316
+ },
317
+ },
318
+ },
319
+ },
320
+ {
321
+ name : "Update with search index product search deactivated" ,
322
+ state : Project {
323
+ Version : types .Int64Value (1 ),
324
+ EnableSearchIndexProductSearch : types .BoolValue (true ),
325
+ },
326
+ plan : Project {
327
+ Version : types .Int64Value (1 ),
328
+ EnableSearchIndexProductSearch : types .BoolValue (false ),
329
+ },
330
+ action : platform.ProjectUpdate {
331
+ Version : 1 ,
332
+ Actions : []platform.ProjectUpdateAction {
333
+ platform.ProjectChangeProductSearchIndexingEnabledAction {
334
+ Enabled : false ,
335
+ Mode : utils .GetRef (platform .ProductSearchIndexingModeProductsSearch ),
336
+ },
337
+ },
338
+ },
339
+ },
179
340
{
180
341
name : "Create with business unit settings" ,
181
342
state : Project {
0 commit comments