Skip to content

Commit 38faf50

Browse files
committed
fix: adjust mock org test data to conform to v3
@W-10430285@
1 parent 5eb2a82 commit 38faf50

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/testSetup.ts

+15-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { tmpdir as osTmpdir } from 'os';
1111
import { join as pathJoin } from 'path';
1212
import * as sinonType from 'sinon';
1313

14-
import { once, set } from '@salesforce/kit';
14+
import { once } from '@salesforce/kit';
1515
import { stubMethod } from '@salesforce/ts-sinon';
1616
import {
1717
AnyFunction,
@@ -20,7 +20,6 @@ import {
2020
ensureAnyJson,
2121
ensureJsonMap,
2222
ensureString,
23-
getBoolean,
2423
isJsonMap,
2524
JsonMap,
2625
Optional,
@@ -721,7 +720,8 @@ export class StreamingMockCometClient extends CometClient {
721720
*/
722721
export class MockTestOrgData {
723722
public testId: string;
724-
public alias?: string;
723+
public aliases?: string[];
724+
public configs?: string[];
725725
public username: string;
726726
public devHubUsername?: string;
727727
public orgId: string;
@@ -734,6 +734,9 @@ export class MockTestOrgData {
734734
public refreshToken: string;
735735
public userId: string;
736736
public redirectUri: string;
737+
public isDevHub?: boolean;
738+
public isScratchOrg?: boolean;
739+
public isExpired?: boolean | 'unknown';
737740

738741
public constructor(id: string = uniqid(), options?: { username: string }) {
739742
this.testId = id;
@@ -755,20 +758,24 @@ export class MockTestOrgData {
755758
}
756759

757760
public makeDevHub(): void {
758-
set(this, 'isDevHub', true);
761+
this.isDevHub = true;
759762
}
760763

761764
public createUser(user: string): MockTestOrgData {
762765
const userMock = new MockTestOrgData();
763766
userMock.username = user;
764-
userMock.alias = this.alias;
767+
userMock.aliases = this.aliases;
768+
userMock.configs = this.configs;
765769
userMock.devHubUsername = this.devHubUsername;
766770
userMock.orgId = this.orgId;
767771
userMock.loginUrl = this.loginUrl;
768772
userMock.instanceUrl = this.instanceUrl;
769773
userMock.clientId = this.clientId;
770774
userMock.clientSecret = this.clientSecret;
771775
userMock.redirectUri = this.redirectUri;
776+
userMock.isDevHub = this.isDevHub;
777+
userMock.isScratchOrg = this.isScratchOrg;
778+
userMock.isExpired = this.isExpired;
772779
return userMock;
773780
}
774781

@@ -777,7 +784,8 @@ export class MockTestOrgData {
777784
Id: this.userId,
778785
Username: this.username,
779786
LastName: `user_lastname_${this.testId}`,
780-
Alias: this.alias || 'user_alias_blah',
787+
Alias: this.aliases ? this.aliases[0] : 'user_alias_blah',
788+
Configs: this.configs,
781789
TimeZoneSidKey: `user_timezonesidkey_${this.testId}`,
782790
LocaleSidKey: `user_localesidkey_${this.testId}`,
783791
EmailEncodingKey: `user_emailencodingkey_${this.testId}`,
@@ -808,16 +816,12 @@ export class MockTestOrgData {
808816
config.createdOrgInstance = 'CS1';
809817
config.created = '1519163543003';
810818
config.userId = this.userId;
811-
// config.devHubUsername = 'tn@su-blitz.org';
812819

813820
if (this.devHubUsername) {
814821
config.devHubUsername = this.devHubUsername;
815822
}
816823

817-
const isDevHub = getBoolean(this, 'isDevHub');
818-
if (isDevHub) {
819-
config.isDevHub = isDevHub;
820-
}
824+
config.isDevHub = this.isDevHub;
821825

822826
return config as SfOrg;
823827
}

0 commit comments

Comments
 (0)