Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Adjust Custom Settings in a Unit Test. As a consequence, there is no way to test scenarios that require adding an address to an organization. #7187

Open
MenachemShanowitz opened this issue Aug 18, 2023 · 0 comments

Comments

@MenachemShanowitz
Copy link

MenachemShanowitz commented Aug 18, 2023

Hi,

Due to line 107 in UTIL_CustomSettingsFacade, there is no way to adjust the NPSP "Contact and Org Settings" because it loads default settings when running in test mode, see code below.

This is important particularly because it would enable adding addresses to organizations, a very common use case.

public static npe01__Contacts_And_Orgs_Settings__c getContactsSettings() {
        if(Test.isRunningTest() && contactsSettings == null) {
            contactsSettings = new npe01__Contacts_And_Orgs_Settings__c();
            configContactsSettings(contactsSettings);
        } else if (contactsSettings == null) {
            contactsSettings = npe01__Contacts_And_Orgs_Settings__c.getInstance();
            if(contactsSettings.Id == null)
                contactsSettings = getOrgContactsSettings();
        }
        return contactsSettings;
    }
@MenachemShanowitz MenachemShanowitz changed the title Cannot Adjust Custom Settings in a Unit. As a consequence, there is no way to add addresses to an organization in a unit test Cannot Adjust Custom Settings in a Unit Test. As a consequence, there is no way to add addresses to an organization in said Unit Test Aug 18, 2023
@MenachemShanowitz MenachemShanowitz changed the title Cannot Adjust Custom Settings in a Unit Test. As a consequence, there is no way to add addresses to an organization in said Unit Test Cannot Adjust Custom Settings in a Unit Test. As a consequence, there is no way to test scenarios requiring adding an address to an organization. Aug 18, 2023
@MenachemShanowitz MenachemShanowitz changed the title Cannot Adjust Custom Settings in a Unit Test. As a consequence, there is no way to test scenarios requiring adding an address to an organization. Cannot Adjust Custom Settings in a Unit Test. As a consequence, there is no way to test scenarios that require adding an address to an organization. Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant