SyncMadeEasy/force-app/main/default/classes/FetchCollections_Batch_Test...

66 lines
2.9 KiB
OpenEdge ABL

@isTest
public with sharing class FetchCollections_Batch_Test {
@isTest
public static void FetchCollections() {
CustomSettingRecordInsert.InsertingConfiguration();
//CustomSettingRecordInsert.InsertingFieldMapping();
HIC_ShopifySync__Field_Mapping__c fld = new HIC_ShopifySync__Field_Mapping__c();
fld.name = 'test';
fld.HIC_ShopifySync__Object_Name__c = 'HIC_ShopifySync__Collection__c';
fld.HIC_ShopifySync__SF_Field__c = 'Shopify_Id__c';
fld.HIC_ShopifySync__Shopify_Fields__c = 'sort_value';
fld.HIC_ShopifySync__Nested__c = 'default_address';
fld.HIC_ShopifySync__IsSFID__c = false ;
fld.HIC_ShopifySync__Default_Value__c = false ;
insert fld;
Test.startTest();
FetchCollections_Batch obj = new FetchCollections_Batch(fld.id);
FetchCollections_Batch objj = new FetchCollections_Batch(2);
Database.executeBatch(obj,1);
Database.executeBatch(objj,1);
Test.stopTest();
system.assert(fld.HIC_ShopifySync__object_name__c.contains('HIC_ShopifySync__Collection__c'));
}
@isTest
public static void FetchCollections1() {
CustomSettingRecordInsert.InsertingConfiguration();
//CustomSettingRecordInsert.InsertingFieldMapping();
HIC_ShopifySync__Field_Mapping__c fld = new HIC_ShopifySync__Field_Mapping__c();
fld.name = 'test';
fld.HIC_ShopifySync__Object_Name__c = 'HIC_ShopifySync__Collection__c';
fld.HIC_ShopifySync__SF_Field__c = 'Shopify_Id__c';
fld.HIC_ShopifySync__Shopify_Fields__c = 'sort_value';
fld.HIC_ShopifySync__Nested__c = 'default_address';
fld.HIC_ShopifySync__IsSFID__c = false ;
fld.HIC_ShopifySync__Default_Value__c = false ;
insert fld;
String linkForNextPage = 'https://example.com';
Boolean isEnd = false;
String store = 'Default';
// Start the batch execution using Test.startTest() and Test.stopTest()
Test.startTest();
FetchCollections_Batch batch = new FetchCollections_Batch(linkForNextPage, false, store);
Database.executeBatch(batch);
FetchCollections_Batch batch1 = new FetchCollections_Batch(linkForNextPage, true );
Database.executeBatch(batch1);
FetchCollections_Batch batch2 = new FetchCollections_Batch(linkForNextPage, true, 'Default','','');
Database.executeBatch(batch2);
FetchCollections_Batch batch3 = new FetchCollections_Batch(linkForNextPage, false, 'Default','','');
Database.executeBatch(batch3,1);
FetchCollections_Batch batch4 = new FetchCollections_Batch('', false, 'Default','','');
Database.executeBatch(batch4,1);
Test.stopTest();
system.assert(fld.HIC_ShopifySync__object_name__c.contains('HIC_ShopifySync__Collection__c'));
}
}