Skip to content

Commit

Permalink
fix(deps): bump @jsforce/jsforce-node from 3.1.0 to 3.2.0 (#1062)
Browse files Browse the repository at this point in the history
* fix(deps): bump @jsforce/jsforce-node from 3.1.0 to 3.2.0

Bumps [@jsforce/jsforce-node](https://github.com/jsforce/jsforce) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/jsforce/jsforce/releases)
- [Changelog](https://github.com/jsforce/jsforce/blob/master/CHANGELOG.md)
- [Commits](jsforce/jsforce@3.1.0...3.2.0)

---
updated-dependencies:
- dependency-name: "@jsforce/jsforce-node"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* test: stub requests done when instantiating AuthInfo

`AuthInfo.determineIfDevHub` and `AuthInfo.getNamespacePrefix` do some
requests when creating a new AuthInfo instance, if we don't stub these
methods the requests are done and jsforce keeps retrying requests until
mocha times out.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Cristian Dominguez <[email protected]>
  • Loading branch information
dependabot[bot] and cristiand391 authored Apr 30, 2024
1 parent d6430c0 commit cfba51b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"messageTransformer/messageTransformer.ts"
],
"dependencies": {
"@jsforce/jsforce-node": "^3.1.0",
"@jsforce/jsforce-node": "^3.2.0",
"@salesforce/kit": "^3.1.1",
"@salesforce/schemas": "^1.7.0",
"@salesforce/ts-types": "^2.0.9",
Expand Down
6 changes: 5 additions & 1 deletion src/util/sfdcUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ export class SfdcUrl extends URL {
* @returns {boolean} true if this domain is a lightning domain
*/
public isLightningDomain(): boolean {
return this.origin.includes('.lightning.force.com') || this.origin.includes('.lightning.crmforce.mil') || this.origin.includes('.lightning.sfcrmapps.cn');
return (
this.origin.includes('.lightning.force.com') ||
this.origin.includes('.lightning.crmforce.mil') ||
this.origin.includes('.lightning.sfcrmapps.cn')
);
}
}
30 changes: 30 additions & 0 deletions test/unit/org/authInfoTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ describe('AuthInfo', () => {
});

it('should return an AuthInfo instance when passed a parent username', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

await $$.stubConfig({ [OrgConfigProperties.ORG_INSTANCE_URL]: testOrg.instanceUrl });
// Stub the http request (OAuth2.refreshToken())
// This will be called for both, and we want to make sure the clientSecret is the
Expand Down Expand Up @@ -462,6 +465,9 @@ describe('AuthInfo', () => {
});

it('should return a JWT AuthInfo instance when passed a username and JWT auth options despite failed DNS lookup', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

$$.setConfigStubContents('AuthInfoConfig', { contents: await testOrg.getConfig() });

const jwtConfig = {
Expand Down Expand Up @@ -531,6 +537,9 @@ describe('AuthInfo', () => {

describe('Refresh Token', () => {
it('should return a refresh token AuthInfo instance when passed a username and refresh token auth options', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

const refreshTokenConfig = {
refreshToken: testOrg.refreshToken,
loginUrl: testOrg.loginUrl,
Expand Down Expand Up @@ -585,6 +594,9 @@ describe('AuthInfo', () => {
});

it('should return a refresh token AuthInfo instance with username in auth options', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

const refreshTokenConfig = {
refreshToken: testOrg.refreshToken,
loginUrl: testOrg.loginUrl,
Expand Down Expand Up @@ -705,6 +717,9 @@ describe('AuthInfo', () => {
});

it('should return a refresh token AuthInfo instance with custom clientId and clientSecret', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

const refreshTokenConfig = {
clientId: 'authInfoTest_clientId',
clientSecret: 'authInfoTest_clientSecret',
Expand Down Expand Up @@ -986,6 +1001,9 @@ describe('AuthInfo', () => {

describe('save', () => {
it('should update the AuthInfo fields, and write to file', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

const refreshTokenConfig = {
refreshToken: testOrg.refreshToken,
loginUrl: testOrg.loginUrl,
Expand Down Expand Up @@ -1227,6 +1245,9 @@ describe('AuthInfo', () => {

describe('getSfdxAuthUrl', () => {
it('should return the correct sfdx auth url', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

const authResponse = {
access_token: testOrg.accessToken,
instance_url: testOrg.instanceUrl,
Expand All @@ -1251,6 +1272,9 @@ describe('AuthInfo', () => {
});

it('should handle undefined client secret', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

const authResponse = {
access_token: testOrg.accessToken,
instance_url: testOrg.instanceUrl,
Expand All @@ -1276,6 +1300,9 @@ describe('AuthInfo', () => {
});

it('should handle undefined refresh token', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

const authResponse = {
access_token: testOrg.accessToken,
instance_url: testOrg.instanceUrl,
Expand All @@ -1300,6 +1327,9 @@ describe('AuthInfo', () => {
});

it('should handle undefined instance url', async () => {
stubMethod($$.SANDBOX, AuthInfo.prototype, 'determineIfDevHub').resolves(false);
stubMethod($$.SANDBOX, AuthInfo.prototype, 'getNamespacePrefix').resolves();

const authResponse = {
access_token: testOrg.accessToken,
instance_url: testOrg.instanceUrl,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@jsforce/jsforce-node@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@jsforce/jsforce-node/-/jsforce-node-3.1.0.tgz#7f1b4ba60c0c84b870af8e43d713907b10ed8152"
integrity sha512-xsn6Qj36YyhG7uCL9DOswZhqN/OVIpXm5s8AWD7V9hSJfp5ReebEsjT7a52ztEMmkUAYjWvZC5alBJr7jJCJig==
"@jsforce/jsforce-node@^3.2.0":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@jsforce/jsforce-node/-/jsforce-node-3.2.0.tgz#4b104613fc9bb74e0e38d2c00936ea2b228ba73a"
integrity sha512-3GjWNgWs0HFajVhIhwvBPb0B45o500wTBNEBYxy8XjeeRra+qw8A9xUrfVU7TAGev8kXuKhjJwaTiSzThpEnew==
dependencies:
"@sindresorhus/is" "^4"
"@types/node" "^18.15.3"
Expand Down

0 comments on commit cfba51b

Please sign in to comment.