Skip to content

Commit

Permalink
v1.6.33 - THIS_MONTH date literal bugfix (#617)
Browse files Browse the repository at this point in the history
* Updates prettier dependencies

* Tentatively fixes MONTH-based literals for non-US based locales. Needs a bit of cleanup, but will do the trick for now

* Housekeeping on cached RollupRelationshipFieldFinder.Traversal while investigating #616
  • Loading branch information
jamessimone authored Aug 22, 2024
1 parent 30bbc45 commit 3df910c
Show file tree
Hide file tree
Showing 11 changed files with 26,840 additions and 8,811 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ As well, don't miss [the Wiki](../../wiki), which includes even more info for co

## Deployment & Setup

<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008ObbvAAC">
<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008ObeQAAS">
<img alt="Deploy to Salesforce"
src="./media/deploy-package-to-prod.png">
</a>

<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008ObbvAAC">
<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008ObeQAAS">
<img alt="Deploy to Salesforce Sandbox"
src="./media/deploy-package-to-sandbox.png">
</a>
Expand Down
19 changes: 18 additions & 1 deletion extra-tests/classes/RollupDateLiteralTests.cls
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ private class RollupDateLiteralTests {
)
);
insert cpcs;

insert new User(
LastName = 'Australia User',
Username = '' + System.now().getTime() + '@RollupDateLiteralTests.org',
Email = '[email protected]',
EmailEncodingKey = 'ISO-8859-1',
Alias = 'aususer',
TimeZoneSidKey = 'Australia/Sydney',
LocaleSidKey = 'en_US',
LanguageLocaleKey = 'en_US',
ProfileId = UserInfo.getProfileId()
);
}

@IsTest
Expand Down Expand Up @@ -175,7 +187,7 @@ private class RollupDateLiteralTests {
System.assertEquals(
true,
literal.matches(possibleDate, equality),
'Literal defined as ' + literal + ' should have matched ' + possibleDate + ' for ' + equality + '\n'
'Literal defined as ' + literal + ' should have matched ' + possibleDate + ' for ' + equality + ' for timezone ' + UserInfo.getTimeZone() + '\n'
);
}

Expand Down Expand Up @@ -217,6 +229,11 @@ private class RollupDateLiteralTests {
@IsTest
static void shouldWorkForThisMonth() {
runTestForLiteral('THIS_MONTH');
// TODO extend this more generally throughout this test class
User australiaUser = [SELECT Id FROM User WHERE LastName = 'Australia User'];
System.runAs(australiaUser) {
runTestForLiteral('THIS_MONTH');
}
}

@IsTest
Expand Down
23 changes: 20 additions & 3 deletions extra-tests/classes/RollupFullRecalcTests.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1738,8 +1738,8 @@ private class RollupFullRecalcTests {

@IsTest
static void limitsFullBatchRecalcCachedItemsProperly() {
Rollup.defaultControl = new RollupControl__mdt(ShouldRunAs__c = RollupMetaPicklists.ShouldRunAs.Synchronous);
Account parentA = [SELECT Id FROM Account];
Rollup.defaultControl = new RollupControl__mdt(ShouldRunAs__c = RollupMetaPicklists.ShouldRunAs.Synchronous, IsRollupLoggingEnabled__c = true);
Account parentA = [SELECT Id, OwnerId FROM Account];
Account parentB = new Account(Name = 'Parent B');
Account parentC = new Account(Name = 'Parent C');
insert new List<SObject>{ parentB, parentC };
Expand Down Expand Up @@ -1768,7 +1768,22 @@ private class RollupFullRecalcTests {
LookupObject__c = 'Account',
LookupFieldOnLookupObject__c = 'Id',
RollupFieldOnLookupObject__c = 'AnnualRevenue',
RollupOperation__c = 'SUM'
RollupOperation__c = 'SUM',
FullRecalculationDefaultNumberValue__c = 0,
IsFullRecordSet__c = true
),
new Rollup__mdt(
CalcItem__c = 'ContactPointAddress',
RollupFieldOnCalcItem__c = 'PreferenceRank',
LookupFieldOnCalcItem__c = 'ParentId',
LookupObject__c = 'User',
LookupFieldOnLookupObject__c = 'Id',
RollupFieldOnLookupObject__c = 'JigsawImportLimitOverride',
GrandparentRelationshipFieldPath__c = 'Parent.Owner.JigsawImportLimitOverride',
RollupOperation__c = 'SUM',
CalcItemWhereClause__c = 'ParentId = \'' + parentA.Id + '\'',
FullRecalculationDefaultNumberValue__c = 0,
IsFullRecordSet__c = true
),
new Rollup__mdt(
CalcItem__c = 'ContactPointAddress',
Expand Down Expand Up @@ -1817,6 +1832,8 @@ private class RollupFullRecalcTests {
System.assertEquals(String.valueOf(true), parent.Sic, parent);
}
System.assertEquals(true, Rollup.CACHED_ROLLUPS.isEmpty(), 'all deferrals should have been run');
User parentAOwner = [SELECT Id, JigsawImportLimitOverride FROM User WHERE Id = :parentA.OwnerId];
System.assertEquals(6, parentAOwner.JigsawImportLimitOverride);
}

@IsTest
Expand Down
Loading

0 comments on commit 3df910c

Please sign in to comment.