Skip to content

Commit

Permalink
fix: follow up to support running tests with class id specified (#165)
Browse files Browse the repository at this point in the history
#155, @W-8991173@
  • Loading branch information
AnanyaJha authored and rcoringrato-sfdc committed Mar 18, 2021
1 parent 135b0ab commit 9e8a00e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/apex-node/src/tests/testService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ export class TestService {
}
}
} else {
testItems.push({ className: test });
const prop = isValidApexClassID(test) ? 'classId' : 'className';
testItems.push({ [prop]: test });
}
}

Expand Down
16 changes: 16 additions & 0 deletions packages/apex-node/test/tests/asyncTests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,22 @@ describe('Run Apex tests asynchronously', () => {
expect(namespaceStub.notCalled).to.be.true;
});

it('should build async payload for tests with only classid', async () => {
const namespaceStub = sandboxStub
.stub(TestService.prototype, 'queryNamespaces')
.resolves(new Set(['myNamespace']));
const testSrv = new TestService(mockConnection);
const payload = await testSrv.buildAsyncPayload(
TestLevel.RunSpecifiedTests,
'01p4x00000KWt3T'
);
expect(payload).to.deep.equal({
tests: [{ classId: '01p4x00000KWt3T' }],
testLevel: TestLevel.RunSpecifiedTests
});
expect(namespaceStub.notCalled).to.be.true;
});

it('should build async payload for class with only classname', async () => {
const namespaceStub = sandboxStub
.stub(TestService.prototype, 'queryNamespaces')
Expand Down

0 comments on commit 9e8a00e

Please sign in to comment.