alexed1 / LightningFlowComponents

A collection of unofficial Flow extensions that can be used to enhance Salesforce Flow and Orchestrator.
http://unofficialsf.com
Other
578 stars 574 forks source link

fbc_FormulaEvaluatorTest - Line 61 - Test evaluation should be '19' not '16' #499

Open SDJCorp opened 3 years ago

SDJCorp commented 3 years ago

https://github.com/alexed1/LightningFlowComponents/blob/9fc80b515558596d49b8ac93041ef04a7fb710e4/flow_process_components/FlowBaseComponents/force-app/main/default/classes/fbc_FormulaEvaluatorTest.cls#L61

This fails: System.assertEquals('16', fbc_FormulaEvaluator.parseFormula('HOURS(DATETIME(2019,12,26,0,0,0))', stringContext));

This Passes: System.assertEquals('19', fbc_FormulaEvaluator.parseFormula('HOURS(DATETIME(2019,12,26,0,0,0))', stringContext));

alexed1 commented 3 years ago

When I merged in this change the test started failing. Restoring the value to 16 made the test pass again. So, I'm confused.

Reverting this for now.

SDJCorp commented 3 years ago

Weird, maybe because of timezones or something? (the org I am using this on is based in Ireland)

alexed1 commented 3 years ago

That's a great hypothesis. Let's just comment out that assert for now until someone has time to dig into it.

adwhite75 commented 3 years ago

Closing this out as we have moved fbc over to a managed package which will alleviate any install/test class coverage issues.

jdpond commented 2 years ago

@adwhite75 Can we re-open this one? When we run "All tests", this fails on our orgs.

image

tomSny commented 2 years ago

This is due to timezone differences, use a fixed user in 'America/Los_Angeles' and do a runAs() like:

 @IsTest
    static void parseFormulaTest() {

        Profile pfile = [select id from profile where Name='System Administrator' limit 1];
        User usr = new User( alias='utest', email='unitTester@UT.org', emailencodingkey='UTF-8',FirstName = 'beta',lastname='Tester',
                languagelocalekey='en_US',localesidkey='en_US',profileid = pfile.Id,timezonesidkey='America/Los_Angeles',isActive = true,
                username='unitTester@UT.org');

        Test.startTest();

        System.runAs(usr) {
                **// add all test here...**
        }
        Test.stopTest();
}
alexed1 commented 2 years ago

anyone want to come up with a new pull request for this?