forcedotcom / forcedotcom/b2b-commerce-on-lightning-quickstart

B2BUtils tests - inserting WebStoreNetwork

Open
#68 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
191
Forks
211
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with B2BUtils.resolveCommunityIdToWebstoreId and the B2BUtilsTest @testSetup shown in the issue. Investigate the documented creation and testing constraints for WebStoreNetwork, then determine how the test data can be provided. Done means the test setup runs without the reported field-writeability or insert errors.

Written by the indexing model from the issue text.

Assessment

Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.