You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: force-app/main/default/classes/main/standard-soql/SOQL_Test.cls
+85Lines changed: 85 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -558,6 +558,17 @@ private class SOQL_Test {
558
558
Assert.areEqual('SELECT CampaignId campaign, AVG(Amount) amount FROM Opportunity GROUP BY CampaignId', soql, 'The generated SOQL should match the expected one.');
559
559
}
560
560
561
+
@IsTest
562
+
staticvoidwithStringFieldsAndToLabelFunction() {
563
+
// Test
564
+
Stringsoql=SOQL.of(Case.SObjectType)
565
+
.with('Id, toLabel(Status), Subject')
566
+
.toString();
567
+
568
+
// Verify
569
+
Assert.areEqual('SELECT Id, toLabel(Status), Subject FROM Case', soql);
570
+
}
571
+
561
572
@IsTest
562
573
staticvoidwithFieldAlias() {
563
574
// Test
@@ -830,6 +841,21 @@ private class SOQL_Test {
830
841
Assert.areEqual('SELECT Name , (SELECT Id, Name FROM Contacts ORDER BY Name DESC NULLS LAST) FROM Account', soql, 'The generated SOQL should match the expected one.');
831
842
}
832
843
844
+
@IsTest
845
+
staticvoidsubQueryOrderByDynamic() {
846
+
// Test
847
+
Stringsoql=SOQL.of(Account.SObjectType)
848
+
.with(Account.Name)
849
+
.with(SOQL.SubQuery.of('Contacts')
850
+
.with(Contact.Id, Contact.Name)
851
+
.orderBy('Name', 'ASC')
852
+
.nullsLast()
853
+
).toString();
854
+
855
+
// Verify
856
+
Assert.areEqual('SELECT Name , (SELECT Id, Name FROM Contacts ORDER BY Name ASC NULLS LAST) FROM Account', soql);
857
+
}
858
+
833
859
@IsTest
834
860
staticvoidsubQueryOrderByRelated() {
835
861
// Test
@@ -1540,6 +1566,65 @@ private class SOQL_Test {
1540
1566
Assert.areEqual('Krakow', binding.get('v2'), 'The binding variable should match the expected value.');
0 commit comments