Skip to content

B2BUtils tests - inserting WebStoreNetwork #68

@pward123

Description

@pward123

I'm trying to create a test for B2BUtils.resolveCommunityIdToWebstoreId and am running into problems creating the WebStoreNetwork in my @testsetup

@isTest
private class B2BUtilsTest {
    @testSetup static void setup() {
        WebStore testWebStore = new WebStore(Name='TestWebStore', DefaultLanguage='en_US');
        insert testWebStore;
        
        WebStoreNetwork testWebStoreNetwork = new WebStoreNetwork(WebStoreId=testWebStore.Id);
        insert testWebStoreNetwork;
    }

In the Developer Console, I see the following errors:

  • Field is not writeable: WebStoreNetwork.WebStoreId
  • DML operation Insert not allowed on WebStoreNetwork

I extremely new to Salesforce development and apologize if this problem has an obvious solution. I'm not able to find any documentation on the WebStoreNetwork object or how to create one.

On a side note, if this repo is really intended to be a quickstart, it seems like a bare minimum requirement would be 75% test coverage on the included utility classes. Currently, there are at least four classes that have no tests whatsoever: B2BCartToOrderDraft, B2BGetInfo, B2BUtils and SalesforceAdapter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions