Skip to content

Commit 52c9c44

Browse files
committed
Additional updates missed in first sync
1 parent 4b16060 commit 52c9c44

File tree

5 files changed

+34
-9
lines changed

5 files changed

+34
-9
lines changed

force-app/dml/DMLTest.cls

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private class DMLTest {
9999
List<Account> accounts = new List<Account>();
100100
List<Contact> contacts = new List<Contact>();
101101

102-
for (Integer i = 0; i < dml.MAX_DML_CHUNKING; i++) {
102+
for (Integer i = 0; i < DML.MAX_DML_CHUNKING; i++) {
103103
Account a = new Account(Name = '' + i);
104104
accounts.add(a);
105105
records.add(a);
@@ -162,6 +162,17 @@ private class DMLTest {
162162
Assert.areEqual(true, secondResult.isSuccess());
163163
}
164164

165+
@IsTest
166+
static void shouldPassNonNullValueOnOperatonThatDoesNotUseDmlOptions() {
167+
Database.DMLOptions dmlOptions = new Database.DMLOptions();
168+
dmlOptions.AllowFieldTruncation = true;
169+
Contact contact = new Contact(LastName = 'Test2');
170+
171+
new DML().setOptions(dmlOptions).doUpsert(contact);
172+
173+
Assert.isNotNull(contact.Id);
174+
}
175+
165176
@IsTest
166177
static void upsertWithDefaultSetOptionsWorks() {
167178
// on some code paths, like insert, OptAllOrNone not being initialized on Database.DMLOptions is fine

force-app/factory/RepoFactoryMock.cls

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,6 @@ public class RepoFactoryMock extends RepoFactory {
190190
}
191191
fields.addAll(this.groupedByFieldNames);
192192

193-
Map<String, RepositorySortOrder> localFieldToSortOrders = FieldToSortOrders.get(this.repoType);
194-
if (localFieldToSortOrders == null) {
195-
localFieldToSortOrders = new Map<String, RepositorySortOrder>();
196-
FieldToSortOrders.put(this.repoType, localFieldToSortOrders);
197-
}
198-
localFieldToSortOrders.putAll(this.fieldToSortOrder);
199-
200193
this.trackFieldToSortOrder();
201194

202195
return this.aggRecords;

force-app/repository/Query.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public virtual class Query {
330330
BIND_VAR_NUMBER++;
331331
this.bindVars.put(this.predicateKey, predicate);
332332
}
333-
return ':' + predicateKey;
333+
return ':' + this.predicateKey;
334334
}
335335

336336
private String getSoslPredicate(Object predicate) {

force-app/repository/QueryTest.cls

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,13 @@ private class QueryTest {
241241

242242
Assert.areEqual('Id IN (\'' + String.join(fakeAccountIds, '\',\'') + '\')', query.toSoslString());
243243
}
244+
245+
@IsTest
246+
static void itDoesNotAddEmptyParenthesisToTheEnd() {
247+
Query query = Query.andQuery(
248+
new List<Query>{ Query.equals(Account.Id, new List<Id>()), Query.orQuery(new List<Query>()) }
249+
);
250+
251+
Assert.areEqual('(Id = :bindVar0)', query.toString());
252+
}
244253
}

force-app/repository/RepositoryTest.cls

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ private class RepositoryTest {
4646
Assert.areEqual(1, Limits.getQueries());
4747
}
4848

49+
@IsTest
50+
static void itShouldSearchWithEmptyCollections() {
51+
Query listQuery = Query.equals(ContactPointAddress.Id, new List<Id>());
52+
53+
IRepository repo = new ContactPointAddressRepo();
54+
55+
List<List<SObject>> results = repo.getSosl('aaa', listQuery);
56+
Assert.areEqual(1, results.size());
57+
Assert.areEqual(0, results.get(0).size());
58+
Assert.areEqual(1, Limits.getSoslQueries());
59+
}
60+
4961
@IsTest
5062
static void itShouldRespectOrStatementsInQueries() {
5163
ContactPointAddress cpa = new ContactPointAddress(Name = 'Test Or', PreferenceRank = 1);

0 commit comments

Comments
 (0)