21
21
const GlobalCatalogV1 = require ( '../dist/global-catalog/v1' ) ;
22
22
const { readExternalSources, streamToPromise } = require ( 'ibm-cloud-sdk-core' ) ;
23
23
const authHelper = require ( '../test/resources/auth-helper.js' ) ;
24
- const { CreateCatalogEntryConstants, UpdateCatalogEntryConstants } = require ( '../dist/global-catalog/v1' ) ;
24
+ const {
25
+ CreateCatalogEntryConstants,
26
+ UpdateCatalogEntryConstants,
27
+ } = require ( '../dist/global-catalog/v1' ) ;
25
28
const { v4 : uuidv4 } = require ( 'uuid' ) ;
26
29
27
30
//
@@ -51,6 +54,8 @@ const originalWarn = console.warn;
51
54
const consoleLogMock = jest . spyOn ( console , 'log' ) ;
52
55
const consoleWarnMock = jest . spyOn ( console , 'warn' ) ;
53
56
57
+ let catalogObject = { } ;
58
+
54
59
describe ( 'GlobalCatalogV1' , ( ) => {
55
60
jest . setTimeout ( timeout ) ;
56
61
@@ -65,13 +70,11 @@ describe('GlobalCatalogV1', () => {
65
70
// Global variables to hold values shared between testcases.
66
71
let catalogEntryId ;
67
72
68
-
69
73
test ( 'createCatalogEntry request example' , async ( ) => {
70
-
71
- consoleLogMock . mockImplementation ( output => {
74
+ consoleLogMock . mockImplementation ( ( output ) => {
72
75
originalLog ( output ) ;
73
76
} ) ;
74
- consoleWarnMock . mockImplementation ( output => {
77
+ consoleWarnMock . mockImplementation ( ( output ) => {
75
78
originalWarn ( output ) ;
76
79
// when the test fails we need to print out the error message and stop execution right after it
77
80
expect ( true ) . toBeFalsy ( ) ;
@@ -82,7 +85,8 @@ describe('GlobalCatalogV1', () => {
82
85
const overviewModelEN = {
83
86
display_name : 'Example Web Starter' ,
84
87
description : 'Use the Example service in your applications' ,
85
- long_description : 'This is a starter that helps you use the Example service within your applications.' ,
88
+ long_description :
89
+ 'This is a starter that helps you use the Example service within your applications.' ,
86
90
} ;
87
91
const overviewUIModel = {
88
92
en : overviewModelEN ,
@@ -129,11 +133,10 @@ describe('GlobalCatalogV1', () => {
129
133
// end-create_catalog_entry
130
134
} ) ;
131
135
test ( 'getCatalogEntry request example' , async ( ) => {
132
-
133
- consoleLogMock . mockImplementation ( output => {
136
+ consoleLogMock . mockImplementation ( ( output ) => {
134
137
originalLog ( output ) ;
135
138
} ) ;
136
- consoleWarnMock . mockImplementation ( output => {
139
+ consoleWarnMock . mockImplementation ( ( output ) => {
137
140
originalWarn ( output ) ;
138
141
// when the test fails we need to print out the error message and stop execution right after it
139
142
expect ( true ) . toBeFalsy ( ) ;
@@ -151,6 +154,8 @@ describe('GlobalCatalogV1', () => {
151
154
152
155
try {
153
156
const res = await globalCatalogService . getCatalogEntry ( params ) ;
157
+ catalogObject = res . result ;
158
+
154
159
console . log ( JSON . stringify ( res . result , null , 2 ) ) ;
155
160
} catch ( err ) {
156
161
console . warn ( err ) ;
@@ -159,11 +164,10 @@ describe('GlobalCatalogV1', () => {
159
164
// end-get_catalog_entry
160
165
} ) ;
161
166
test ( 'updateCatalogEntry request example' , async ( ) => {
162
-
163
- consoleLogMock . mockImplementation ( output => {
167
+ consoleLogMock . mockImplementation ( ( output ) => {
164
168
originalLog ( output ) ;
165
169
} ) ;
166
- consoleWarnMock . mockImplementation ( output => {
170
+ consoleWarnMock . mockImplementation ( ( output ) => {
167
171
originalWarn ( output ) ;
168
172
// when the test fails we need to print out the error message and stop execution right after it
169
173
expect ( true ) . toBeFalsy ( ) ;
@@ -176,7 +180,8 @@ describe('GlobalCatalogV1', () => {
176
180
const overviewModelEN = {
177
181
display_name : 'Example Web Starter V2' ,
178
182
description : 'Use the Example V2 service in your applications' ,
179
- long_description : 'This is a starter that helps you use the Example V2 service within your applications.' ,
183
+ long_description :
184
+ 'This is a starter that helps you use the Example V2 service within your applications.' ,
180
185
} ;
181
186
const overviewUIModel = {
182
187
en : overviewModelEN ,
@@ -209,6 +214,7 @@ describe('GlobalCatalogV1', () => {
209
214
provider : providerModel ,
210
215
active : true ,
211
216
metadata : metadataModel ,
217
+ url : catalogObject . url ,
212
218
} ;
213
219
214
220
try {
@@ -221,11 +227,10 @@ describe('GlobalCatalogV1', () => {
221
227
// end-update_catalog_entry
222
228
} ) ;
223
229
test ( 'listCatalogEntries request example' , async ( ) => {
224
-
225
- consoleLogMock . mockImplementation ( output => {
230
+ consoleLogMock . mockImplementation ( ( output ) => {
226
231
originalLog ( output ) ;
227
232
} ) ;
228
- consoleWarnMock . mockImplementation ( output => {
233
+ consoleWarnMock . mockImplementation ( ( output ) => {
229
234
originalWarn ( output ) ;
230
235
// when the test fails we need to print out the error message and stop execution right after it
231
236
expect ( true ) . toBeFalsy ( ) ;
@@ -249,11 +254,10 @@ describe('GlobalCatalogV1', () => {
249
254
// end-list_catalog_entries
250
255
} ) ;
251
256
test ( 'getChildObjects request example' , async ( ) => {
252
-
253
- consoleLogMock . mockImplementation ( output => {
257
+ consoleLogMock . mockImplementation ( ( output ) => {
254
258
originalLog ( output ) ;
255
259
} ) ;
256
- consoleWarnMock . mockImplementation ( output => {
260
+ consoleWarnMock . mockImplementation ( ( output ) => {
257
261
originalWarn ( output ) ;
258
262
// when the test fails we need to print out the error message and stop execution right after it
259
263
expect ( true ) . toBeFalsy ( ) ;
@@ -282,11 +286,10 @@ describe('GlobalCatalogV1', () => {
282
286
// end-get_child_objects
283
287
} ) ;
284
288
test ( 'restoreCatalogEntry request example' , async ( ) => {
285
-
286
- consoleLogMock . mockImplementation ( output => {
289
+ consoleLogMock . mockImplementation ( ( output ) => {
287
290
originalLog ( output ) ;
288
291
} ) ;
289
- consoleWarnMock . mockImplementation ( output => {
292
+ consoleWarnMock . mockImplementation ( ( output ) => {
290
293
originalWarn ( output ) ;
291
294
// when the test fails we need to print out the error message and stop execution right after it
292
295
expect ( true ) . toBeFalsy ( ) ;
@@ -309,11 +312,10 @@ describe('GlobalCatalogV1', () => {
309
312
// end-restore_catalog_entry
310
313
} ) ;
311
314
test ( 'getVisibility request example' , async ( ) => {
312
-
313
- consoleLogMock . mockImplementation ( output => {
315
+ consoleLogMock . mockImplementation ( ( output ) => {
314
316
originalLog ( output ) ;
315
317
} ) ;
316
- consoleWarnMock . mockImplementation ( output => {
318
+ consoleWarnMock . mockImplementation ( ( output ) => {
317
319
originalWarn ( output ) ;
318
320
// when the test fails we need to print out the error message and stop execution right after it
319
321
expect ( true ) . toBeFalsy ( ) ;
@@ -338,11 +340,10 @@ describe('GlobalCatalogV1', () => {
338
340
// end-get_visibility
339
341
} ) ;
340
342
test ( 'updateVisibility request example' , async ( ) => {
341
-
342
- consoleLogMock . mockImplementation ( output => {
343
+ consoleLogMock . mockImplementation ( ( output ) => {
343
344
originalLog ( output ) ;
344
345
} ) ;
345
- consoleWarnMock . mockImplementation ( output => {
346
+ consoleWarnMock . mockImplementation ( ( output ) => {
346
347
originalWarn ( output ) ;
347
348
// when the test fails we need to print out the error message and stop execution right after it
348
349
expect ( true ) . toBeFalsy ( ) ;
@@ -366,11 +367,10 @@ describe('GlobalCatalogV1', () => {
366
367
// end-update_visibility
367
368
} ) ;
368
369
test ( 'getPricing request example' , async ( ) => {
369
-
370
- consoleLogMock . mockImplementation ( output => {
370
+ consoleLogMock . mockImplementation ( ( output ) => {
371
371
originalLog ( output ) ;
372
372
} ) ;
373
- consoleWarnMock . mockImplementation ( output => {
373
+ consoleWarnMock . mockImplementation ( ( output ) => {
374
374
originalWarn ( output ) ;
375
375
// when the test fails we need to print out the error message and stop execution right after it
376
376
expect ( true ) . toBeFalsy ( ) ;
@@ -395,11 +395,10 @@ describe('GlobalCatalogV1', () => {
395
395
// end-get_pricing
396
396
} ) ;
397
397
test ( 'getAuditLogs request example' , async ( ) => {
398
-
399
- consoleLogMock . mockImplementation ( output => {
398
+ consoleLogMock . mockImplementation ( ( output ) => {
400
399
originalLog ( output ) ;
401
400
} ) ;
402
- consoleWarnMock . mockImplementation ( output => {
401
+ consoleWarnMock . mockImplementation ( ( output ) => {
403
402
originalWarn ( output ) ;
404
403
// when the test fails we need to print out the error message and stop execution right after it
405
404
expect ( true ) . toBeFalsy ( ) ;
@@ -426,11 +425,10 @@ describe('GlobalCatalogV1', () => {
426
425
// end-get_audit_logs
427
426
} ) ;
428
427
test ( 'uploadArtifact request example' , async ( ) => {
429
-
430
- consoleLogMock . mockImplementation ( output => {
428
+ consoleLogMock . mockImplementation ( ( output ) => {
431
429
originalLog ( output ) ;
432
430
} ) ;
433
- consoleWarnMock . mockImplementation ( output => {
431
+ consoleWarnMock . mockImplementation ( ( output ) => {
434
432
originalWarn ( output ) ;
435
433
// when the test fails we need to print out the error message and stop execution right after it
436
434
expect ( true ) . toBeFalsy ( ) ;
@@ -455,11 +453,10 @@ describe('GlobalCatalogV1', () => {
455
453
// end-upload_artifact
456
454
} ) ;
457
455
test ( 'getArtifact request example' , async ( ) => {
458
-
459
- consoleLogMock . mockImplementation ( output => {
456
+ consoleLogMock . mockImplementation ( ( output ) => {
460
457
originalLog ( output ) ;
461
458
} ) ;
462
- consoleWarnMock . mockImplementation ( output => {
459
+ consoleWarnMock . mockImplementation ( ( output ) => {
463
460
originalWarn ( output ) ;
464
461
// when the test fails we need to print out the error message and stop execution right after it
465
462
expect ( true ) . toBeFalsy ( ) ;
@@ -489,11 +486,10 @@ describe('GlobalCatalogV1', () => {
489
486
// end-get_artifact
490
487
} ) ;
491
488
test ( 'listArtifacts request example' , async ( ) => {
492
-
493
- consoleLogMock . mockImplementation ( output => {
489
+ consoleLogMock . mockImplementation ( ( output ) => {
494
490
originalLog ( output ) ;
495
491
} ) ;
496
- consoleWarnMock . mockImplementation ( output => {
492
+ consoleWarnMock . mockImplementation ( ( output ) => {
497
493
originalWarn ( output ) ;
498
494
// when the test fails we need to print out the error message and stop execution right after it
499
495
expect ( true ) . toBeFalsy ( ) ;
@@ -518,11 +514,10 @@ describe('GlobalCatalogV1', () => {
518
514
// end-list_artifacts
519
515
} ) ;
520
516
test ( 'deleteArtifact request example' , async ( ) => {
521
-
522
- consoleLogMock . mockImplementation ( output => {
517
+ consoleLogMock . mockImplementation ( ( output ) => {
523
518
originalLog ( output ) ;
524
519
} ) ;
525
- consoleWarnMock . mockImplementation ( output => {
520
+ consoleWarnMock . mockImplementation ( ( output ) => {
526
521
originalWarn ( output ) ;
527
522
// when the test fails we need to print out the error message and stop execution right after it
528
523
expect ( true ) . toBeFalsy ( ) ;
@@ -546,11 +541,10 @@ describe('GlobalCatalogV1', () => {
546
541
// end-delete_artifact
547
542
} ) ;
548
543
test ( 'deleteCatalogEntry request example' , async ( ) => {
549
-
550
- consoleLogMock . mockImplementation ( output => {
544
+ consoleLogMock . mockImplementation ( ( output ) => {
551
545
originalLog ( output ) ;
552
546
} ) ;
553
- consoleWarnMock . mockImplementation ( output => {
547
+ consoleWarnMock . mockImplementation ( ( output ) => {
554
548
originalWarn ( output ) ;
555
549
// when the test fails we need to print out the error message and stop execution right after it
556
550
expect ( true ) . toBeFalsy ( ) ;
0 commit comments