Skip to content

Commit

Permalink
fix: bumps the version of core to 2.25.1 (#369)
Browse files Browse the repository at this point in the history
bumps core to get a PollingClient fix
  • Loading branch information
shetzel authored and rcoringrato-sfdc committed Jul 9, 2021
1 parent b573b2b commit b04b283
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"node": ">=12.11.0"
},
"dependencies": {
"@salesforce/core": "2.24.2",
"@salesforce/core": "2.25.1",
"@salesforce/kit": "^1.5.0",
"@salesforce/ts-types": "^1.4.2",
"archiver": "4.0.1",
Expand Down
28 changes: 28 additions & 0 deletions test/client/metadataTransfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,34 @@ describe('MetadataTransfer', () => {
expect(callOrder).to.deep.equal(['firstCall1', 'firstCall2', 'secondCall1']);
});

it('should poll until timeout', async () => {
// This test ensures that the core PollingClient doesn't stop
// after 10 tries (the ts-retry-promise library default) and polls
// until the timeout is exceeded.
const { checkStatus } = operation.lifecycle;
let callCount = 0;
checkStatus.callsFake(async () => {
callCount += 1;
if (callCount > 22) {
// This is a safeguard to ensure polling stops if the timeout
// doesn't kick in.
return { done: true };
}
return { done: false };
});

try {
await operation.pollStatus(50, 1);
fail('should have thrown an error');
} catch (err) {
expect(callCount).to.be.greaterThan(15);
expect(err.name, 'Polling function should have timed out').to.equal(
'MetadataTransferError'
);
expect(err.message).to.equal('Metadata API request failed: The client has timed out.');
}
});

it('should emit wrapped error if something goes wrong', async () => {
const { checkStatus } = operation.lifecycle;
const originalError = new Error('whoops');
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@
mv "~2"
safe-json-stringify "~1"

"@salesforce/core@2.24.2":
version "2.24.2"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-2.24.2.tgz#d699af286bcf00051a85c63a9c60aa8146fd8b5f"
integrity sha512-J5fPpHOKVsliQe0tH6IsSt71VLAP7vuStimxdixI4k2JBkyrGFvvJ8+O8qFQ1Je0037A0xN0haT+ky2QivAZPg==
"@salesforce/core@2.25.1":
version "2.25.1"
resolved "https://registry.npmjs.org/@salesforce/core/-/core-2.25.1.tgz#2be78b4fc824bfb69537174a0440ba35d19d8fa4"
integrity sha512-kRo1Uce8sFFXNBEu3odJ4zsFkvja+s/cmj7ICI6EvCsgwMHSLCw4P7zhqAsOJnBUim3M2qb4p0HpVtkQ4Cz3Kg==
dependencies:
"@salesforce/bunyan" "^2.0.0"
"@salesforce/kit" "^1.5.0"
Expand Down

0 comments on commit b04b283

Please sign in to comment.