Skip to content

Commit b28df7a

Browse files
committed
Update RepoFactoryMockTest.addsMockCursor test to be more explicit about the expectations of performance there
1 parent 5078555 commit b28df7a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

force-app/factory/RepoFactoryMockTest.cls

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ private class RepoFactoryMockTest {
1717
@IsTest
1818
static void addsMockCursor() {
1919
Account acc = new Account(Id = TestingUtils.generateId(Schema.Account.SObjectType));
20-
List<Account> accounts = new List<Account>{ acc };
20+
Account secondAccount = new Account(Id = TestingUtils.generateId(Schema.Account.SObjectType));
2121
RepoFactoryMock.CursorResults.put(
2222
Account.SObjectType,
23-
new List<Cursor>{ new RepoFactoryMock.CursorMock(accounts) }
23+
new List<Cursor>{ new RepoFactoryMock.CursorMock(new List<Account>{ acc, secondAccount }) }
2424
);
2525

2626
RepoFactoryMock.FacadeMock facade = new RepoFactoryMock.FacadeMock();
@@ -31,7 +31,9 @@ private class RepoFactoryMockTest {
3131
);
3232
Cursor cursor = repo.getCursor(new List<Query>());
3333

34-
Assert.areEqual(1, cursor.getNumRecords());
34+
Assert.areEqual(2, cursor.getNumRecords());
3535
Assert.areEqual(acc.Id, cursor.fetch(0, 1)[0].Id);
36+
// verify we don't overindex past the actual cursor end
37+
Assert.areEqual(secondAccount.Id, cursor.fetch(1, 3)[0].Id);
3638
}
3739
}

0 commit comments

Comments
 (0)