@@ -24,7 +24,7 @@ const PlatformNotificationsV1 = require('../dist/platform-notifications/v1');
2424// eslint-disable-next-line node/no-unpublished-require
2525const authHelper = require ( '../test/resources/auth-helper.js' ) ;
2626// You can use the readExternalSources method to access additional configuration values
27- // const { readExternalSources } = require('ibm-cloud-sdk-core');
27+ const { readExternalSources } = require ( 'ibm-cloud-sdk-core' ) ;
2828
2929//
3030// This file provides an example of how to use the Platform Notifications service.
@@ -55,15 +55,24 @@ describe('PlatformNotificationsV1', () => {
5555 // Service instance
5656 let platformNotificationsService ;
5757
58- // To access additional configuration values, uncomment this line and extract the values from config
59- // const config = readExternalSources(PlatformNotificationsV1.DEFAULT_SERVICE_NAME);
58+ let accountId ;
59+ let destinationId ;
60+ let iamId ;
6061
61- test ( 'Initialize service' , async ( ) => {
62- // begin-common
62+ beforeAll ( ( ) => {
63+ const config = readExternalSources ( PlatformNotificationsV1 . DEFAULT_SERVICE_NAME ) ;
6364
64- platformNotificationsService = PlatformNotificationsV1 . newInstance ( ) ;
65+ platformNotificationsService = PlatformNotificationsV1 . newInstance ( {
66+ serviceUrl : config . serviceUrl ,
67+ } ) ;
68+ accountId = config . accountId ;
69+ destinationId = config . destinationId ;
70+ iamId = config . iamId ;
71+ platformNotificationsService . enableRetries ( ) ;
72+ } ) ;
6573
66- // end-common
74+ test ( 'Initialize service' , async ( ) => {
75+ expect ( platformNotificationsService ) . not . toBeNull ( ) ;
6776 } ) ;
6877
6978 test ( 'listDistributionListDestinations request example' , async ( ) => {
@@ -80,7 +89,7 @@ describe('PlatformNotificationsV1', () => {
8089 // begin-list_distribution_list_destinations
8190
8291 const params = {
83- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
92+ accountId,
8493 } ;
8594
8695 let res ;
@@ -111,12 +120,12 @@ describe('PlatformNotificationsV1', () => {
111120
112121 // AddDestinationPrototypeEventNotificationDestinationPrototype
113122 const addDestinationPrototypeModel = {
114- destination_id : '12345678-1234-1234-1234-123456789012' ,
123+ destination_id : destinationId ,
115124 destination_type : 'event_notifications' ,
116125 } ;
117126
118127 const params = {
119- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
128+ accountId,
120129 addDestinationPrototype : addDestinationPrototypeModel ,
121130 } ;
122131
@@ -145,8 +154,8 @@ describe('PlatformNotificationsV1', () => {
145154 // begin-get_distribution_list_destination
146155
147156 const params = {
148- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
149- destinationId : '12345678-1234-1234-1234-123456789012' ,
157+ accountId,
158+ destinationId,
150159 } ;
151160
152161 let res ;
@@ -182,8 +191,8 @@ describe('PlatformNotificationsV1', () => {
182191 } ;
183192
184193 const params = {
185- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
186- destinationId : '12345678-1234-1234-1234-123456789012' ,
194+ accountId,
195+ destinationId,
187196 testDestinationRequestBodyPrototype : testDestinationRequestBodyPrototypeModel ,
188197 } ;
189198
@@ -225,10 +234,10 @@ describe('PlatformNotificationsV1', () => {
225234 } ;
226235
227236 const params = {
228- iamId : 'IBMid-1234567890' ,
237+ iamId,
229238 incidentSeverity1 : preferenceValueWithUpdatesModel ,
230239 orderingReview : preferenceValueWithoutUpdatesModel ,
231- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
240+ accountId,
232241 } ;
233242
234243 let res ;
@@ -256,8 +265,8 @@ describe('PlatformNotificationsV1', () => {
256265 // begin-get_preferences
257266
258267 const params = {
259- iamId : 'IBMid-1234567890' ,
260- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
268+ iamId,
269+ accountId,
261270 } ;
262271
263272 let res ;
@@ -298,10 +307,10 @@ describe('PlatformNotificationsV1', () => {
298307 } ;
299308
300309 const params = {
301- iamId : 'IBMid-1234567890' ,
310+ iamId,
302311 incidentSeverity1 : preferenceValueWithUpdatesModel ,
303312 orderingReview : preferenceValueWithoutUpdatesModel ,
304- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
313+ accountId,
305314 } ;
306315
307316 let res ;
@@ -329,7 +338,7 @@ describe('PlatformNotificationsV1', () => {
329338 // begin-list_notifications
330339
331340 const params = {
332- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
341+ accountId,
333342 limit : 50 ,
334343 } ;
335344
@@ -366,7 +375,7 @@ describe('PlatformNotificationsV1', () => {
366375 // begin-get_acknowledgement
367376
368377 const params = {
369- accountId : '1369339417d906e5620b8d861d40cfd7' ,
378+ accountId,
370379 } ;
371380
372381 let res ;
@@ -395,7 +404,7 @@ describe('PlatformNotificationsV1', () => {
395404
396405 const params = {
397406 lastAcknowledgedId : '1772804159452' ,
398- accountId : '1369339417d906e5620b8d861d40cfd7' ,
407+ accountId,
399408 } ;
400409
401410 let res ;
@@ -422,8 +431,8 @@ describe('PlatformNotificationsV1', () => {
422431 // begin-delete_distribution_list_destination
423432
424433 const params = {
425- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
426- destinationId : '12345678-1234-1234-1234-123456789012' ,
434+ accountId,
435+ destinationId,
427436 } ;
428437
429438 try {
@@ -448,8 +457,8 @@ describe('PlatformNotificationsV1', () => {
448457 // begin-delete_notification_preferences
449458
450459 const params = {
451- iamId : 'IBMid-1234567890' ,
452- accountId : 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6' ,
460+ iamId,
461+ accountId,
453462 } ;
454463
455464 try {
0 commit comments