Skip to content

Commit

Permalink
test: fix UTs
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiand391 committed Aug 30, 2024
1 parent d80cd5c commit 3650a07
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"dependencies": {
"@oclif/core": "^4.0.18",
"@salesforce/core": "^8.4.0",
"@salesforce/core": "8.5.2-dev.0",
"@salesforce/kit": "^3.2.1",
"@salesforce/source-deploy-retrieve": "^12.6.0",
"@salesforce/ts-types": "^2.0.12",
Expand Down
2 changes: 1 addition & 1 deletion src/shared/remoteSourceTrackingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ const readFileContents = async (filePath: string): Promise<Contents | Record<str
export const calculateTimeout =
(logger: PinoLogger) =>
(memberCount: number): Duration => {
const overriddenTimeout = envVars.getNumber('SF_SOURCE_MEMBER_POLLING_TIMEOUT', 0);
const overriddenTimeout = envVars.getNumber('SFDX_SOURCE_MEMBER_POLLING_TIMEOUT', 0);
if (overriddenTimeout > 0) {
logger.debug(`Overriding SourceMember polling timeout to ${overriddenTimeout}`);
return Duration.seconds(overriddenTimeout);
Expand Down
7 changes: 3 additions & 4 deletions test/unit/remoteSourceTracking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import { writeFile, mkdir, readFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import { sep, dirname } from 'node:path';
import { MockTestOrgData, instantiateContext, stubContext, restoreContext } from '@salesforce/core/testSetup';
import { Logger, Messages, Org } from '@salesforce/core';
import { envVars, Logger, Messages, Org } from '@salesforce/core';
// eslint-disable-next-line no-restricted-imports
import * as kit from '@salesforce/kit';
import { expect } from 'chai';
import { ComponentStatus } from '@salesforce/source-deploy-retrieve';
import { RemoteSourceTrackingService, calculateTimeout, Contents } from '../../src/shared/remoteSourceTrackingService';
Expand Down Expand Up @@ -469,7 +468,7 @@ describe('remoteSourceTrackingService', () => {
});
});
it('should not poll when SFDX_DISABLE_SOURCE_MEMBER_POLLING=true', async () => {
const getBooleanStub = $$.SANDBOX.stub(kit.env, 'getBoolean').callsFake(() => true);
const getBooleanStub = $$.SANDBOX.stub(envVars, 'getBoolean').callsFake(() => true);

// @ts-ignore
const trackSpy = $$.SANDBOX.stub(remoteSourceTrackingService, 'trackSourceMembers');
Expand Down Expand Up @@ -512,7 +511,7 @@ describe('remoteSourceTrackingService', () => {

it('should stop if SFDX_SOURCE_MEMBER_POLLING_TIMEOUT is exceeded', async () => {
// @ts-ignore
$$.SANDBOX.stub(kit.env, 'getString').callsFake(() => '3');
$$.SANDBOX.stub(envVars, 'getString').callsFake(() => '3');
// @ts-ignore
const queryStub = $$.SANDBOX.stub(remoteSourceTrackingService, 'querySourceMembersFrom').resolves([]);

Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"skipLibCheck": true,
"plugins": [{ "transform": "@salesforce/core/messageTransformer", "import": "messageTransformer" }],
"moduleResolution": "Node16",
"module": "Node16"
"module": "Node16",
"paths": {
"@salesforce/core": ["./node_modules/@salesforce/core"]
}
},
"include": ["src/**/*.ts"]
}
42 changes: 26 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,30 @@
strip-ansi "6.0.1"
ts-retry-promise "^0.8.1"

"@salesforce/[email protected]":
version "8.5.2-dev.0"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.5.2-dev.0.tgz#052869d7cac7e7aed655371b35f8da4893af36d8"
integrity sha512-XOYDx5DvXGhCRMhKBNzpZdpLta993tru1t+Lps/ipc4YMeYvjpXuFUdDU22sYCsMOyHgGgB8WkBYkr6SxU71dA==
dependencies:
"@jsforce/jsforce-node" "^3.4.0"
"@salesforce/kit" "^3.1.6"
"@salesforce/schemas" "^1.9.0"
"@salesforce/ts-types" "^2.0.10"
ajv "^8.17.1"
change-case "^4.1.2"
fast-levenshtein "^3.0.0"
faye "^1.4.0"
form-data "^4.0.0"
js2xmlparser "^4.0.1"
jsonwebtoken "9.0.2"
jszip "3.10.1"
pino "^9.3.2"
pino-abstract-transport "^1.2.0"
pino-pretty "^11.2.2"
proper-lockfile "^4.1.2"
semver "^7.6.3"
ts-retry-promise "^0.8.1"

"@salesforce/core@^8.3.0", "@salesforce/core@^8.4.0":
version "8.4.0"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.4.0.tgz#d2ddfe07994c42b1e917e581e9cf47ad27b97a93"
Expand Down Expand Up @@ -1340,20 +1364,13 @@ brace-expansion@^4.0.0:
dependencies:
balanced-match "^3.0.0"

braces@^3.0.3:
braces@^3.0.3, braces@~3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
fill-range "^7.1.1"

braces@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
dependencies:
fill-range "^7.0.1"

browser-stdout@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60"
Expand Down Expand Up @@ -2500,14 +2517,7 @@ filelist@^1.0.4:
dependencies:
minimatch "^5.0.1"

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
dependencies:
to-regex-range "^5.0.1"

fill-range@^7.1.1:
fill-range@^7.0.1, fill-range@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
Expand Down

0 comments on commit 3650a07

Please sign in to comment.