Skip to content

Commit

Permalink
refactor: add types for most "let" variables
Browse files Browse the repository at this point in the history
  • Loading branch information
amtrack committed May 17, 2024
1 parent a114c35 commit 91ef7cc
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/browserforce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Browserforce {

// path instead of url
public async openPage(urlPath: string, options?: WaitForOptions): Promise<Page> {
let page;
let page: Page;
const result = await pRetry(
async () => {
page = await this.browser.newPage();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/activity-settings/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import { ActivitySettings } from '.';

describe(ActivitySettings.name, function () {
let plugin;
let plugin: ActivitySettings;
before(() => {
plugin = new ActivitySettings(global.bf);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/communities/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import { Communities } from '.';

describe.skip(Communities.name, function () {
let plugin;
let plugin: Communities;
before(() => {
plugin = new Communities(global.bf);
});
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/customer-portal/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CustomerPortalSetup } from './portals';

describe('CustomerPortal', () => {
describe(CustomerPortalEnable.name, function () {
let plugin;
let plugin: CustomerPortalEnable;
before(() => {
plugin = new CustomerPortalEnable(global.bf);
});
Expand All @@ -33,7 +33,7 @@ describe('CustomerPortal', () => {
});

describe(CustomerPortalSetup.name, function () {
let plugin;
let plugin: CustomerPortalSetup;
before(() => {
plugin = new CustomerPortalSetup(global.bf);
});
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('CustomerPortal', () => {
});

describe(CustomerPortalAvailableCustomObjects.name, function () {
let plugin;
let plugin: CustomerPortalAvailableCustomObjects;
before(() => {
plugin = new CustomerPortalAvailableCustomObjects(global.bf);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/defer-sharing-calculation/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';
import { DeferSharingCalculation } from '.';

describe(DeferSharingCalculation.name, function () {
let plugin;
let plugin: DeferSharingCalculation;
before(() => {
plugin = new DeferSharingCalculation(global.bf);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/density-settings/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import { DensitySettings } from '.';

describe(DensitySettings.name, function () {
let plugin;
let plugin: DensitySettings;
before(() => {
plugin = new DensitySettings(global.bf);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/email-deliverability/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import { EmailDeliverability } from '.';

describe(EmailDeliverability.name, function () {
let plugin;
let plugin: EmailDeliverability;
before(() => {
plugin = new EmailDeliverability(global.bf);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/home-page-layouts/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import { HomePageLayouts } from '.';

describe(HomePageLayouts.name, function () {
let plugin;
let plugin: HomePageLayouts;
before(() => {
plugin = new HomePageLayouts(global.bf);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LightningExperienceSettings } from '.';

describe(LightningExperienceSettings.name, function () {
describe('activeThemeName', () => {
let plugin;
let plugin: LightningExperienceSettings;
before(() => {
plugin = new LightningExperienceSettings(global.bf);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/opportunity-splits/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';
import { OpportunitySplits } from '.';

describe(OpportunitySplits.name, function () {
let plugin;
let plugin: OpportunitySplits;
before(() => {
plugin = new OpportunitySplits(global.bf);
});
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/picklists/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FieldDependencies } from './field-dependencies';

describe(Picklists.name, function () {
this.timeout('10m');
let plugin;
let plugin: Picklists;
before(() => {
plugin = new Picklists(global.bf);
});
Expand Down Expand Up @@ -63,7 +63,7 @@ describe(Picklists.name, function () {

describe(FieldDependencies.name, function () {
this.timeout('10m');
let plugin;
let plugin: FieldDependencies;
before(() => {
plugin = new FieldDependencies(global.bf);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/record-types/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RecordTypes } from '.';

describe(RecordTypes.name, function () {
this.timeout('10m');
let plugin;
let plugin: RecordTypes;
before(() => {
plugin = new RecordTypes(global.bf);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import { RelateContactToMultipleAccounts } from '.';

describe(RelateContactToMultipleAccounts.name, function () {
let plugin;
let plugin: RelateContactToMultipleAccounts;
before(() => {
plugin = new RelateContactToMultipleAccounts(global.bf);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/salesforce-to-salesforce/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import { SalesforceToSalesforce } from '.';

describe(SalesforceToSalesforce.name, function () {
let plugin;
let plugin: SalesforceToSalesforce;
before(() => {
plugin = new SalesforceToSalesforce(global.bf);
});
Expand Down
20 changes: 11 additions & 9 deletions src/plugins/security/certificate-and-key-management/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ export class CertificateAndKeyManagement extends BrowserforcePlugin {
certificates: [],
importFromKeystore: []
};
let existingCertificates;
let existingCertificates: CertificateRecord[] = [];
if (definition?.certificates?.length || definition?.importFromKeystore?.length) {
existingCertificates = await this.org.getConnection().tooling.query<CertificateRecord>(
`SELECT Id, DeveloperName, MasterLabel, OptionsIsPrivateKeyExportable, KeySize FROM Certificate`,
{ scanAll: false }
// BUG in jsforce: query acts with scanAll:true and returns deleted CustomObjects.
// It cannot be disabled.
);
existingCertificates = (
await this.org.getConnection().tooling.query<CertificateRecord>(
`SELECT Id, DeveloperName, MasterLabel, OptionsIsPrivateKeyExportable, KeySize FROM Certificate`,
{ scanAll: false }
// BUG in jsforce: query acts with scanAll:true and returns deleted CustomObjects.
// It cannot be disabled.
)
)?.records;
}
if (definition?.certificates?.length) {
for (const cert of definition.certificates) {
const existingCert = existingCertificates.records.find((co) => co.DeveloperName === cert.name);
const existingCert = existingCertificates.find((co) => co.DeveloperName === cert.name);
if (existingCert) {
response.certificates!.push({
_id: existingCert.Id,
Expand All @@ -72,7 +74,7 @@ export class CertificateAndKeyManagement extends BrowserforcePlugin {
}
if (definition?.importFromKeystore?.length) {
for (const cert of definition.importFromKeystore) {
const existingCert = existingCertificates.records.find((co) => co.DeveloperName === cert.name);
const existingCert = existingCertificates.find((co) => co.DeveloperName === cert.name);
if (existingCert) {
response.importFromKeystore!.push({
name: existingCert.DeveloperName
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/security/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { CertificateAndKeyManagement } from './certificate-and-key-management';
import { IdentityProvider } from './identity-provider';

describe(`${CertificateAndKeyManagement.name} and ${IdentityProvider.name}`, function () {
let pluginIdentityProvider, pluginCertificateManagement;
let pluginIdentityProvider: IdentityProvider;
let pluginCertificateManagement: CertificateAndKeyManagement;
before(() => {
pluginIdentityProvider = new IdentityProvider(global.bf);
pluginCertificateManagement = new CertificateAndKeyManagement(global.bf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import { type Config, LoginAccessPolicies } from '.';

describe(LoginAccessPolicies.name, function () {
let plugin;
let plugin: LoginAccessPolicies;
before(() => {
plugin = new LoginAccessPolicies(global.bf);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/security/sharing/index.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import { Sharing } from '.';

describe.skip(Sharing.name, function () {
let plugin;
let plugin: Sharing;
before(() => {
plugin = new Sharing(global.bf);
});
Expand Down

0 comments on commit 91ef7cc

Please sign in to comment.