Skip to content

Commit

Permalink
Merge pull request #1358 from bcgov/BCMOHAD-24466-V2
Browse files Browse the repository at this point in the history
BCMOHAD-24466 || Removed the Test Group and added the General_Queue
  • Loading branch information
NataliaNikishina authored Sep 27, 2024
2 parents 59d685f + cd3632d commit 939b1ae
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions force-app/main/default/classes/QueueOwnerSetterTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ public class QueueOwnerSetterTest {

@TestSetup
static void makeData() {
Group testGroup = new Group(Name='TestGroup', DeveloperName='TestGroup', Type='Queue');
insert testGroup;

Group testGroup = [SELECT Id, Name, DeveloperName, Type FROM GROUP WHERE DeveloperName = 'General_Queue' LIMIT 1];
if(testGroup == NULL){
testGroup = new Group(Name='General_Queue', DeveloperName='General_Queue', Type='Queue');
insert testGroup;
}

system.runAs(new User(Id=UserInfo.getUserId())) {
insert new QueueSobject[] {
Expand All @@ -20,14 +24,14 @@ public class QueueOwnerSetterTest {
insert saCase;

List<QueueOwnerSetter.CaseQueue> caseQueues = new List<QueueOwnerSetter.CaseQueue>();
caseQueues.add(newCaseQueue(saCase.Id, 'TestGroup'));
caseQueues.add(newCaseQueue(saCase.Id, 'General_Queue'));

Test.startTest();
QueueOwnerSetter.setOwner(caseQueues);
Test.stopTest();

system.assertEquals(
[select Id from Group where DeveloperName = 'TestGroup'].Id,
[select Id from Group where DeveloperName = 'General_Queue'].Id,
[select OwnerId from Case where Id = :saCase.Id].OwnerId
);
}
Expand Down Expand Up @@ -56,4 +60,4 @@ public class QueueOwnerSetterTest {
caseQueue.queueName = queueName;
return caseQueue;
}
}
}

0 comments on commit 939b1ae

Please sign in to comment.