|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | import { EOL } from 'node:os'; |
17 | | -import { Connection, Lifecycle, SfProject, SfError, SfProjectJson } from '@salesforce/core'; |
| 17 | +import { Connection, Lifecycle, SfProject, SfError } from '@salesforce/core'; |
18 | 18 | import { MockTestOrgData, TestContext } from '@salesforce/core/testSetup'; |
19 | 19 | import { Config } from '@oclif/core'; |
20 | 20 | import { expect } from 'chai'; |
@@ -283,27 +283,11 @@ describe('package:install', () => { |
283 | 283 | } |
284 | 284 | }); |
285 | 285 |
|
286 | | - // TODO: It seems that while linking @salesforce/packaging into the plugin |
287 | | - // we cannot stub the library calls of `SfProject.getInstance` e.g. "SfProject, 'getInstance'" |
288 | | - // once the library has been published, the stubs resume to work and this test will pass |
289 | 286 | it('should print SUCCESS status correctly for package alias', async () => { |
290 | | - // Stubs SfProject.getInstance, SfProject.getSfProjectJson, and SfProjectJson.getContents |
291 | | - // in a way that makes TS happy... all to test package aliases. |
292 | | - const getContentsStub = $$.SANDBOX.stub(SfProjectJson.prototype, 'getContents').returns({ |
293 | | - packageAliases: { ['my_package_alias']: myPackageVersion04t }, |
294 | | - packageDirectories: [], |
295 | | - }); |
296 | | - // @ts-expect-error stubbing only 1 method |
297 | | - const getSfProjectJsonStub = $$.SANDBOX.stub(SfProject.prototype, 'getSfProjectJson').callsFake(() => ({ |
298 | | - getContents: getContentsStub, |
299 | | - })); |
300 | | - const getPackageIdFromAliasStub = $$.SANDBOX.stub(SfProject.prototype, 'getPackageIdFromAlias').returns( |
301 | | - myPackageVersion04t |
302 | | - ); |
| 287 | + $$.SANDBOX.stub(SfProject.prototype, 'getPackageIdFromAlias').returns(myPackageVersion04t); |
303 | 288 | // @ts-expect-error stubbing only a subset of methods |
304 | 289 | $$.SANDBOX.stub(SfProject, 'getInstance').callsFake(() => ({ |
305 | | - getSfProjectJson: getSfProjectJsonStub, |
306 | | - getPackageIdFromAlias: getPackageIdFromAliasStub, |
| 290 | + getPackageIdFromAlias: $$.SANDBOX.stub().returns(myPackageVersion04t), |
307 | 291 | })); |
308 | 292 |
|
309 | 293 | const request = Object.assign({}, pkgInstallRequest, { Status: 'SUCCESS' }); |
|
0 commit comments