@@ -18,6 +18,8 @@ const PROVISIONING_FAILURE = 3;
1818const CTRL_REQUEST_APP_CUSTOM = 10 ;
1919const GET_AT_COMMAND_STATUS = 4 ;
2020
21+ const TEST_ICCIDs = [ '89000123456789012341' , '89000123456789012358' ] ;
22+
2123module . exports = class ESimCommands extends CLICommandBase {
2224 constructor ( ) { // TODO: Bring ui class
2325 super ( ) ;
@@ -155,11 +157,22 @@ module.exports = class ESimCommands extends CLICommandBase {
155157 await processOutput ( ) ;
156158 return ;
157159 }
158- if ( profileCmdResp . details . existingProfiles . length > 0 ) {
159- success = false ;
160- provisionOutputLogs . push ( 'Profiles already exist on the device' ) ;
161- await processOutput ( ) ;
162- return ;
160+ const existingProfiles = profileCmdResp . details . existingProfiles ;
161+ if ( existingProfiles . length > 0 ) {
162+ // remove profiles with test ICCID from existingProfiles to verify
163+ existingProfiles . forEach ( ( profile , index ) => {
164+ const iccid = profile . split ( '[' ) [ 1 ] . split ( ',' ) [ 0 ] . trim ( ) ;
165+ if ( TEST_ICCIDs . includes ( iccid ) ) {
166+ existingProfiles . splice ( index , 1 ) ;
167+ }
168+ } ) ;
169+
170+ if ( existingProfiles . length > 0 ) {
171+ success = false ;
172+ provisionOutputLogs . push ( 'Profiles already exist on the device' ) ;
173+ await processOutput ( ) ;
174+ return ;
175+ }
163176 }
164177
165178 // Get the next available profile list from availableProvisioningData
@@ -244,7 +257,11 @@ module.exports = class ESimCommands extends CLICommandBase {
244257 } ;
245258 const profilesOnDeviceAfterDownload = await this . _listProfiles ( port ) ;
246259 const iccidsOnDeviceAfterDownload = profilesOnDeviceAfterDownload . map ( ( line ) => line . split ( '[' ) [ 1 ] . split ( ',' ) [ 0 ] . trim ( ) ) ;
247- const equal = _ . isEqual ( _ . sortBy ( iccidsOnDeviceAfterDownload ) , _ . sortBy ( expectedIccids ) ) ;
260+
261+ // remove test ICCIDs from iccidsOnDeviceAfterDownload
262+ const iccidsOnDeviceAfterDownloadFiltered = iccidsOnDeviceAfterDownload . filter ( ( iccid ) => ! TEST_ICCIDs . includes ( iccid ) ) ;
263+
264+ const equal = _ . isEqual ( _ . sortBy ( iccidsOnDeviceAfterDownload ) , _ . sortBy ( iccidsOnDeviceAfterDownloadFiltered ) ) ;
248265
249266 res . details . iccidsOnDevice = iccidsOnDeviceAfterDownload ;
250267 res . details . rawLogs . push ( equal ? [ 'Profiles on device match the expected profiles' ] :
0 commit comments