Closed mgellada-sd closed 1 year ago
Here's my suggested change in SOQL_Test.cls
. I've gone ahead and forked into my private repo
@IsTest
static void inlcudesAll() {
// Setup
List<String> ratings = new List<String>{ 'Hot', 'Warm' };
// Test
SOQL builder = SOQL.of(Account.SObjectType)
.with(Account.Id)
.whereAre(SOQL.Filter.with(Account.Rating).includesAll(ratings));
// Verify
String soql = builder.toString();
Assert.areEqual('SELECT Id FROM Account WHERE Rating INCLUDES (\'Hot;Warm\')', soql);
}
@IsTest
static void inlcudesSome() {
// Setup
List<String> ratings = new List<String>{ 'Hot', 'Warm' };
// Test
SOQL builder = SOQL.of(Account.SObjectType)
.with(Account.Id)
.whereAre(SOQL.Filter.with(Account.Rating).includesSome(ratings));
// Verify
String soql = builder.toString();
Assert.areEqual('SELECT Id FROM Account WHERE Rating INCLUDES (\'Hot\', \'Warm\')', soql);
}
@IsTest
static void excludesAll() {
// Setup
List<String> ratings = new List<String>{ 'Hot', 'Warm' };
// Test
SOQL builder = SOQL.of(Account.SObjectType)
.with(Account.Id)
.whereAre(SOQL.Filter.with(Account.Rating).excludesAll(ratings));
// Verify
String soql = builder.toString();
Assert.areEqual('SELECT Id FROM Account WHERE Rating EXCLUDES (\'Hot\', \'Warm\')', soql);
}
@IsTest
static void excludesSome() {
// Setup
List<String> ratings = new List<String>{ 'Hot', 'Warm' };
// Test
SOQL builder = SOQL.of(Account.SObjectType)
.with(Account.Id)
.whereAre(SOQL.Filter.with(Account.Rating).excludesSome(ratings));
// Verify
String soql = builder.toString();
Assert.areEqual('SELECT Id FROM Account WHERE Rating EXCLUDES (\'Hot;Warm\')', soql);
}
Thanks @mgellada-sd! Great point!
I see two options:
Let's me know what do you prefer :D
Just submitted a PR! @pgajek2
Deployed! Thanks for collaboration @mgellada-sd 🫡
This has caused much headache with org deployment of using this great library! This is a feature that is not enabled and not planned to enable for org deployment. Is there a way to remove this requirement by changing tests to use something else that can exhibit same testing behavior so that this feature does not need to be enabled for deployment and running tests?