From a07690c845f2be9f82c8c59455a347fa52225cdc Mon Sep 17 00:00:00 2001 From: mingxuanzhang Date: Sat, 6 Apr 2024 14:57:02 -0700 Subject: [PATCH 1/2] chore: delete integration tests --- .../adapter/MockApexExtension.ts | 55 - .../debugConfigurationProvider.test.ts | 123 -- .../test/vscode-integration/index.test.ts | 195 --- .../test/vscode-integration/index.ts | 23 - .../telemetry/telemetry.test.ts | 74 - .../adapter/MockApexExtension.ts | 56 - .../debugConfigurationProvider.test.ts | 162 -- .../checkpoints/checkpointService.test.ts | 720 --------- .../apexExecutionOverlayActionCommand.test.ts | 197 --- ...eleteExistingOverlayActionsCommand.test.ts | 148 -- ...eryExistingOverlayActionIdsCommand.test.ts | 114 -- .../commands/quickLaunch.test.ts | 484 ------ .../test/vscode-integration/index.test.ts | 33 - .../test/vscode-integration/index.ts | 37 - .../telemetry/telemetry.test.ts | 116 -- .../apexLspJarContents.test.ts | 48 - .../codecoverage/colorizer.test.ts | 102 -- .../commands/apexExecute.test.ts | 575 ------- .../commands/apexLogGet.test.ts | 110 -- .../commands/apexTestRun.test.ts | 279 ---- .../commands/apexTestRunCodeAction.test.ts | 607 ------- .../commands/apexTestSuite.test.ts | 150 -- ...hApexReplayDebuggerWithCurrentFile.test.ts | 159 -- .../embeddedSoql/soqlCompletion.test.ts | 208 --- .../test/vscode-integration/index.ts | 27 - .../javaConfiguration.test.ts | 37 - .../vscode-integration/languageClient.test.ts | 137 -- .../test/vscode-integration/settings.test.ts | 43 - .../vscode-integration/views/testDataUtil.ts | 34 - .../views/testJSONOutputs.ts | 144 -- .../views/testNamespacedOutputs.ts | 117 -- .../views/testOutline.test.ts | 364 ----- .../views/testOutlineNamespace.test.ts | 241 --- .../commands/aliasList.test.ts | 22 - .../auth/authParameterGatherer.test.ts | 134 -- .../commands/auth/orgLoginAccessToken.test.ts | 96 -- .../commands/auth/orgLoginWeb.test.ts | 347 ---- .../commands/auth/orgLoginWebDevHub.test.ts | 203 --- .../commands/auth/orgLogout.test.ts | 205 --- .../commands/baseDeployRetrieve.test.ts | 826 ---------- .../commands/configList.test.ts | 22 - .../commands/configSet.test.ts | 84 - .../commands/debuggerStop.test.ts | 160 -- .../commands/deleteSource.test.ts | 115 -- .../commands/deployManifest.test.ts | 99 -- .../commands/deploySourcePath.test.ts | 315 ---- .../commands/describeMetadata.test.ts | 44 - .../commands/isvdebugger/bootstrapCmd.test.ts | 416 ----- .../org-source/classes/DemoController.cls | 31 - .../classes/DemoController.cls-meta.xml | 10 - .../testdata/org-source/package.xml | 11 - .../mypackage/classes/Logger.cls | 15 - .../mypackage/classes/Logger.cls-meta.xml | 5 - .../mypackage/classes/LoggerTest.cls | 1 - .../mypackage/classes/LoggerTest.cls-meta.xml | 5 - .../packages-source/mypackage/package.xml | 16 - .../mypackage/triggers/AccountLogger.trigger | 1 - .../triggers/AccountLogger.trigger-meta.xml | 5 - .../commands/listMetadata.test.ts | 56 - .../commands/openDocumentation.test.ts | 132 -- .../commands/orgCreate.test.ts | 142 -- .../commands/orgDelete.test.ts | 33 - .../commands/orgDisplay.test.ts | 32 - .../commands/orgList.test.ts | 21 - .../commands/orgOpen.test.ts | 57 - .../commands/packageInstall.test.ts | 137 -- .../commands/projectDeployStartInteg.test.ts | 39 - .../projectDeployStartResultParser.test.ts | 163 -- .../commands/projectGenerate.test.ts | 451 ------ .../commands/projectGenerateManifest.test.ts | 292 ---- .../projectRetrieveStartInteg.test.ts | 36 - .../commands/refreshSObjects.test.ts | 329 ---- .../commands/renameLightningComponent.test.ts | 574 ------- .../commands/retrieveManifest.test.ts | 98 -- .../retrieveMetadata/describers.test.ts | 98 -- .../retrieveComponent.test.ts | 267 --- .../commands/retrieveSourcePath.test.ts | 327 ---- .../commands/sourceDiff.test.ts | 261 --- .../commands/startApexDebugLogging.test.ts | 115 -- .../commands/stopApexDebugLogging.test.ts | 41 - .../analyticsGenerateTemplate.test.ts | 98 -- .../templates/apexGenerateClass.test.ts | 143 -- .../templates/apexGenerateTrigger.test.ts | 87 - .../templates/customTemplates.test.ts | 289 ---- .../forceLightningLwcTestCreate.test.ts | 48 - .../templates/internalCommandUtils.test.ts | 106 -- .../templates/lightningGenerateApp.test.ts | 187 --- .../lightningGenerateAuraComponent.test.ts | 192 --- .../templates/lightningGenerateEvent.test.ts | 158 -- .../lightningGenerateInterface.test.ts | 162 -- .../templates/lightningGenerateLwc.test.ts | 176 -- .../visualforceGenerateComponent.test.ts | 104 -- .../templates/visualforceGeneratePage.test.ts | 101 -- .../commands/util/betaDeployRetrieve.test.ts | 47 - .../commands/util/parameterGatherers.test.ts | 445 ----- .../util/postconditionCheckers.test.ts | 642 -------- .../util/preconditionCheckers.test.ts | 47 - .../commands/util/sfCommandlet.test.ts | 148 -- .../util/sourcePathStrategies.test.ts | 35 - .../commands/util/sourceResultOutput.test.ts | 441 ----- .../conflict/componentDiffer.test.ts | 80 - .../conflict/metadataCacheService.test.ts | 418 ----- .../conflict/persistentStorageService.test.ts | 94 -- .../timestampConflictDetector.test.ts | 361 ----- .../context/workspaceContext.test.ts | 221 --- .../context/workspaceOrgTypeInteg.test.ts | 178 -- .../diagnostics/index.test.ts | 256 --- .../directoryDiffer.test.ts | 148 -- .../test/vscode-integration/index.ts | 38 - .../test/vscode-integration/mocks.ts | 98 -- .../vscode-integration/modes/index.test.ts | 74 - .../notifications/index.test.ts | 218 --- .../progressNotification.test.ts | 159 -- .../orgBrowser/metadataCmp.test.ts | 755 --------- .../metadataOutlineProvider.test.ts | 677 -------- .../orgBrowser/metadataType.test.ts | 164 -- .../orgPicker/orgList.test.ts | 397 ----- .../predicates/index.test.ts | 53 - .../salesforcePackageDirectories.test.ts | 211 --- .../settings/pushOrDeployOnSave.test.ts | 272 ---- .../telemetry/index.test.ts | 149 -- .../traceflag/DeveloperLogTraceFlag.test.ts | 56 - .../vscode-integration/util/authInfo.test.ts | 147 -- .../util/cliConfiguration.test.ts | 227 --- .../util/inputUtils.test.ts | 77 - .../vscode-integration/util/orgUtil.test.ts | 168 -- .../util/rootWorkspace.test-util.ts | 37 - .../util/rootWorkspace.test.ts | 57 - .../util/statuses/taskView.test.ts | 168 -- .../test/vscode-integration/extension.test.ts | 84 - .../test/vscode-integration/hover.test.ts | 120 -- .../test/vscode-integration/index.ts | 26 - .../vscode-integration/intellisense.test.ts | 214 --- .../vscode-integration/navigation.test.ts | 91 -- .../activation/MockExtensionContext.ts | 135 -- .../activation/activationMode.test.ts | 153 -- .../commands/commandUtils.test.ts | 84 - .../commands/lightningLwcOpen.test.ts | 55 - .../commands/lightningLwcPreview.test.ts | 1427 ----------------- .../commands/lightningLwcStart.test.ts | 420 ----- .../commands/lightningLwcStop.test.ts | 83 - .../test/vscode-integration/hover.test.ts | 138 -- .../test/vscode-integration/index.ts | 23 - .../vscode-integration/intellisense.test.ts | 251 --- .../test/vscode-integration/jsconfig.test.ts | 191 --- .../metaSupport/MockRhExtension.ts | 66 - .../metaSupport/metaSupport.test.ts | 137 -- .../vscode-integration/navigation.test.ts | 65 - .../commands/lwcTestDebugAction.test.ts | 271 ---- .../commands/lwcTestRunAction.test.ts | 146 -- .../commands/lwcTestWatchAction.test.ts | 84 - .../testSupport/mocks/index.ts | 138 -- .../testSupport/mocks/testResultsMocks.ts | 199 --- .../testSupport/mocks/vscodeConfiguration.ts | 60 - .../testSupport/testExplorer/testNode.test.ts | 185 --- .../testExplorer/testOutlineProvider.test.ts | 398 ----- .../testSupport/testIndexer/jestUtils.test.ts | 89 - .../testIndexer/lwcTestIndexer.test.ts | 323 ---- .../testSupport/testRunner/index.test.ts | 142 -- .../testRunner/taskService.test.ts | 189 --- .../testRunner/testWatcher.test.ts | 75 - .../workspace/getCliArgsFromJestArgs.test.ts | 78 - .../getLwcTestRunnerExecutable.test.ts | 141 -- .../workspace/workspaceService.test.ts | 148 -- .../vscode-integration/client/client.test.ts | 253 --- .../client/completion.test.ts | 641 -------- .../commands/soqlBuilderToggle.test.ts | 54 - .../commands/soqlFileCreate.test.ts | 40 - .../vscode-integration/commomUtils.test.ts | 59 - .../editor/htmlUtils.test.ts | 54 - .../editor/queryRunner.test.ts | 64 - .../editor/soqlEditorInstance.test.ts | 228 --- .../editor/soqlEditorProvider.test.ts | 7 - .../test/vscode-integration/index.ts | 25 - .../dataProviders/csvDataProvider.test.ts | 164 -- .../queryDataFileService.test.ts | 82 - .../queryDataViewService.test.ts | 142 -- .../test/vscode-integration/sf.test.ts | 45 - .../soqlMetadata/standardObjects/Account.json | 1 - .../standardObjects/Attachment.json | 1 - .../soqlMetadata/standardObjects/Case.json | 1 - .../soqlMetadata/standardObjects/Contact.json | 1 - .../standardObjects/Contract.json | 1 - .../soqlMetadata/standardObjects/Lead.json | 1 - .../soqlMetadata/standardObjects/Note.json | 1 - .../standardObjects/Opportunity.json | 1 - .../soqlMetadata/standardObjects/Order.json | 1 - .../standardObjects/Pricebook2.json | 1 - .../standardObjects/PricebookEntry.json | 1 - .../standardObjects/Product2.json | 1 - .../standardObjects/RecordType.json | 1 - .../soqlMetadata/standardObjects/Report.json | 1 - .../soqlMetadata/standardObjects/Task.json | 1 - .../soqlMetadata/standardObjects/User.json | 1 - .../test/vscode-integration/testUtilities.ts | 415 ----- .../fileAssociations.test.ts | 30 - .../test/vscode-integration/index.ts | 24 - .../telemetry/telemetry.test.ts | 74 - 198 files changed, 31268 deletions(-) delete mode 100644 packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/adapter/MockApexExtension.ts delete mode 100644 packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/adapter/debugConfigurationProvider.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/index.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/index.ts delete mode 100644 packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/telemetry/telemetry.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/adapter/MockApexExtension.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/adapter/debugConfigurationProvider.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/checkpoints/checkpointService.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/apexExecutionOverlayActionCommand.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/batchDeleteExistingOverlayActionsCommand.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/queryExistingOverlayActionIdsCommand.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/quickLaunch.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/index.test.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/index.ts delete mode 100644 packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/telemetry/telemetry.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/apexLspJarContents.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/codecoverage/colorizer.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexExecute.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexLogGet.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestRun.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestRunCodeAction.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestSuite.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/commands/launchApexReplayDebuggerWithCurrentFile.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/embeddedSoql/soqlCompletion.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/index.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/javaConfiguration.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/languageClient.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/settings.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/views/testDataUtil.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/views/testJSONOutputs.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/views/testNamespacedOutputs.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/views/testOutline.test.ts delete mode 100644 packages/salesforcedx-vscode-apex/test/vscode-integration/views/testOutlineNamespace.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/aliasList.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/authParameterGatherer.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginAccessToken.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWeb.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWebDevHub.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLogout.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/baseDeployRetrieve.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/configList.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/configSet.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/debuggerStop.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/deleteSource.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/deployManifest.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/deploySourcePath.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/describeMetadata.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/bootstrapCmd.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/classes/DemoController.cls delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/classes/DemoController.cls-meta.xml delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/package.xml delete mode 100755 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/Logger.cls delete mode 100755 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/Logger.cls-meta.xml delete mode 100755 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/LoggerTest.cls delete mode 100755 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/LoggerTest.cls-meta.xml delete mode 100755 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/package.xml delete mode 100755 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/triggers/AccountLogger.trigger delete mode 100755 packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/triggers/AccountLogger.trigger-meta.xml delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/listMetadata.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/openDocumentation.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgCreate.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgDelete.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgDisplay.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgList.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgOpen.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/packageInstall.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectDeployStartInteg.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectDeployStartResultParser.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectGenerate.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectGenerateManifest.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectRetrieveStartInteg.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/refreshSObjects.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/renameLightningComponent.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveManifest.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveMetadata/describers.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveMetadata/retrieveComponent.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveSourcePath.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/sourceDiff.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/startApexDebugLogging.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/stopApexDebugLogging.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/analyticsGenerateTemplate.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/apexGenerateClass.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/apexGenerateTrigger.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/customTemplates.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/forceLightningLwcTestCreate.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/internalCommandUtils.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateApp.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateAuraComponent.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateEvent.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateInterface.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateLwc.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/visualforceGenerateComponent.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/visualforceGeneratePage.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/betaDeployRetrieve.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/parameterGatherers.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/postconditionCheckers.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/preconditionCheckers.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sfCommandlet.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sourcePathStrategies.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sourceResultOutput.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/conflict/componentDiffer.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/conflict/metadataCacheService.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/conflict/persistentStorageService.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/conflict/timestampConflictDetector.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/context/workspaceContext.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/context/workspaceOrgTypeInteg.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/diagnostics/index.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/directoryDiffer.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/index.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/mocks.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/modes/index.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/notifications/index.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/notifications/progressNotification.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataCmp.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataOutlineProvider.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataType.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/orgPicker/orgList.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/predicates/index.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/salesforceProject/salesforcePackageDirectories.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/settings/pushOrDeployOnSave.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/telemetry/index.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/traceflag/DeveloperLogTraceFlag.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/util/authInfo.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/util/cliConfiguration.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/util/inputUtils.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/util/orgUtil.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/util/rootWorkspace.test-util.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/util/rootWorkspace.test.ts delete mode 100644 packages/salesforcedx-vscode-core/test/vscode-integration/util/statuses/taskView.test.ts delete mode 100644 packages/salesforcedx-vscode-lightning/test/vscode-integration/extension.test.ts delete mode 100644 packages/salesforcedx-vscode-lightning/test/vscode-integration/hover.test.ts delete mode 100644 packages/salesforcedx-vscode-lightning/test/vscode-integration/index.ts delete mode 100644 packages/salesforcedx-vscode-lightning/test/vscode-integration/intellisense.test.ts delete mode 100644 packages/salesforcedx-vscode-lightning/test/vscode-integration/navigation.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/activation/MockExtensionContext.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/activation/activationMode.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/commandUtils.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcOpen.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcPreview.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcStart.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcStop.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/hover.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/index.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/intellisense.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/jsconfig.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/metaSupport/MockRhExtension.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/metaSupport/metaSupport.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/navigation.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestDebugAction.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestRunAction.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestWatchAction.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/index.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/testResultsMocks.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/vscodeConfiguration.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testExplorer/testNode.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testExplorer/testOutlineProvider.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testIndexer/jestUtils.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testIndexer/lwcTestIndexer.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/index.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/taskService.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/testWatcher.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/getCliArgsFromJestArgs.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/getLwcTestRunnerExecutable.test.ts delete mode 100644 packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/workspaceService.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/client/client.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/client/completion.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/commands/soqlBuilderToggle.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/commands/soqlFileCreate.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/commomUtils.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/editor/htmlUtils.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/editor/queryRunner.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/editor/soqlEditorInstance.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/editor/soqlEditorProvider.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/index.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/dataProviders/csvDataProvider.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/queryDataFileService.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/queryDataViewService.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/sf.test.ts delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Account.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Attachment.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Case.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Contact.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Contract.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Lead.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Note.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Opportunity.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Order.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Pricebook2.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/PricebookEntry.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Product2.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/RecordType.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Report.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Task.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/User.json delete mode 100644 packages/salesforcedx-vscode-soql/test/vscode-integration/testUtilities.ts delete mode 100644 packages/salesforcedx-vscode-visualforce/test/vscode-integration/fileAssociations.test.ts delete mode 100644 packages/salesforcedx-vscode-visualforce/test/vscode-integration/index.ts delete mode 100644 packages/salesforcedx-vscode-visualforce/test/vscode-integration/telemetry/telemetry.test.ts diff --git a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/adapter/MockApexExtension.ts b/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/adapter/MockApexExtension.ts deleted file mode 100644 index c3beed39ce..0000000000 --- a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/adapter/MockApexExtension.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { Extension, ExtensionKind, Uri } from 'vscode'; -export class MockApexExtension implements Extension { - public extensionKind = ExtensionKind.Workspace; - constructor() { - this.id = 'salesforce.salesforcedx-vscode-apex'; - this.extensionPath = 'extension/local/path'; - this.isActive = true; - this.exports = new MockJorje(); - } - public extensionUri = Uri.parse('file://test'); - public id: string; - public extensionPath: string; - public isActive: boolean; - public packageJSON: any; - public activate(): Thenable { - return Promise.resolve('activated'); - } - public exports: any; -} - -class MockJorje { - constructor() {} - public getLineBreakpointInfo(): Promise<{}> { - const response = [ - { - uri: '/force-app/main/default/classes/A.cls', - typeref: 'A', - lines: [2, 5, 6, 7] - } - ]; - return Promise.resolve(response); - } - - public languageClientUtils = { - getStatus: () => { - return { - isReady: () => { - return true; - }, - failedToInitialize: () => { - return false; - }, - getStatusMessage: () => { - return ''; - } - }; - } - }; -} diff --git a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/adapter/debugConfigurationProvider.test.ts b/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/adapter/debugConfigurationProvider.test.ts deleted file mode 100644 index 308b85aa01..0000000000 --- a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/adapter/debugConfigurationProvider.test.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - DEBUGGER_LAUNCH_TYPE, - DEBUGGER_TYPE -} from '@salesforce/salesforcedx-apex-debugger/out/src'; -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import { DebugConfiguration, extensions, Uri, WorkspaceFolder } from 'vscode'; -import { DebugConfigurationProvider } from '../../../src/adapter/debugConfigurationProvider'; -import { nls } from '../../../src/messages'; -import { MockApexExtension } from './MockApexExtension'; - -// tslint:disable:no-unused-expression -describe('Configuration provider', () => { - let provider: DebugConfigurationProvider; - let getConfigSpy: sinon.SinonSpy; - const folder: WorkspaceFolder = { - name: 'mySalesforceProject', - index: 0, - uri: { - fsPath: '/foo' - } as Uri - }; - let mockApexExtension: sinon.SinonStub; - - beforeEach(() => { - mockApexExtension = sinon - .stub(extensions, 'getExtension') - .returns(new MockApexExtension()); - provider = new DebugConfigurationProvider(); - getConfigSpy = sinon.spy(DebugConfigurationProvider, 'getConfig'); - }); - - afterEach(() => { - getConfigSpy.restore(); - mockApexExtension.restore(); - }); - - it('Should provide default config', () => { - const expectedConfig = { - name: nls.localize('config_name_text'), - type: DEBUGGER_TYPE, - request: DEBUGGER_LAUNCH_TYPE, - userIdFilter: [], - requestTypeFilter: [], - entryPointFilter: '', - salesforceProject: '/foo' - } as DebugConfiguration; - - const configs = provider.provideDebugConfigurations(folder); - - expect(configs).to.deep.equal([expectedConfig]); - expect(getConfigSpy.calledOnce).to.be.true; - }); - - it('Should fill in empty attributes in the config', async () => { - const config = await provider.resolveDebugConfiguration(folder, { - name: '', - type: '', - request: '' - }); - - if (config) { - expect(config.name).to.equals(nls.localize('config_name_text')); - expect(config.type).to.equals(DEBUGGER_TYPE); - expect(config.request).to.equals(DEBUGGER_LAUNCH_TYPE); - expect(config.userIdFilter).to.be.an('array').that.is.empty; - expect(config.requestTypeFilter).to.be.an('array').that.is.empty; - expect(config.entryPointFilter).to.equals(''); - expect(config.salesforceProject).to.equals('/foo'); - expect(config.workspaceSettings).to.not.equals(undefined); - expect(config.lineBreakpointInfo).to.not.equals(undefined); - expect(mockApexExtension.calledOnce).to.be.true; - } else { - expect.fail( - 'Did not get configuration information from resolveDebugConfiguration' - ); - } - }); - - it('Should not modify existing config', async () => { - const config = await provider.resolveDebugConfiguration(folder, { - name: 'sampleName', - type: 'sampleType', - request: 'sampleConfigType', - requestTypeFilter: ['BATCH_APEX', 'EXECUTE_ANONYMOUS', 'FUTURE'], - entryPointFilter: 'test/entrypoint', - connectType: 'ISV_DEBUGGER', - salesforceProject: 'project/path', - userIdFilter: ['005xx7998909099'], - trace: true - }); - - if (config) { - expect(config.name).to.equals('sampleName'); - expect(config.type).to.equals('sampleType'); - expect(config.request).to.equals('sampleConfigType'); - expect(config.requestTypeFilter) - .to.be.an('array') - .to.include('BATCH_APEX'); - expect(config.entryPointFilter).to.equals('test/entrypoint'); - expect(config.connectType).to.equals('ISV_DEBUGGER'); - expect(config.salesforceProject).to.equals('project/path'); - expect(config.userIdFilter) - .to.be.an('array') - .to.deep.include('005xx7998909099'); - expect(config.trace).to.equals(true); - expect(config.workspaceSettings).to.not.equals(undefined); - expect(config.lineBreakpointInfo).to.not.equals(undefined); - expect(mockApexExtension.calledOnce).to.be.true; - } else { - expect.fail( - 'Did not get configuration information from resolveDebugConfiguration' - ); - } - }); -}); diff --git a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/index.test.ts b/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/index.test.ts deleted file mode 100644 index fddf9851f3..0000000000 --- a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/index.test.ts +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - DEBUGGER_TYPE, - EXCEPTION_BREAKPOINT_BREAK_MODE_ALWAYS, - EXCEPTION_BREAKPOINT_BREAK_MODE_NEVER, - LIVESHARE_DEBUGGER_TYPE -} from '@salesforce/salesforcedx-apex-debugger/out/src'; -import { expect } from 'chai'; -import * as vscode from 'vscode'; -import { - ExceptionBreakpointItem, - getDebuggerType, - getExceptionBreakpointCache, - mergeExceptionBreakpointInfos, - updateExceptionBreakpointCache -} from '../../src/index'; -import { nls } from '../../src/messages'; - -describe('Extension Setup', () => { - describe('Exception breakpoint', () => { - describe('Merge breakpoint infos', () => { - let breakpointInfos: ExceptionBreakpointItem[] = []; - - beforeEach(() => { - breakpointInfos = [ - { - typeref: 'barexception', - label: 'barexception', - uri: 'file:///barexception.cls', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_NEVER, - description: '' - }, - { - typeref: 'fooexception', - label: 'fooexception', - uri: 'file:///fooexception.cls', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_NEVER, - description: '' - }, - { - typeref: 'com/salesforce/api/exception/NullPointerException', - label: 'System.NullPointerException', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_NEVER, - description: '' - } - ]; - }); - it('Should order breakpoints by enabled first', () => { - const exceptionBreakpointQuickPicks = mergeExceptionBreakpointInfos( - breakpointInfos, - ['com/salesforce/api/exception/NullPointerException'] - ); - - expect(exceptionBreakpointQuickPicks.length).to.equal(3); - expect(exceptionBreakpointQuickPicks[0].typeref).to.equal( - 'com/salesforce/api/exception/NullPointerException' - ); - expect(exceptionBreakpointQuickPicks[0].breakMode).to.equal( - EXCEPTION_BREAKPOINT_BREAK_MODE_ALWAYS - ); - expect(exceptionBreakpointQuickPicks[0].description).to.equal( - `$(stop) ${nls.localize('always_break_text')}` - ); - expect(exceptionBreakpointQuickPicks[1].typeref).to.equal( - 'barexception' - ); - expect(exceptionBreakpointQuickPicks[1].breakMode).to.equal( - EXCEPTION_BREAKPOINT_BREAK_MODE_NEVER - ); - expect(exceptionBreakpointQuickPicks[2].typeref).to.equal( - 'fooexception' - ); - expect(exceptionBreakpointQuickPicks[2].breakMode).to.equal( - EXCEPTION_BREAKPOINT_BREAK_MODE_NEVER - ); - }); - - it('Should not modify breakpoint infos if enabled breakpoints has empty typerefs', () => { - const exceptionBreakpointQuickPicks = mergeExceptionBreakpointInfos( - breakpointInfos, - [] - ); - - expect(exceptionBreakpointQuickPicks).to.deep.equal(breakpointInfos); - }); - }); - - describe('Update cache', () => { - beforeEach(() => { - getExceptionBreakpointCache().clear(); - }); - - it('Should add new breakpoint', () => { - updateExceptionBreakpointCache({ - typeref: 'barexception', - label: 'barexception', - uri: 'file:///barexception.cls', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_ALWAYS, - description: '' - }); - - expect(getExceptionBreakpointCache().size).to.equal(1); - }); - - it('Should not add existing breakpoint', () => { - updateExceptionBreakpointCache({ - typeref: 'barexception', - label: 'barexception', - uri: 'file:///barexception.cls', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_ALWAYS, - description: '' - }); - - expect(getExceptionBreakpointCache().size).to.equal(1); - - updateExceptionBreakpointCache({ - typeref: 'barexception', - label: 'barexception', - uri: 'file:///barexception.cls', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_ALWAYS, - description: '' - }); - - expect(getExceptionBreakpointCache().size).to.equal(1); - }); - - it('Should remove existing breakpoint', () => { - updateExceptionBreakpointCache({ - typeref: 'barexception', - label: 'barexception', - uri: 'file:///barexception.cls', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_ALWAYS, - description: '' - }); - - expect(getExceptionBreakpointCache().size).to.equal(1); - - updateExceptionBreakpointCache({ - typeref: 'barexception', - label: 'barexception', - uri: 'file:///barexception.cls', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_NEVER, - description: '' - }); - - expect(getExceptionBreakpointCache().size).to.equal(0); - }); - - it('Should not remove nonexisting breakpoint', () => { - updateExceptionBreakpointCache({ - typeref: 'barexception', - label: 'barexception', - uri: 'file:///barexception.cls', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_ALWAYS, - description: '' - }); - - expect(getExceptionBreakpointCache().size).to.equal(1); - - updateExceptionBreakpointCache({ - typeref: 'fooexception', - label: 'fooexception', - uri: 'file:///fooexception.cls', - breakMode: EXCEPTION_BREAKPOINT_BREAK_MODE_NEVER, - description: '' - }); - - expect(getExceptionBreakpointCache().size).to.equal(1); - }); - }); - }); - - describe('Custom request', () => { - it('Should extract underlying debugger type', async () => { - const session = { - type: LIVESHARE_DEBUGGER_TYPE, - customRequest: async (command: string) => { - return Promise.resolve(DEBUGGER_TYPE); - } - }; - - const realType = await getDebuggerType( - (session as any) as vscode.DebugSession - ); - - expect(realType).to.be.equal(DEBUGGER_TYPE); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/index.ts b/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/index.ts deleted file mode 100644 index 60c4d2ca76..0000000000 --- a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { join, normalize } from 'path'; - -// eslint-disable-next-line @typescript-eslint/no-var-requires -const testRunner = require('@salesforce/salesforcedx-test-utils-vscode/out/src/testrunner'); -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure( - { - ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results - timeout: 360000 - }, - normalize(join(__dirname, '..', '..', '..')) -); - -module.exports = testRunner; diff --git a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/telemetry/telemetry.test.ts b/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/telemetry/telemetry.test.ts deleted file mode 100644 index e4995af96a..0000000000 --- a/packages/salesforcedx-vscode-apex-debugger/test/vscode-integration/telemetry/telemetry.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { assert, match, SinonStub, stub } from 'sinon'; -import TelemetryReporter from 'vscode-extension-telemetry'; -import { TelemetryService } from '../../../src/telemetry/telemetry'; - -describe('Telemetry', () => { - let reporter: TelemetryReporter; - let sendEvent: SinonStub; - - beforeEach(() => { - reporter = new TelemetryReporter('salesforcedx-vscode', 'v1', 'test567890'); - sendEvent = stub(reporter, 'sendTelemetryEvent'); - }); - - afterEach(async () => { - sendEvent.restore(); - await reporter.dispose(); - }); - - it('Should send telemetry data', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendExtensionActivationEvent([0, 300]); - assert.calledOnce(sendEvent); - }); - - it('Should not send telemetry data', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], false); - - telemetryService.sendExtensionActivationEvent([0, 400]); - assert.notCalled(sendEvent); - }); - - it('Should send correct data format on sendExtensionActivationEvent', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendExtensionActivationEvent([0, 400]); - assert.calledOnce(sendEvent); - - const expectedProps = { - extensionName: 'salesforcedx-vscode-apex-debugger' - }; - const expectedMeasures = { - startupTime: match.number - }; - assert.calledWith( - sendEvent, - 'activationEvent', - expectedProps, - match(expectedMeasures) - ); - }); - - it('Should send correct data format on sendExtensionDeactivationEvent', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendExtensionDeactivationEvent(); - assert.calledOnce(sendEvent); - - const expectedData = { - extensionName: 'salesforcedx-vscode-apex-debugger' - }; - assert.calledWith(sendEvent, 'deactivationEvent', expectedData); - }); -}); diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/adapter/MockApexExtension.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/adapter/MockApexExtension.ts deleted file mode 100644 index 46251ced86..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/adapter/MockApexExtension.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { Extension, ExtensionKind, Uri } from 'vscode'; -export class MockApexExtension implements Extension { - public extensionKind = ExtensionKind.Workspace; - - constructor() { - this.id = 'salesforce.salesforcedx-vscode-apex'; - this.extensionPath = 'extension/local/path'; - this.isActive = true; - this.exports = new MockJorje(); - } - public extensionUri = Uri.parse('file://test'); - public id: string; - public extensionPath: string; - public isActive: boolean; - public packageJSON: any; - public activate(): Thenable { - return Promise.resolve('activated'); - } - public exports: any; -} - -class MockJorje { - constructor() {} - public getLineBreakpointInfo(): Promise<{}> { - const response = [ - { - uri: '/force-app/main/default/classes/A.cls', - typeref: 'A', - lines: [2, 5, 6, 7] - } - ]; - return Promise.resolve(response); - } - - public languageClientUtils = { - getStatus: () => { - return { - isReady: () => { - return true; - }, - failedToInitialize: () => { - return false; - }, - getStatusMessage: () => { - return ''; - } - }; - } - }; -} diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/adapter/debugConfigurationProvider.test.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/adapter/debugConfigurationProvider.test.ts deleted file mode 100644 index a185003514..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/adapter/debugConfigurationProvider.test.ts +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - DEBUGGER_LAUNCH_TYPE, - DEBUGGER_TYPE, - LAST_OPENED_LOG_FOLDER_KEY, - LAST_OPENED_LOG_KEY -} from '@salesforce/salesforcedx-apex-replay-debugger/out/src/constants'; -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import { - DebugConfiguration, - ExtensionContext, - extensions, - Uri, - WorkspaceFolder -} from 'vscode'; -import { DebugConfigurationProvider } from '../../../src/adapter/debugConfigurationProvider'; -import { updateLastOpened } from '../../../src/index'; -import { nls } from '../../../src/messages'; -import { MockApexExtension } from './MockApexExtension'; - -// tslint:disable:no-unused-expression -describe('Configuration provider', () => { - let provider: DebugConfigurationProvider; - let getConfigSpy: sinon.SinonSpy; - const folder: WorkspaceFolder = { - name: 'myWorkspaceFolder', - index: 0, - uri: { - fsPath: '/foo' - } as Uri - }; - let mockApexExtension: sinon.SinonStub; - - beforeEach(() => { - getConfigSpy = sinon.spy(DebugConfigurationProvider, 'getConfig'); - mockApexExtension = sinon - .stub(extensions, 'getExtension') - .returns(new MockApexExtension()); - provider = new DebugConfigurationProvider(); - }); - - afterEach(() => { - getConfigSpy.restore(); - mockApexExtension.restore(); - }); - - it('Should provide default config', () => { - const expectedConfig = { - name: nls.localize('config_name_text'), - type: DEBUGGER_TYPE, - request: DEBUGGER_LAUNCH_TYPE, - logFile: '${command:AskForLogFileName}', - stopOnEntry: true, - trace: true - } as DebugConfiguration; - - const configs = provider.provideDebugConfigurations(folder); - - expect(configs).to.deep.equal([expectedConfig]); - expect(getConfigSpy.calledOnce).to.be.true; - }); - - it('Should provide config with specified log file', () => { - const expectedConfig = { - name: nls.localize('config_name_text'), - type: DEBUGGER_TYPE, - request: DEBUGGER_LAUNCH_TYPE, - logFile: '/path/foo.cls', - stopOnEntry: true, - trace: true - } as DebugConfiguration; - - const config = DebugConfigurationProvider.getConfig('/path/foo.cls'); - expect(config).to.deep.equal(expectedConfig); - }); - - it('Should fill in empty attributes in the config', async () => { - const config = await provider.resolveDebugConfiguration(folder, { - name: '', - type: '', - request: '' - }); - - if (config) { - expect(config.name).to.equals(nls.localize('config_name_text')); - expect(config.type).to.equals(DEBUGGER_TYPE); - expect(config.request).to.equals(DEBUGGER_LAUNCH_TYPE); - expect(config.logFile).to.equals('${command:AskForLogFileName}'); - expect(config.stopOnEntry).to.equals(true); - expect(config.trace).to.equals(true); - expect(config.projectPath).to.not.equals(undefined); - expect(config.lineBreakpointInfo).to.not.equals(undefined); - expect(mockApexExtension.calledOnce).to.be.true; - } else { - expect.fail( - 'Did not get configuration information from resolveDebugConfiguration' - ); - } - }); - - it('Should not modify existing config', async () => { - const config = await provider.resolveDebugConfiguration(folder, { - name: 'sampleName', - type: 'sampleType', - request: 'sampleConfigType', - logFile: 'foo.log', - stopOnEntry: false, - trace: false - }); - - if (config) { - expect(config.name).to.equals('sampleName'); - expect(config.type).to.equals('sampleType'); - expect(config.request).to.equals('sampleConfigType'); - expect(config.logFile).to.equals('foo.log'); - expect(config.stopOnEntry).to.equals(false); - expect(config.trace).to.equals(false); - expect(config.projectPath).to.not.equals(undefined); - expect(config.lineBreakpointInfo).to.not.equals(undefined); - expect(mockApexExtension.calledOnce).to.be.true; - } else { - expect.fail( - 'Did not get configuration information from resolveDebugConfiguration' - ); - } - }); -}); - -describe('extension context log path tests', () => { - const mementoKeys: string[] = []; - const mementoValues: string[] = []; - const mContext = { - workspaceState: { - update: (key: string, value: any) => { - mementoKeys.push(key); - mementoValues.push(value as string); - } - } - }; - - it('Should update the extension context', () => { - updateLastOpened( - (mContext as any) as ExtensionContext, - '/foo/bar/logfilename.log' - ); - expect(mementoKeys).to.have.same.members([ - `${LAST_OPENED_LOG_KEY}`, - `${LAST_OPENED_LOG_FOLDER_KEY}` - ]); - expect(mementoValues).to.have.same.members([ - '/foo/bar/logfilename.log', - '/foo/bar' - ]); - }); -}); diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/checkpoints/checkpointService.test.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/checkpoints/checkpointService.test.ts deleted file mode 100644 index 75fca4c47f..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/checkpoints/checkpointService.test.ts +++ /dev/null @@ -1,720 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ActionScriptEnum } from '@salesforce/salesforcedx-apex-replay-debugger/out/src/commands'; -import { - CHECKPOINT, - CHECKPOINTS_LOCK_STRING -} from '@salesforce/salesforcedx-apex-replay-debugger/out/src/constants'; -import * as AsyncLock from 'async-lock'; -import { assert, expect } from 'chai'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - ApexExecutionOverlayAction, - CheckpointInfoActionScriptNode, - CheckpointInfoActionScriptTypeNode, - CheckpointInfoIterationNode, - CheckpointNode, - checkpointService, - checkpointUtils, - parseCheckpointInfoFromBreakpoint, - processBreakpointChangedForCheckpoints, - sfToggleCheckpoint -} from '../../../src/breakpoints/checkpointService'; - -describe('Checkpoint Service - unit', () => { - const breakpointId = '6c1d848c-fake-4c2c-8b90-5fabe1740da4'; - const breakpointEnabled = true; - const actionObjectId = '1doxx000000FAKE'; - const uriInput = 'file:///bar.cls'; - const sourceFileInput = 'foo.cls'; - const typeRefInput = 'foo'; - const lineInput = 5; - - const checkpointOverlayAction: ApexExecutionOverlayAction = { - ActionScript: '', - ActionScriptType: ActionScriptEnum.None, - ExecutableEntityName: typeRefInput, - IsDumpingHeap: true, - Iteration: 1, - Line: lineInput - }; - - // Clean out the checkpoint list after each usage to ensure that - // each test has a clean slate. Also has the added benefit of - // additional testing for deleteCheckpointNode - afterEach(() => { - clearOutCheckpoints(); - }); - - it('Verify checkpoint arguments and pre-set default values', async () => { - const checkpointOverlayActionWithNoTypeRef: ApexExecutionOverlayAction = { - ActionScript: '', - ActionScriptType: ActionScriptEnum.None, - ExecutableEntityName: undefined, - IsDumpingHeap: true, - Iteration: 1, - Line: lineInput - }; - const cpNode = checkpointService.createCheckpointNode( - breakpointId, - breakpointEnabled, - uriInput, - sourceFileInput, - checkpointOverlayActionWithNoTypeRef - ); - - // Verify the typeRef is undefined until set - expect(cpNode.getCheckpointTypeRef()).to.be.equal(undefined); - cpNode.setCheckpointTypeRef(typeRefInput); - - // Verify get methods are returning what was input - expect(cpNode.getCheckpointUri()).to.be.equal(uriInput); - expect(cpNode.getCheckpointLineNumber()).to.be.equal(lineInput); - - // grab the json created from the object's internal ApexExecutionOverlayAction and - // rount trip it back into an ApexExecutionOverlayAction and verify the values - const jsonString = cpNode.createJSonStringForOverlayAction(); - const overlayAction = JSON.parse(jsonString) as ApexExecutionOverlayAction; - - // verify that the overlay action contains all inpput information - expect(overlayAction.ExecutableEntityName).to.be.equal(typeRefInput); - expect(overlayAction.Line).to.be.equal(lineInput); - - // verify the default values - // IsDumpingHeap is initialized to true - // Iteration is initalizied to 1 - // ActionScriptType is initalized to ActionScriptEnum.None - // ActionScript is an empty string - expect(overlayAction.IsDumpingHeap).to.be.equal(true); - expect(overlayAction.Iteration).to.be.equal(1); - expect(overlayAction.ActionScriptType).to.be.equal(ActionScriptEnum.None); - expect(overlayAction.ActionScript).to.be.equal(''); - }); - - it('Verify CheckpointNode has 3 child CheckpointInfoNodes after creation', async () => { - const cpNode = checkpointService.createCheckpointNode( - breakpointId, - breakpointEnabled, - uriInput, - sourceFileInput, - checkpointOverlayAction - ); - - expect(cpNode.getChildren().length).to.be.eq(3); - - // Verify that CheckpointNode as 3 child CheckpointInfo when the node was initially created and - // only one of each type was created. - let totalCheckpointInfoActionScriptNode = 0; - let totalCheckpointInfoActionScriptTypeNode = 0; - let totalCheckpointInfoIterationNode = 0; - let totalUnknownNodeTypes = 0; - for (const infoNode of cpNode.getChildren()) { - // Can't do a switch on instance of but utilizing the constructor - // can get around this - switch (infoNode.constructor) { - case CheckpointInfoActionScriptNode: { - totalCheckpointInfoActionScriptNode++; - break; - } - case CheckpointInfoActionScriptTypeNode: { - totalCheckpointInfoActionScriptTypeNode++; - break; - } - case CheckpointInfoIterationNode: { - totalCheckpointInfoIterationNode++; - break; - } - default: { - totalUnknownNodeTypes++; - } - } - } - expect(totalCheckpointInfoActionScriptNode).to.be.eq(1); - expect(totalCheckpointInfoActionScriptTypeNode).to.be.eq(1); - expect(totalCheckpointInfoIterationNode).to.be.eq(1); - expect(totalUnknownNodeTypes).to.be.eq(0); - }); - - it('CheckpointNode, Action Command Result tests', async () => { - const cpNode = checkpointService.createCheckpointNode( - breakpointId, - breakpointEnabled, - uriInput, - sourceFileInput, - checkpointOverlayAction - ); - - expect(cpNode.getActionCommandResultId()).to.be.eq(undefined); - - cpNode.setActionCommandResultId(actionObjectId); - expect(cpNode.getActionCommandResultId()).to.be.eq(actionObjectId); - - expect(cpNode.getChildren().length).to.be.eq(3); - }); -}); - -// Verify that the vscode.debug.onDidChangeBreakpoints cal -describe('Verify checkpoint callback for vscode.debug.onDidChangeBreakpoints', () => { - // constant empty list - const bpEmpty: vscode.Breakpoint[] = []; - - // These lists will get populated during the tests and cleared out after each one - let bpAdd: vscode.Breakpoint[] = []; - let bpRemove: vscode.Breakpoint[] = []; - let bpChange: vscode.Breakpoint[] = []; - - const uriInput = 'file:///bar.cls'; - const lineInput = 5; - // The breakpoint Id is a string, for tests with multiple breakpoints use this - // as a base and append a number onto it. - const breakpointId = '6c1d848c-fake-4c2c-8b90-5fabe1740da4'; - - let lockSpy: sinon.SinonSpy; - beforeEach(() => { - lockSpy = sinon.spy(AsyncLock.prototype, 'acquire'); - }); - - afterEach(() => { - clearOutCheckpoints(); - // empty any arrays used for testing - bpAdd = []; - bpRemove = []; - bpChange = []; - lockSpy.restore(); - }); - - it('adds a single checkpoint', async () => { - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const uri = vscode.Uri.parse(uriInput); - const location = new vscode.Location(uri, range); - const breakpoint = new vscode.SourceBreakpoint( - location, - true, - CHECKPOINT, - undefined - ); - bpAdd.push(breakpoint); - await processBreakpointChangedForCheckpoints({ - added: bpAdd, - removed: bpRemove, - changed: bpChange - }); - - // Verify that a single checkpoint has been added to the checkpoint service - const theNode = checkpointService.returnCheckpointNodeIfAlreadyExists( - breakpoint.id - ); - if (!theNode) { - assert.fail( - 'Should have created a single node in the checkpointService and did not.' - ); - } - expect(lockSpy.calledOnce).to.equal(true); - expect(lockSpy.getCall(0).args[0]).to.equal(CHECKPOINTS_LOCK_STRING); - }); - - it('adds multiple checkpoints', async () => { - // Note: VS Code is going to ensure things like not having multiple breakpoints on the same line however - // for the purposes of expediency only the IDs will be different for these tests - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const uri = vscode.Uri.parse(uriInput); - const location = new vscode.Location(uri, range); - const breakpoint1 = new vscode.SourceBreakpoint( - location, - true, - CHECKPOINT, - undefined - ); - - bpAdd.push(breakpoint1); - const breakpoint2 = new vscode.SourceBreakpoint( - location, - true, - CHECKPOINT, - undefined - ); - - bpAdd.push(breakpoint2); - - await processBreakpointChangedForCheckpoints({ - added: bpAdd, - removed: bpRemove, - changed: bpChange - }); - - // Verify that a single checkpoint has been added to the checkpoint service - const theNode1 = checkpointService.returnCheckpointNodeIfAlreadyExists( - breakpoint1.id - ); - if (!theNode1) { - assert.fail( - 'Should have created a node in the checkpointService with id: ' + - breakpoint1.id - ); - } - - const theNode2 = checkpointService.returnCheckpointNodeIfAlreadyExists( - breakpoint2.id - ); - if (!theNode2) { - assert.fail( - 'Should have created a node in the checkpointService with id: ' + - breakpoint1.id - ); - } - expect(lockSpy.calledTwice).to.equal(true); - expect(lockSpy.getCall(0).args[0]).to.equal(CHECKPOINTS_LOCK_STRING); - expect(lockSpy.getCall(1).args[0]).to.equal(CHECKPOINTS_LOCK_STRING); - }); - - it('add then remove checkpoint', async () => { - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const uri = vscode.Uri.parse(uriInput); - const location = new vscode.Location(uri, range); - const breakpoint = new vscode.SourceBreakpoint( - location, - true, - CHECKPOINT, - undefined - ); - - bpAdd.push(breakpoint); - await processBreakpointChangedForCheckpoints({ - added: bpAdd, - removed: bpRemove, - changed: bpChange - }); - - // Verify that a single checkpoint has been added to the checkpoint service - const theNode = checkpointService.returnCheckpointNodeIfAlreadyExists( - breakpoint.id - ); - if (!theNode) { - assert.fail( - 'Should have created a single node in the checkpointService and did not.' - ); - } - - // Add the breakpoint to the removal list - bpRemove.push(breakpoint); - await processBreakpointChangedForCheckpoints({ - added: bpEmpty, - removed: bpRemove, - changed: bpChange - }); - - const deletedNote = checkpointService.returnCheckpointNodeIfAlreadyExists( - breakpoint.id - ); - // The node should be undefined as it was deleted - if (deletedNote) { - assert.fail('Should have removed the checkpoint node and did not.'); - } - // Expect one lock call for add and one for delete - expect(lockSpy.calledTwice).to.equal(true); - expect(lockSpy.getCall(0).args[0]).to.equal(CHECKPOINTS_LOCK_STRING); - expect(lockSpy.getCall(1).args[0]).to.equal(CHECKPOINTS_LOCK_STRING); - }); - - it('changing the logMessage can change the ActionScriptType', async () => { - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const uri = vscode.Uri.parse(uriInput); - const location = new vscode.Location(uri, range); - const breakpoint = new vscode.SourceBreakpoint( - location, - true, - CHECKPOINT, - undefined - ); - - bpAdd.push(breakpoint); - await processBreakpointChangedForCheckpoints({ - added: bpAdd, - removed: bpRemove, - changed: bpChange - }); - - // The first breakpoint should have no ActionScript or ActionScriptType - let theNode = checkpointService.returnCheckpointNodeIfAlreadyExists( - breakpoint.id - ); - if (theNode) { - expect(theNode.getActionScriptType()).to.be.equal(ActionScriptEnum.None); - expect(theNode.getActionScript()).to.be.equal(''); - } else { - assert.fail('Did not create the initial breakpoint'); - } - - // Update the breakpoint to an Apex action - const apexLogMessage = 'SomeApexClass.SomeApexStaticFunction()'; - (breakpoint as any).logMessage = apexLogMessage; - bpChange.push(breakpoint); - await processBreakpointChangedForCheckpoints({ - added: bpEmpty, - removed: bpRemove, - changed: bpChange - }); - - theNode = checkpointService.returnCheckpointNodeIfAlreadyExists( - breakpoint.id - ); - if (theNode) { - expect(theNode.getActionScriptType()).to.be.equal(ActionScriptEnum.Apex); - expect(theNode.getActionScript()).to.be.equal(apexLogMessage); - } else { - assert.fail('Unable to get node after Apex logMessage update'); - } - bpChange.pop(); - - // Update the breakpoint to a SOQL action - const soqlLogMessage = 'select something from something where something'; - (breakpoint as any).logMessage = soqlLogMessage; - bpChange.push(breakpoint); - await processBreakpointChangedForCheckpoints({ - added: bpEmpty, - removed: bpRemove, - changed: bpChange - }); - - theNode = checkpointService.returnCheckpointNodeIfAlreadyExists( - breakpoint.id - ); - if (theNode) { - expect(theNode.getActionScriptType()).to.be.equal(ActionScriptEnum.SOQL); - expect(theNode.getActionScript()).to.be.equal(soqlLogMessage); - } else { - assert.fail('Unable to get node after SOQL logMessage update'); - } - - // Expect one lock call for add and two for change - expect(lockSpy.calledThrice).to.equal(true); - expect(lockSpy.getCall(0).args[0]).to.equal(CHECKPOINTS_LOCK_STRING); - expect(lockSpy.getCall(1).args[0]).to.equal(CHECKPOINTS_LOCK_STRING); - expect(lockSpy.getCall(2).args[0]).to.equal(CHECKPOINTS_LOCK_STRING); - }); -}); - -// Checkpoints rely on the information from conditional source breakpoint. -// The pieces of those and what they belong to are as follows: -// hitCondition = Iteration -// logMessage = actionScript with the following criteria -// 1. if the logMessage is empty or undefined then the ActionScriptType is ActionScriptEnum.None -// 2. if the logMessage starts with 'select' then the ActionScriptType is ActionScriptEnum.SOQL -// 3. if the logMessage isn't empty and doesn't start with 'select' then it is treated as ActionScriptEnum.Apex -// IsDumpingHeap defaults to true, there's currently no way to reset this. -describe('Checkpoint parsing from SourceBreakpoint', () => { - const uriInput = 'file:///bar.cls'; - const lineInput = 5; - - it('parse overlay action with default values', async () => { - // Create the range (line 5 of the file but 0 base means we need to subtract one for the breakpoint range) - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const uri = vscode.Uri.parse(uriInput); - const location = new vscode.Location(uri, range); - const breakpoint = new vscode.SourceBreakpoint( - location, - true, - CHECKPOINT, - undefined - ); - const overlayAction = parseCheckpointInfoFromBreakpoint(breakpoint); - expect(overlayAction.ActionScript).to.be.equal(''); - expect(overlayAction.ActionScriptType).to.be.equal(ActionScriptEnum.None); - expect(overlayAction.IsDumpingHeap).to.be.equal(true); - expect(overlayAction.Iteration).to.be.equal(1); - expect(overlayAction.Line).to.be.equal(5); - expect(overlayAction.ExecutableEntityName).to.be.equal(undefined); - }); - - it('parse overlay action with hitCondition (iteration)', async () => { - // Create the range (line 5 of the file but 0 base means we need to subtract one for the breakpoint range) - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const uri = vscode.Uri.parse(uriInput); - const location = new vscode.Location(uri, range); - const breakpoint = new vscode.SourceBreakpoint( - location, - true, - CHECKPOINT, - '3' - ); - const overlayAction = parseCheckpointInfoFromBreakpoint(breakpoint); - expect(overlayAction.ActionScript).to.be.equal(''); - expect(overlayAction.ActionScriptType).to.be.equal(ActionScriptEnum.None); - expect(overlayAction.IsDumpingHeap).to.be.equal(true); - expect(overlayAction.Iteration).to.be.equal(3); - expect(overlayAction.Line).to.be.equal(5); - expect(overlayAction.ExecutableEntityName).to.be.equal(undefined); - }); - - it('parse overlay action with logMessage that is SOQL', async () => { - // Create the range (line 5 of the file but 0 base means we need to subtract one for the breakpoint range) - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const uri = vscode.Uri.parse(uriInput); - const location = new vscode.Location(uri, range); - const breakpoint = new vscode.SourceBreakpoint( - location, - true, - CHECKPOINT, - undefined - ); - const logMessage = 'select something from something'; - (breakpoint as any).logMessage = logMessage; - const overlayAction = parseCheckpointInfoFromBreakpoint(breakpoint); - expect(overlayAction.ActionScript).to.be.equal(logMessage); - expect(overlayAction.ActionScriptType).to.be.equal(ActionScriptEnum.SOQL); - expect(overlayAction.IsDumpingHeap).to.be.equal(true); - expect(overlayAction.Iteration).to.be.equal(1); - expect(overlayAction.Line).to.be.equal(5); - expect(overlayAction.ExecutableEntityName).to.be.equal(undefined); - }); - - it('parse overlay action with logMessage that is Apex', async () => { - // Create the range (line 5 of the file but 0 base means we need to subtract one for the breakpoint range) - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const uri = vscode.Uri.parse(uriInput); - const location = new vscode.Location(uri, range); - const breakpoint = new vscode.SourceBreakpoint( - location, - true, - CHECKPOINT, - undefined - ); - const logMessage = 'SomeApexClass.SomeApexStaticFunction()'; - (breakpoint as any).logMessage = logMessage; - const overlayAction = parseCheckpointInfoFromBreakpoint(breakpoint); - expect(overlayAction.ActionScript).to.be.equal(logMessage); - expect(overlayAction.ActionScriptType).to.be.equal(ActionScriptEnum.Apex); - expect(overlayAction.IsDumpingHeap).to.be.equal(true); - expect(overlayAction.Iteration).to.be.equal(1); - expect(overlayAction.Line).to.be.equal(5); - expect(overlayAction.ExecutableEntityName).to.be.equal(undefined); - }); -}); - -describe('Verify SFDX Toggle Checkpoint callback, sfToggleCheckpoint', () => { - const breakpointEnabled = true; - const uriInput = vscode.Uri.parse('file:///bar.cls'); - const lineInput = 5; - - let addBreakpointsStub: sinon.SinonStub; - let removeBreakpointsStub: sinon.SinonStub; - let fetchActiveEditorUriStub: sinon.SinonStub; - let fetchActiveSelectionLineNumberStub: sinon.SinonStub; - let bpAdd: vscode.Breakpoint[] = []; - let bpArr: vscode.Breakpoint[] = []; - - beforeEach(() => { - // These need to be stubbed in order to not require an open file in an active editor with a selection. - fetchActiveEditorUriStub = sinon - .stub(checkpointUtils, 'fetchActiveEditorUri') - .returns(uriInput); - fetchActiveSelectionLineNumberStub = sinon - .stub(checkpointUtils, 'fetchActiveSelectionLineNumber') - .returns(lineInput - 1); - }); - afterEach(async () => { - addBreakpointsStub.restore(); - removeBreakpointsStub.restore(); - fetchActiveEditorUriStub.restore(); - fetchActiveSelectionLineNumberStub.restore(); - bpAdd = []; - bpArr = []; - clearOutCheckpoints(); - await clearExistingBreakpoints(); - }); - - it('Toggle adds a new checkpoint breakpoint on a line with no existing breakpoint or checkpoint', async () => { - addBreakpointsStub = sinon.stub(vscode.debug, 'addBreakpoints'); - removeBreakpointsStub = sinon.stub(vscode.debug, 'removeBreakpoints'); - // With no existing breakpoints the toggle will create one - // and call addBreakpoints. - await sfToggleCheckpoint(); - // Nothing should be deleted - expect(removeBreakpointsStub.notCalled).to.be.equal(true); - // Add should be called once with a single argument - expect(addBreakpointsStub.calledOnce).to.be.equal(true); - bpArr = addBreakpointsStub.getCall(0).args[0]; - expect(bpArr.length).to.be.equal(1); - // The condition in the add should be a checkpoint - expect((bpArr[0] as vscode.SourceBreakpoint).condition).to.be.equal( - CHECKPOINT - ); - // Verify the uri/line information - expect( - (bpArr[0] as vscode.SourceBreakpoint).location.uri.toString() - ).to.be.equal(uriInput.toString()); - expect( - (bpArr[0] as vscode.SourceBreakpoint).location.range.start.line - ).to.be.equal(lineInput - 1); - }); - - it('Toggle an existing non-checkpoint breakpoint recreates the breakpoint as a checkopint breakpoint', async () => { - // create a non-checkpoint breakpoint which will be the existing breakpoint - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const location = new vscode.Location(uriInput, range); - const breakpoint = new vscode.SourceBreakpoint( - location, - breakpointEnabled, - undefined, - undefined - ); - // This is necessary to add an existing breakpoint to find - bpAdd.push(breakpoint); - await vscode.debug.addBreakpoints(bpAdd); - - addBreakpointsStub = sinon.stub(vscode.debug, 'addBreakpoints'); - removeBreakpointsStub = sinon.stub(vscode.debug, 'removeBreakpoints'); - // With an existing breakpoints the old one will have to be deleted before the and call addBreakpoints. - await sfToggleCheckpoint(); - - // Verify the remove arguments - expect(removeBreakpointsStub.calledOnce).to.be.equal(true); - bpArr = removeBreakpointsStub.getCall(0).args[0]; - expect(bpArr.length).to.be.equal(1); - expect( - breakpointsHaveSameUriAndSourceLine(breakpoint, bpArr[0]) - ).to.be.equal(true); - // The condition in the remove should be undefined - expect((bpArr[0] as vscode.SourceBreakpoint).condition).to.be.equal( - undefined - ); - - // Verify the add arguments which should be the same - expect(addBreakpointsStub.calledOnce).to.be.equal(true); - bpArr = addBreakpointsStub.getCall(0).args[0]; - expect(bpArr.length).to.be.equal(1); - expect( - breakpointsHaveSameUriAndSourceLine(breakpoint, bpArr[0]) - ).to.be.equal(true); - // The condition in the add should be a checkpoint - expect((bpArr[0] as vscode.SourceBreakpoint).condition).to.be.equal( - CHECKPOINT - ); - }); - - it('Toggling an existing non-checkpoint breakpoint only keeps the hitCondition', async () => { - // create a non-checkpoint breakpoint with a hit condition - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const location = new vscode.Location(uriInput, range); - const hitCondition = '4'; - const breakpoint = new vscode.SourceBreakpoint( - location, - breakpointEnabled, - undefined, - hitCondition - ); - bpAdd.push(breakpoint); - await vscode.debug.addBreakpoints(bpAdd); - - addBreakpointsStub = sinon.stub(vscode.debug, 'addBreakpoints'); - removeBreakpointsStub = sinon.stub(vscode.debug, 'removeBreakpoints'); - // With an existing breakpoints the old one will have to be deleted before the and call addBreakpoints. - await sfToggleCheckpoint(); - - // Verify the remove arguments - expect(removeBreakpointsStub.calledOnce).to.be.equal(true); - bpArr = removeBreakpointsStub.getCall(0).args[0]; - expect(bpArr.length).to.be.equal(1); - expect( - breakpointsHaveSameUriAndSourceLine(breakpoint, bpArr[0]) - ).to.be.equal(true); - // The condition in the remove should be undefined - expect((bpArr[0] as vscode.SourceBreakpoint).condition).to.be.equal( - undefined - ); - - // Verify the add arguments which should be the same - expect(addBreakpointsStub.calledOnce).to.be.equal(true); - bpArr = addBreakpointsStub.getCall(0).args[0]; - expect(bpArr.length).to.be.equal(1); - expect( - breakpointsHaveSameUriAndSourceLine(breakpoint, bpArr[0]) - ).to.be.equal(true); - // The condition in the add should be a checkpoint - expect((bpArr[0] as vscode.SourceBreakpoint).condition).to.be.equal( - CHECKPOINT - ); - expect(bpArr[0].hitCondition).to.be.equal(hitCondition); - expect(bpArr[0].logMessage).to.be.equal(undefined); - expect(bpArr[0].enabled).to.be.equal(true); - }); - - it('Toggle an existing checkpoint breakpoint removes the breakpoint', async () => { - // create a checkpoint breakpoint to remove - const range = new vscode.Range(lineInput - 1, 0, lineInput - 1, 0); - const location = new vscode.Location(uriInput, range); - const breakpoint = new vscode.SourceBreakpoint( - location, - breakpointEnabled, - CHECKPOINT, - undefined - ); - // This is necessary to add an existing breakpoint to find - bpAdd.push(breakpoint); - await vscode.debug.addBreakpoints(bpAdd); - - addBreakpointsStub = sinon.stub(vscode.debug, 'addBreakpoints'); - removeBreakpointsStub = sinon.stub(vscode.debug, 'removeBreakpoints'); - await sfToggleCheckpoint(); - - // Add should not have been called - expect(addBreakpointsStub.notCalled).to.be.equal(true); - - // Verify remove was called once and breakpoint argument matches - expect(removeBreakpointsStub.calledOnce).to.be.equal(true); - bpArr = removeBreakpointsStub.getCall(0).args[0]; - expect(bpArr.length).to.be.equal(1); - expect( - breakpointsHaveSameUriAndSourceLine(breakpoint, bpArr[0]) - ).to.be.equal(true); - // The condition in the remove should be undefined - expect((bpArr[0] as vscode.SourceBreakpoint).condition).to.be.equal( - CHECKPOINT - ); - }); -}); - -const breakpointsHaveSameUriAndSourceLine = ( - bp1: vscode.Breakpoint, - bp2: vscode.Breakpoint -): boolean => { - // both breakpoints are source breakpoints - if ( - bp1 instanceof vscode.SourceBreakpoint && - bp2 instanceof vscode.SourceBreakpoint - ) { - // effectively, the breakpoints are equal of the uri and source lines match - if ( - bp1.location.uri.toString() === bp2.location.uri.toString() && - bp2.location.range.start.line === bp2.location.range.start.line - ) { - return true; - } - } - return false; -}; - -const clearExistingBreakpoints = () => { - vscode.debug.removeBreakpoints(vscode.debug.breakpoints); -}; - -// Clean out the checkpoints from the checkpointService (has the added bonus of beating -// on deleteCheckpointNode) -const clearOutCheckpoints = () => { - for (const checkpoint of checkpointService.getChildren()) { - // While every child here is a CheckpointNode, getChildren returns an - // array of BaseNode and if we want to get at the methods on an actual - // CheckpointNode we have to do verify the instance. - if (checkpoint instanceof CheckpointNode) { - checkpointService.deleteCheckpointNodeIfExists( - checkpoint.getBreakpointId() - ); - } - } -}; diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/apexExecutionOverlayActionCommand.test.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/apexExecutionOverlayActionCommand.test.ts deleted file mode 100644 index afd8b0ef85..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/apexExecutionOverlayActionCommand.test.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { FIELD_INTEGRITY_EXCEPTION } from '@salesforce/salesforcedx-apex-replay-debugger/out/src/index'; -import { - CLIENT_ID, - DEFAULT_CONNECTION_TIMEOUT_MS, - RequestService, - RestHttpMethodEnum -} from '@salesforce/salesforcedx-utils'; -import { expect } from 'chai'; -import { XHROptions, XHRResponse } from 'request-light'; -import * as sinon from 'sinon'; -import { - ApexExecutionOverlayActionCommand, - ApexExecutionOverlayFailureResult, - ApexExecutionOverlaySuccessResult -} from '../../../src/commands/apexExecutionOverlayActionCommand'; - -// These tests are going to be calling a mocked RequestService. The checkpointService utilizes the -// ApexExecutionOverlayActionCommand under the covers. The presense or absence of an actionObjectId -// is what determines whether or not the action is a post or delete. -describe('ApexExecutionOverlayAction basic class tests', () => { - let overlayActionCommand: ApexExecutionOverlayActionCommand; - const requestString = - "{'ActionScript':'','ActionScriptType':'None','ExecutableEntityName':'MyFakeClassOrTrigger','IsDumpingHeap':true,'Iteration':1,'Line':25}"; - const actionObjectId = '1doxx000000FAKE'; - - it('Should should create requestUrl without actionId on the API Path ', async () => { - overlayActionCommand = new ApexExecutionOverlayActionCommand(requestString); - expect(overlayActionCommand.getCommandUrl()).to.equal( - 'services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction' - ); - expect(overlayActionCommand.getQueryString()).to.equal(undefined); - expect(overlayActionCommand.getRequest()).to.equal(requestString); - }); - - it('Should should create requestUrl with actionId on the API Path ', async () => { - overlayActionCommand = new ApexExecutionOverlayActionCommand( - requestString, - actionObjectId - ); - expect(overlayActionCommand.getCommandUrl()).to.equal( - 'services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction/' + - actionObjectId - ); - expect(overlayActionCommand.getQueryString()).to.equal(undefined); - expect(overlayActionCommand.getRequest()).to.equal(requestString); - }); -}); - -// This set of ApexExecutionOverlayActionCommand tests are going to be using the RequestService -describe('ApexExecutionOverlayAction command', () => { - let sendRequestSpy: sinon.SinonStub; - let overlayActionCommand: ApexExecutionOverlayActionCommand; - - const actionObjectId = '1doxx000000FAKE'; - const expectedPostUrl = - 'https://www.salesforce.com/services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction'; - const expectedDeleteUrl = - 'https://www.salesforce.com/services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction/' + - actionObjectId; - const requestService = new RequestService(); - const requestString = - '{"ActionScript":"","ActionScriptType":"None","ExecutableEntityName":"MyFakeClassOrTrigger","IsDumpingHeap":true,"Iteration":1,"Line":25}'; - const reseponseFieldIntegrityError = - '[{"message":"Some error message, does not really matter, only the error code matters","errorCode":"FIELD_INTEGRITY_EXCEPTION","fields":[]}]'; - const responseSuccess = - '{"id":"1doxx000000FAKE","success":true,"errors":[],"warnings":[]}'; - - beforeEach(() => { - requestService.instanceUrl = 'https://www.salesforce.com'; - requestService.accessToken = '123'; - }); - - afterEach(() => { - sendRequestSpy.restore(); - }); - - it('ApexExecutionOverlayActionCommand POST REST call with parse-able success result', async () => { - overlayActionCommand = new ApexExecutionOverlayActionCommand(requestString); - sendRequestSpy = sinon - .stub(RequestService.prototype, 'sendRequest') - .returns( - Promise.resolve({ - status: 200, - responseText: responseSuccess - } as XHRResponse) - ); - - // The expected options needs to contain the request body, url and RestHttpMethodEnum.Post - const expectedOptions: XHROptions = createExpectedXHROptions( - requestString, - expectedPostUrl, - RestHttpMethodEnum.Post - ); - - const returnString = await requestService.execute(overlayActionCommand); - - expect(sendRequestSpy.calledOnce).to.equal(true); - expect(sendRequestSpy.getCall(0).args[0]).to.deep.equal(expectedOptions); - - // parse the returnString and verify the ID and success boolean - const response = JSON.parse( - returnString - ) as ApexExecutionOverlaySuccessResult; - expect(response.id).to.equal(actionObjectId); - expect(response.success).to.equal(true); - }); - - it('ApexExecutionOverlayActionCommand POST REST call with parse-able FIELD_INTEGRITY_EXCEPTION result', async () => { - overlayActionCommand = new ApexExecutionOverlayActionCommand(requestString); - sendRequestSpy = sinon - .stub(RequestService.prototype, 'sendRequest') - .returns( - Promise.resolve({ - status: 200, - responseText: reseponseFieldIntegrityError - } as XHRResponse) - ); - // The expected options needs to contain the request body, url and RestHttpMethodEnum.Post - const expectedOptions: XHROptions = createExpectedXHROptions( - requestString, - expectedPostUrl, - RestHttpMethodEnum.Post - ); - - const returnString = await requestService.execute(overlayActionCommand); - - expect(sendRequestSpy.calledOnce).to.equal(true); - expect(sendRequestSpy.getCall(0).args[0]).to.deep.equal(expectedOptions); - - // parse the returnString and verify the ID and success boolean - // note: the return value is an array of ApexExecutionOverlayFailureResult - const result = JSON.parse( - returnString - ) as ApexExecutionOverlayFailureResult[]; - // Verify that the error code can be parses out - expect(result[0].errorCode).to.equal(FIELD_INTEGRITY_EXCEPTION); - }); - - it('ApexExecutionOverlayActionCommand DELETE REST call', async () => { - overlayActionCommand = new ApexExecutionOverlayActionCommand( - requestString, - actionObjectId - ); - sendRequestSpy = sinon - .stub(RequestService.prototype, 'sendRequest') - .returns( - Promise.resolve({ - status: 200, - responseText: '' // Upon a successful delete, nothing is returned - } as XHRResponse) - ); - // The expected options needs to contain the request body, url and RestHttpMethodEnum.Post - const expectedOptions: XHROptions = createExpectedXHROptions( - requestString, - expectedDeleteUrl, - RestHttpMethodEnum.Delete - ); - - await requestService.execute( - overlayActionCommand, - RestHttpMethodEnum.Delete - ); - - expect(sendRequestSpy.calledOnce).to.equal(true); - expect(sendRequestSpy.getCall(0).args[0]).to.deep.equal(expectedOptions); - }); -}); - -// Support function to create an XHROptions object to verify call args against -export const createExpectedXHROptions = ( - requestBody: string | undefined, - requestUrl: string, - restHttpMethodEnum: RestHttpMethodEnum -): XHROptions => { - return { - type: restHttpMethodEnum, - url: requestUrl, - timeout: DEFAULT_CONNECTION_TIMEOUT_MS, - headers: { - 'Content-Type': 'application/json;charset=utf-8', - Accept: 'application/json', - Authorization: 'OAuth 123', - 'Content-Length': requestBody - ? String(Buffer.byteLength(requestBody, 'utf-8')) - : '0', - 'Sforce-Call-Options': `client=${CLIENT_ID}` - }, - data: requestBody - } as XHROptions; -}; diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/batchDeleteExistingOverlayActionsCommand.test.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/batchDeleteExistingOverlayActionsCommand.test.ts deleted file mode 100644 index eb0942a6eb..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/batchDeleteExistingOverlayActionsCommand.test.ts +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - INVALID_CROSS_REFERENCE_KEY, - OVERLAY_ACTION_DELETE_URL -} from '@salesforce/salesforcedx-apex-replay-debugger/out/src/constants'; -import { - RequestService, - RestHttpMethodEnum -} from '@salesforce/salesforcedx-utils'; -import { expect } from 'chai'; -import { XHROptions, XHRResponse } from 'request-light'; -import * as sinon from 'sinon'; -import { - BatchDeleteExistingOverlayActionCommand, - BatchDeleteResponse, - BatchRequest, - BatchRequests -} from '../../../src/commands/batchDeleteExistingOverlayActionsCommand'; -import { createExpectedXHROptions } from './apexExecutionOverlayActionCommand.test'; - -let sendRequestSpy: sinon.SinonStub; -let batchDeleteCommand: BatchDeleteExistingOverlayActionCommand; -const requestService = new RequestService(); -const tempApexExecutionOverlayId = '1doxx00000FAKE'; -const expectedBatchUrl = - 'https://www.salesforce.com/services/data/v43.0/tooling/composite/batch'; -const requestBody = - '{"batchRequests":[{"method":"DELETE","url":"services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000FAKE0"},{"method":"DELETE","url":"services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000FAKE1"},{"method":"DELETE","url":"services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000FAKE2"},{"method":"DELETE","url":"services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000FAKE3"},{"method":"DELETE","url":"services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000FAKE4"}]}'; -const responseNoErrors = - '{"hasErrors": false,"results": [{"statusCode": 204,"result": null},{"statusCode": 204,"result": null},{"statusCode": 204,"result": null},{"statusCode": 204,"result": null},{"statusCode": 204,"result": null}]}'; - -const responseWithErrors = - '{"hasErrors":true,"results":[{"statusCode":204,"result":null},{"statusCode":204,"result":null},{"result":[{"errorCode":"INVALID_CROSS_REFERENCE_KEY","message":"invalid cross reference id"}],"statusCode":404},{"statusCode":204,"result":null},{"statusCode":204,"result":null}]}'; - -beforeEach(() => { - requestService.instanceUrl = 'https://www.salesforce.com'; - requestService.accessToken = '123'; -}); - -afterEach(() => { - sendRequestSpy.restore(); -}); - -it('BatchDeleteExistingOverlayActionCommand POST REST call with non-error result', async () => { - const requests: BatchRequest[] = []; - for (let i = 0; i < 5; i++) { - const request: BatchRequest = { - method: RestHttpMethodEnum.Delete, - url: - 'services/data/v43.0/tooling/sobjects/ApexExecutionOverlayAction/' + - tempApexExecutionOverlayId + - i - }; - requests.push(request); - } - const batchRequests: BatchRequests = { - batchRequests: requests - }; - batchDeleteCommand = new BatchDeleteExistingOverlayActionCommand( - batchRequests - ); - - sendRequestSpy = sinon.stub(RequestService.prototype, 'sendRequest').returns( - Promise.resolve({ - status: 200, - responseText: responseNoErrors - } as XHRResponse) - ); - - // The expected options needs to contain the request body, url and RestHttpMethodEnum.Post - const expectedOptions: XHROptions = createExpectedXHROptions( - requestBody, - expectedBatchUrl, - RestHttpMethodEnum.Post - ); - - const returnString = await requestService.execute( - batchDeleteCommand, - RestHttpMethodEnum.Post - ); - - expect(sendRequestSpy.calledOnce).to.equal(true); - expect(sendRequestSpy.getCall(0).args[0]).to.deep.equal(expectedOptions); - - // Verify the return string - expect(returnString).to.be.equal(responseNoErrors); - - // parse the returnString and verify the number of results is 5 - const response = JSON.parse(returnString) as BatchDeleteResponse; - expect(response.hasErrors).to.equal(false); - expect(response.results.length).to.equal(5); -}); - -it('BatchDeleteExistingOverlayActionCommand POST REST call with error result', async () => { - const requests: BatchRequest[] = []; - for (let i = 0; i < 5; i++) { - const request: BatchRequest = { - method: RestHttpMethodEnum.Delete, - url: OVERLAY_ACTION_DELETE_URL + tempApexExecutionOverlayId + i - }; - requests.push(request); - } - const batchRequests: BatchRequests = { - batchRequests: requests - }; - batchDeleteCommand = new BatchDeleteExistingOverlayActionCommand( - batchRequests - ); - - sendRequestSpy = sinon.stub(RequestService.prototype, 'sendRequest').returns( - Promise.resolve({ - status: 200, - responseText: responseWithErrors - } as XHRResponse) - ); - - // The expected options needs to contain the request body, url and RestHttpMethodEnum.Post - const expectedOptions: XHROptions = createExpectedXHROptions( - requestBody, - expectedBatchUrl, - RestHttpMethodEnum.Post - ); - - const returnString = await requestService.execute( - batchDeleteCommand, - RestHttpMethodEnum.Post - ); - - expect(sendRequestSpy.calledOnce).to.equal(true); - expect(sendRequestSpy.getCall(0).args[0]).to.deep.equal(expectedOptions); - - // Verify the return string - expect(returnString).to.be.equal(responseWithErrors); - - // parse the returnString and verify the number of results is 5 - const response = JSON.parse(returnString) as BatchDeleteResponse; - expect(response.hasErrors).to.equal(true); - expect(response.results.length).to.equal(5); - expect(response.results[2].result![0].errorCode).to.be.equal( - INVALID_CROSS_REFERENCE_KEY - ); -}); diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/queryExistingOverlayActionIdsCommand.test.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/queryExistingOverlayActionIdsCommand.test.ts deleted file mode 100644 index 4814fbda6f..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/queryExistingOverlayActionIdsCommand.test.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - RequestService, - RestHttpMethodEnum -} from '@salesforce/salesforcedx-utils'; -import { expect } from 'chai'; -import { XHROptions, XHRResponse } from 'request-light'; -import * as sinon from 'sinon'; -import { - QueryExistingOverlayActionIdsCommand, - QueryOverlayActionIdsSuccessResult -} from '../../../src/commands/queryExistingOverlayActionIdsCommand'; -import { createExpectedXHROptions } from './apexExecutionOverlayActionCommand.test'; - -describe('QueryExistingOverlayActionIdsCommand command', () => { - let sendRequestSpy: sinon.SinonStub; - let queryOverlayActionCommand: QueryExistingOverlayActionIdsCommand; - const requestService = new RequestService(); - const userId = '005xx000001UcFFAKE'; - const expectedGetUrl = - "https://www.salesforce.com/services/data/v43.0/tooling/query?q=SELECT Id FROM ApexExecutionOverlayAction WHERE ScopeId='" + - userId + - "'"; - const responseSuccessEmpty = - '{"size":0,"totalSize":0,"done":true,"queryLocator":null,"entityTypeName":null,"records":[]}'; - const responseSuccessFiveActions = - '{"size":5,"totalSize":5,"done":true,"queryLocator":null,"entityTypeName":"ApexExecutionOverlayAction","records":[{"attributes":{"type":"ApexExecutionOverlayAction","url":"/services/data/v44.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000000TgAAI"},"Id":"1doxx00000000TgAAI"},{"attributes":{"type":"ApexExecutionOverlayAction","url":"/services/data/v44.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000000TuAAI"},"Id":"1doxx00000000TuAAI"},{"attributes":{"type":"ApexExecutionOverlayAction","url":"/services/data/v44.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000000TlAAI"},"Id":"1doxx00000000TlAAI"},{"attributes":{"type":"ApexExecutionOverlayAction","url":"/services/data/v44.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000000TzAAI"},"Id":"1doxx00000000TzAAI"},{"attributes":{"type":"ApexExecutionOverlayAction","url":"/services/data/v44.0/tooling/sobjects/ApexExecutionOverlayAction/1doxx00000000U0AAI"},"Id":"1doxx00000000U0AAI"}]}'; - - beforeEach(() => { - requestService.instanceUrl = 'https://www.salesforce.com'; - requestService.accessToken = '123'; - }); - - afterEach(() => { - sendRequestSpy.restore(); - }); - - it('QueryExistingOverlayActionIdsCommand GET REST call with parse-able success result, no action objects', async () => { - queryOverlayActionCommand = new QueryExistingOverlayActionIdsCommand( - userId - ); - sendRequestSpy = sinon - .stub(RequestService.prototype, 'sendRequest') - .returns( - Promise.resolve({ - status: 200, - responseText: responseSuccessEmpty - } as XHRResponse) - ); - - // The expected options needs to contain the request body, url and RestHttpMethodEnum.Post - const expectedOptions: XHROptions = createExpectedXHROptions( - undefined, // there is no request body for this command - expectedGetUrl, - RestHttpMethodEnum.Get - ); - - const returnString = await requestService.execute( - queryOverlayActionCommand, - RestHttpMethodEnum.Get - ); - - expect(sendRequestSpy.calledOnce).to.equal(true); - expect(sendRequestSpy.getCall(0).args[0]).to.deep.equal(expectedOptions); - - // parse the returnString and verify the size is 0 and the records list is empty - const response = JSON.parse( - returnString - ) as QueryOverlayActionIdsSuccessResult; - expect(response.size).to.equal(0); - expect(response.records.length).to.equal(0); - }); - it('QueryExistingOverlayActionIdsCommand GET REST call with parse-able success result, 5 action objects', async () => { - queryOverlayActionCommand = new QueryExistingOverlayActionIdsCommand( - userId - ); - sendRequestSpy = sinon - .stub(RequestService.prototype, 'sendRequest') - .returns( - Promise.resolve({ - status: 200, - responseText: responseSuccessFiveActions - } as XHRResponse) - ); - - // The expected options needs to contain the request body, url and RestHttpMethodEnum.Post - const expectedOptions: XHROptions = createExpectedXHROptions( - undefined, // there is no request body for this command - expectedGetUrl, - RestHttpMethodEnum.Get - ); - - const returnString = await requestService.execute( - queryOverlayActionCommand, - RestHttpMethodEnum.Get - ); - - expect(sendRequestSpy.calledOnce).to.equal(true); - expect(sendRequestSpy.getCall(0).args[0]).to.deep.equal(expectedOptions); - - // parse the returnString and verify the size is 5 and there are 5 records in the list - const response = JSON.parse( - returnString - ) as QueryOverlayActionIdsSuccessResult; - expect(response.size).to.equal(5); - expect(response.records.length).to.equal(5); - }); -}); diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/quickLaunch.test.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/quickLaunch.test.ts deleted file mode 100644 index 8a04b79310..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/commands/quickLaunch.test.ts +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { LogService, TestService } from '@salesforce/apex-node'; -import { - TestLevel, - TestResult -} from '@salesforce/apex-node/lib/src/tests/types'; -import { AuthInfo, ConfigAggregator, Connection } from '@salesforce/core'; -import { MockTestOrgData, TestContext } from '@salesforce/core/lib/testSetup'; -import { - ContinueResponse, - notificationService, - projectPaths, - SFDX_CORE_CONFIGURATION_NAME, - TraceFlags -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as path from 'path'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { CheckpointService } from '../../../src/breakpoints/checkpointService'; -import * as launcher from '../../../src/commands/launchFromLogFile'; -import { TestDebuggerExecutor } from '../../../src/commands/quickLaunch'; -import { workspaceContext } from '../../../src/context'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Quick launch apex tests', () => { - const $$ = new TestContext(); - const testData = new MockTestOrgData(); - let testDebuggerExec: TestDebuggerExecutor; - const APEX_LOG_ID = 'abcd'; - const LOG_DIR = 'logs'; - const sb = createSandbox(); - - let mockConnection: Connection; - let notificationServiceStub: SinonStub; - let traceFlagsStub: SinonStub; - let testServiceStub: SinonStub; - let logServiceStub: SinonStub; - let launcherStub: SinonStub; - let buildPayloadStub: SinonStub; - let createCheckpointStub: SinonStub; - let writeResultFilesStub: SinonStub; - let settingStub: SinonStub; - let oneOrMoreActiveCheckpointsStub: SinonStub; - - beforeEach(async () => { - settingStub = sb.stub(); - sb.stub(vscode.workspace, 'getConfiguration') - .withArgs(SFDX_CORE_CONFIGURATION_NAME) - .returns({ - get: settingStub - }); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await Connection.create({ - authInfo: await AuthInfo.create({ - username: testData.username - }) - }); - sb.stub(ConfigAggregator.prototype, 'getPropertyValue') - .withArgs('target-org') - .returns(testData.username); - notificationServiceStub = sb.stub(notificationService, 'showErrorMessage'); - sb.stub(workspaceContext, 'getConnection').returns(mockConnection); - testServiceStub = sb - .stub(TestService.prototype, 'runTestSynchronous') - .resolves({ tests: [{ apexLogId: APEX_LOG_ID }] }); - buildPayloadStub = sb.stub(TestService.prototype, 'buildSyncPayload'); - writeResultFilesStub = sb.stub(TestService.prototype, 'writeResultFiles'); - createCheckpointStub = sb.stub(CheckpointService, 'sfCreateCheckpoints'); - oneOrMoreActiveCheckpointsStub = sb.stub( - CheckpointService.prototype, - 'hasOneOrMoreActiveCheckpoints' - ); - testDebuggerExec = new TestDebuggerExecutor(); - }); - - afterEach(() => { - sb.restore(); - }); - - it('should debug an entire test class', async () => { - oneOrMoreActiveCheckpointsStub.returns(true); - createCheckpointStub.resolves(true); - settingStub.withArgs('retrieve-test-code-coverage').returns(true); - buildPayloadStub.resolves({ - tests: [{ className: 'MyClass' }], - testLevel: 'RunSpecifiedTests' - }); - traceFlagsStub = sb - .stub(TraceFlags.prototype, 'ensureTraceFlags') - .returns(true); - sb.stub(projectPaths, 'debugLogsFolder').returns(LOG_DIR); - logServiceStub = sb.stub(LogService.prototype, 'getLogs').resolves([]); - launcherStub = sb.stub(launcher, 'launchFromLogFile'); - - const response: ContinueResponse = { - type: 'CONTINUE', - data: ['MyClass'] - }; - - await testDebuggerExec.execute(response); - - expect(traceFlagsStub.called).to.equal(true); - expect(createCheckpointStub.called).to.equal(true); - expect(testServiceStub.called).to.equal(true); - const { args } = testServiceStub.getCall(0); - expect(args[0]).to.eql({ - tests: [ - { - className: 'MyClass' - } - ], - testLevel: 'RunSpecifiedTests' - }); - - expect(logServiceStub.called).to.equal(true); - const logArgs = logServiceStub.getCall(0).args; - expect(logArgs[0]).to.eql({ - logId: APEX_LOG_ID, - outputDir: LOG_DIR - }); - - expect(launcherStub.called).to.equal(true); - const launcherArgs = launcherStub.getCall(0).args; - expect(launcherArgs[0]).to.equal(path.join('logs', 'abcd.log')); - expect(launcherArgs[1]).to.equal(false); - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - TestLevel.RunSpecifiedTests, - undefined, - 'MyClass' - ]); - expect(writeResultFilesStub.called).to.equal(true); - const writeResultFilesArgs = writeResultFilesStub.getCall(0).args; - expect(writeResultFilesArgs[0]).to.eql({ - tests: [ - { - apexLogId: APEX_LOG_ID - } - ] - }); - expect(writeResultFilesArgs[2]).to.equal(true); - }); - - it('should not upload checkpoints if there are no enabled checkpoints', async () => { - oneOrMoreActiveCheckpointsStub.returns(false); - createCheckpointStub.resolves(true); - settingStub.withArgs('retrieve-test-code-coverage').returns(true); - buildPayloadStub.resolves({ - tests: [{ className: 'MyClass' }], - testLevel: 'RunSpecifiedTests' - }); - traceFlagsStub = sb - .stub(TraceFlags.prototype, 'ensureTraceFlags') - .returns(true); - sb.stub(projectPaths, 'debugLogsFolder').returns(LOG_DIR); - logServiceStub = sb.stub(LogService.prototype, 'getLogs').resolves([]); - launcherStub = sb.stub(launcher, 'launchFromLogFile'); - - const response: ContinueResponse = { - type: 'CONTINUE', - data: ['MyClass'] - }; - - await testDebuggerExec.execute(response); - - expect(traceFlagsStub.called).to.equal(true); - expect(createCheckpointStub.called).to.equal(false); - expect(testServiceStub.called).to.equal(true); - const { args } = testServiceStub.getCall(0); - expect(args[0]).to.eql({ - tests: [ - { - className: 'MyClass' - } - ], - testLevel: 'RunSpecifiedTests' - }); - - expect(logServiceStub.called).to.equal(true); - const logArgs = logServiceStub.getCall(0).args; - expect(logArgs[0]).to.eql({ - logId: APEX_LOG_ID, - outputDir: LOG_DIR - }); - - expect(launcherStub.called).to.equal(true); - const launcherArgs = launcherStub.getCall(0).args; - expect(launcherArgs[0]).to.equal(path.join('logs', 'abcd.log')); - expect(launcherArgs[1]).to.equal(false); - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - TestLevel.RunSpecifiedTests, - undefined, - 'MyClass' - ]); - expect(writeResultFilesStub.called).to.equal(true); - const writeResultFilesArgs = writeResultFilesStub.getCall(0).args; - expect(writeResultFilesArgs[0]).to.eql({ - tests: [ - { - apexLogId: APEX_LOG_ID - } - ] - }); - expect(writeResultFilesArgs[2]).to.equal(true); - }); - - it('should immediately return if checkpoints uploading fails', async () => { - oneOrMoreActiveCheckpointsStub.returns(true); - createCheckpointStub.resolves(false); - settingStub.withArgs('retrieve-test-code-coverage').returns(true); - buildPayloadStub.resolves({ - tests: [{ className: 'MyClass' }], - testLevel: 'RunSpecifiedTests' - }); - traceFlagsStub = sb - .stub(TraceFlags.prototype, 'ensureTraceFlags') - .returns(true); - sb.stub(projectPaths, 'debugLogsFolder').returns(LOG_DIR); - logServiceStub = sb.stub(LogService.prototype, 'getLogs').resolves([]); - launcherStub = sb.stub(launcher, 'launchFromLogFile'); - - const response: ContinueResponse = { - type: 'CONTINUE', - data: ['MyClass'] - }; - await testDebuggerExec.execute(response); - - expect(traceFlagsStub.called).to.equal(true); - expect(createCheckpointStub.called).to.equal(true); - expect(testServiceStub.called).to.equal(false); - expect(logServiceStub.called).to.equal(false); - expect(launcherStub.called).to.equal(false); - expect(buildPayloadStub.called).to.equal(false); - expect(writeResultFilesStub.called).to.equal(false); - }); - - it('should debug a single test method', async () => { - oneOrMoreActiveCheckpointsStub.returns(true); - createCheckpointStub.resolves(true); - settingStub.withArgs('retrieve-test-code-coverage').returns(true); - buildPayloadStub.resolves({ - tests: [{ className: 'MyClass', testMethods: ['testSomeCode'] }], - testLevel: 'RunSpecifiedTests' - }); - traceFlagsStub = sb - .stub(TraceFlags.prototype, 'ensureTraceFlags') - .returns(true); - sb.stub(projectPaths, 'debugLogsFolder').returns(LOG_DIR); - logServiceStub = sb.stub(LogService.prototype, 'getLogs').resolves([]); - launcherStub = sb.stub(launcher, 'launchFromLogFile'); - - const response: ContinueResponse = { - type: 'CONTINUE', - data: ['MyClass', 'testSomeCode'] - }; - - await testDebuggerExec.execute(response); - - expect(traceFlagsStub.called).to.equal(true); - expect(oneOrMoreActiveCheckpointsStub.called).to.equal(true); - expect(createCheckpointStub.called).to.equal(true); - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - TestLevel.RunSpecifiedTests, - 'MyClass.testSomeCode', - 'MyClass' - ]); - expect(testServiceStub.called).to.equal(true); - const { args } = testServiceStub.getCall(0); - expect(args[0]).to.eql({ - tests: [ - { - className: 'MyClass', - testMethods: ['testSomeCode'] - } - ], - testLevel: 'RunSpecifiedTests' - }); - - expect(logServiceStub.called).to.equal(true); - const logArgs = logServiceStub.getCall(0).args; - expect(logArgs[0]).to.eql({ - logId: APEX_LOG_ID, - outputDir: LOG_DIR - }); - - expect(launcherStub.called).to.equal(true); - const launcherArgs = launcherStub.getCall(0).args; - expect(launcherArgs[0]).to.equal(path.join('logs', 'abcd.log')); - expect(launcherArgs[1]).to.equal(false); - expect(writeResultFilesStub.called).to.equal(true); - const writeResultFilesArgs = writeResultFilesStub.getCall(0).args; - expect(writeResultFilesArgs[0]).to.eql({ - tests: [ - { - apexLogId: APEX_LOG_ID - } - ] - }); - expect(writeResultFilesArgs[2]).to.equal(true); - }); - - it('should debug a single test method that fails', async () => { - oneOrMoreActiveCheckpointsStub.returns(true); - createCheckpointStub.resolves(true); - settingStub.withArgs('retrieve-test-code-coverage').returns(true); - buildPayloadStub.resolves({ - tests: [{ className: 'MyClass', testMethods: ['testSomeCode'] }], - testLevel: 'RunSpecifiedTests' - }); - traceFlagsStub = sb - .stub(TraceFlags.prototype, 'ensureTraceFlags') - .returns(true); - testServiceStub.resolves({} as TestResult); - sb.stub(projectPaths, 'debugLogsFolder').returns(LOG_DIR); - logServiceStub = sb.stub(LogService.prototype, 'getLogs').resolves([]); - launcherStub = sb.stub(launcher, 'launchFromLogFile'); - - const response: ContinueResponse = { - type: 'CONTINUE', - data: ['MyClass', 'testSomeCode'] - }; - - await testDebuggerExec.execute(response); - - expect(traceFlagsStub.called).to.equal(true); - expect(oneOrMoreActiveCheckpointsStub.called).to.equal(true); - expect(createCheckpointStub.called).to.equal(true); - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - TestLevel.RunSpecifiedTests, - 'MyClass.testSomeCode', - 'MyClass' - ]); - expect(testServiceStub.called).to.equal(true); - const { args } = testServiceStub.getCall(0); - expect(args[0]).to.eql({ - tests: [ - { - className: 'MyClass', - testMethods: ['testSomeCode'] - } - ], - testLevel: 'RunSpecifiedTests' - }); - - expect(logServiceStub.called).to.equal(false); - expect(launcherStub.called).to.equal(false); - - expect(notificationServiceStub.called).to.equal(true); - const notificationArgs = notificationServiceStub.getCall(0).args; - // Seems that there are two different error msgs: - // On Windows: "Cannot read property 'length' of undefined" - // On Mac: "Cannot read properties of undefined (reading 'length')" - expect(notificationArgs[0].startsWith('Cannot read propert')).to.equal( - true - ); - expect(notificationArgs[0]).to.contain('undefined'); - expect(notificationArgs[0]).to.contain('length'); - expect(writeResultFilesStub.called).to.equal(true); - const writeResultFilesArgs = writeResultFilesStub.getCall(0).args; - expect(writeResultFilesArgs[0]).to.eql({}); - expect(writeResultFilesArgs[2]).to.equal(true); - }); - - it('should display an error for a missing test', async () => { - oneOrMoreActiveCheckpointsStub.returns(true); - createCheckpointStub.resolves(true); - settingStub.withArgs('retrieve-test-code-coverage').returns(true); - buildPayloadStub.resolves({ - tests: [{ className: 'MyClass', testMethods: ['testSomeCode'] }], - testLevel: 'RunSpecifiedTests' - }); - traceFlagsStub = sb - .stub(TraceFlags.prototype, 'ensureTraceFlags') - .returns(true); - testServiceStub.resolves({ tests: [] }); - - const response: ContinueResponse = { - type: 'CONTINUE', - data: ['MyClass', 'testSomeCode'] - }; - - await testDebuggerExec.execute(response); - - expect(traceFlagsStub.called).to.equal(true); - expect(oneOrMoreActiveCheckpointsStub.called).to.equal(true); - expect(createCheckpointStub.called).to.equal(true); - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - TestLevel.RunSpecifiedTests, - 'MyClass.testSomeCode', - 'MyClass' - ]); - expect(testServiceStub.called).to.equal(true); - const { args } = testServiceStub.getCall(0); - expect(args[0]).to.eql({ - tests: [ - { - className: 'MyClass', - testMethods: ['testSomeCode'] - } - ], - testLevel: 'RunSpecifiedTests' - }); - - expect(notificationServiceStub.called).to.equal(true); - const notificationArgs = notificationServiceStub.getCall(0).args; - expect(notificationArgs[0]).to.equal( - nls.localize('debug_test_no_results_found') - ); - expect(writeResultFilesStub.called).to.equal(true); - const writeResultFilesArgs = writeResultFilesStub.getCall(0).args; - expect(writeResultFilesArgs[0]).to.eql({ - tests: [] - }); - expect(writeResultFilesArgs[2]).to.equal(true); - }); - - it('should display an error for a missing log file', async () => { - oneOrMoreActiveCheckpointsStub.returns(true); - createCheckpointStub.resolves(true); - settingStub.withArgs('retrieve-test-code-coverage').returns(true); - buildPayloadStub.resolves({ - tests: [{ className: 'MyClass', testMethods: ['testSomeCode'] }], - testLevel: 'RunSpecifiedTests' - }); - traceFlagsStub = sb - .stub(TraceFlags.prototype, 'ensureTraceFlags') - .returns(true); - testServiceStub.resolves({ tests: [{}] }); - - const response: ContinueResponse = { - type: 'CONTINUE', - data: ['MyClass', 'testSomeCode'] - }; - - await testDebuggerExec.execute(response); - - expect(traceFlagsStub.called).to.equal(true); - expect(oneOrMoreActiveCheckpointsStub.called).to.equal(true); - expect(createCheckpointStub.called).to.equal(true); - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - TestLevel.RunSpecifiedTests, - 'MyClass.testSomeCode', - 'MyClass' - ]); - expect(testServiceStub.called).to.equal(true); - const { args } = testServiceStub.getCall(0); - expect(args[0]).to.eql({ - tests: [ - { - className: 'MyClass', - testMethods: ['testSomeCode'] - } - ], - testLevel: 'RunSpecifiedTests' - }); - - expect(notificationServiceStub.called).to.equal(true); - const notificationArgs = notificationServiceStub.getCall(0).args; - expect(notificationArgs[0]).to.equal( - nls.localize('debug_test_no_debug_log') - ); - expect(writeResultFilesStub.called).to.equal(true); - const writeResultFilesArgs = writeResultFilesStub.getCall(0).args; - expect(writeResultFilesArgs[0]).to.eql({ - tests: [{}] - }); - expect(writeResultFilesArgs[2]).to.equal(true); - }); -}); diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/index.test.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/index.test.ts deleted file mode 100644 index 36909b62ee..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/index.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - DEBUGGER_TYPE, - LIVESHARE_DEBUGGER_TYPE -} from '@salesforce/salesforcedx-apex-replay-debugger/out/src/constants'; -import { expect } from 'chai'; -import * as vscode from 'vscode'; -import { getDebuggerType } from '../../src/index'; - -describe('Extension Setup', () => { - describe('Custom request', () => { - it('Should extract underlying debugger type', async () => { - const session = { - type: LIVESHARE_DEBUGGER_TYPE, - customRequest: async (command: string) => { - return Promise.resolve(DEBUGGER_TYPE); - } - }; - - const realType = await getDebuggerType( - (session as any) as vscode.DebugSession - ); - - expect(realType).to.be.equal(DEBUGGER_TYPE); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/index.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/index.ts deleted file mode 100644 index d775e6411b..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/index.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// -// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING -// -// This file is providing the test runner to use when running extension tests. -// By default the test runner in use is Mocha based. -// -// You can provide your own test runner if you want to override it by exporting -// a function run(testRoot: string, clb: (error:Error) => void) that the extension -// host can call to run the tests. The test runner is expected to use console.log -// to report the results back to the caller. When the tests are finished, return -// a possible error to the callback or null if none. - -import { join, normalize } from 'path'; - -// eslint-disable-next-line @typescript-eslint/no-var-requires -const testRunner = require('@salesforce/salesforcedx-test-utils-vscode/out/src/testrunner'); - -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure( - { - ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results - timeout: 20000, - fullTrace: true - }, - normalize(join(__dirname, '..', '..', '..')) -); - -module.exports = testRunner; diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/telemetry/telemetry.test.ts b/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/telemetry/telemetry.test.ts deleted file mode 100644 index a0bb0015fe..0000000000 --- a/packages/salesforcedx-vscode-apex-replay-debugger/test/vscode-integration/telemetry/telemetry.test.ts +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { assert, match, SinonStub, stub } from 'sinon'; -import TelemetryReporter from 'vscode-extension-telemetry'; -import { TelemetryService } from '../../../src/telemetry/telemetry'; - -describe('Telemetry', () => { - let reporter: TelemetryReporter; - let sendEvent: SinonStub; - - beforeEach(() => { - reporter = new TelemetryReporter('salesforcedx-vscode', 'v1', 'test567890'); - sendEvent = stub(reporter, 'sendTelemetryEvent'); - }); - - afterEach(async () => { - sendEvent.restore(); - await reporter.dispose(); - }); - - it('Should send telemetry data', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendExtensionActivationEvent([0, 330]); - assert.calledOnce(sendEvent); - }); - - it('Should not send telemetry data', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], false); - - telemetryService.sendLaunchEvent('test', 'test2'); - assert.notCalled(sendEvent); - }); - - it('Should send correct data format on sendExtensionActivationEvent', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendExtensionActivationEvent([0, 330]); - assert.calledOnce(sendEvent); - - const expectedProps = { - extensionName: 'salesforcedx-vscode-apex-replay-debugger' - }; - - const expectedMeasures = { - startupTime: match.number - }; - assert.calledWith( - sendEvent, - 'activationEvent', - expectedProps, - match(expectedMeasures) - ); - }); - - it('Should send correct data format on sendExtensionDeactivationEvent', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendExtensionDeactivationEvent(); - assert.calledOnce(sendEvent); - - const expectedData = { - extensionName: 'salesforcedx-vscode-apex-replay-debugger' - }; - assert.calledWith(sendEvent, 'deactivationEvent', expectedData); - }); - - it('Should send launch event', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendLaunchEvent('123', 'error message'); - - const expectedData = { - extensionName: 'salesforcedx-vscode-apex-replay-debugger', - logSize: '123', - errorMessage: 'error message' - }; - assert.calledWith(sendEvent, 'launchDebuggerSession', expectedData); - }); - - it('Should send checkpoint event', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendCheckpointEvent('error message'); - - const expectedData = { - extensionName: 'salesforcedx-vscode-apex-replay-debugger', - errorMessage: 'error message' - }; - assert.calledWith(sendEvent, 'updateCheckpoints', expectedData); - }); - - it('Should send error event', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendErrorEvent('error message', 'error callstack'); - - const expectedData = { - extensionName: 'salesforcedx-vscode-apex-replay-debugger', - errorMessage: 'error message', - errorStack: 'error callstack' - }; - assert.calledWith(sendEvent, 'error', expectedData); - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/apexLspJarContents.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/apexLspJarContents.test.ts deleted file mode 100644 index ec5c560ec9..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/apexLspJarContents.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// tslint:disable:no-unused-expression - -import { expect } from 'chai'; -import * as path from 'path'; -import * as shell from 'shelljs'; - -describe('Apex LSP Jar Contents', () => { - - it('should not contain perm-guarded apex classes', () => { - shell.config.execPath = process.execPath; - const apexJarPath = path.join(__dirname, '..', '..', 'apex-jorje-lsp.jar'); - const stdout = shell.exec(`jar tvf ${apexJarPath}`).stdout; - - expect(stdout.includes('AuraException.cls')).to.be.false; - expect(stdout.includes('AuraHandledException.cls')).to.be.false; - expect(stdout.includes('Blacktab.cls')).to.be.false; - expect(stdout.includes('InstallContext.cls')).to.be.false; - expect(stdout.includes('InstallHandler.cls')).to.be.false; - expect(stdout.includes('UninstallContext.cls')).to.be.false; - expect(stdout.includes('UninstallHandler.cls')).to.be.false; - expect(stdout.includes('BusOp.cls')).to.be.false; - expect(stdout.includes('AppExchange.cls')).to.be.false; - expect(stdout.includes('ApplicationReadWriteMode.cls')).to.be.false; - expect(stdout.includes('CollectSimilarCasesData.cls')).to.be.false; - expect(stdout.includes('FfxPortalData.cls')).to.be.false; - expect(stdout.includes('ProductSecurity.cls')).to.be.false; - expect(stdout.includes('LegalOrgOps.cls')).to.be.false; - expect(stdout.includes('Org62Ops.cls')).to.be.false; - expect(stdout.includes('OrgCSOps.cls')).to.be.false; - expect(stdout.includes('GusOps.cls')).to.be.false; - expect(stdout.includes('BlackTabFramework.cls')).to.be.false; - expect(stdout.includes('SfdcOps.cls')).to.be.false; - expect(stdout.includes('Org62LEXFeedbackController.cls')).to.be.false; - expect(stdout.includes('TrailblazerIdentityAdditionalInfo.cls')).to.be.false; - expect(stdout.includes('TrailblazerIdentityInfo.cls')).to.be.false; - expect(stdout.includes('TrailblazerIdentityInfoWrapper.cls')).to.be.false; - expect(stdout.includes('TrailblazerIdentityArrayLengthMismatchException.cls')).to.be.false; - expect(stdout.includes('ChatterGroupSummaryPage.cls')).to.be.false; - expect(stdout.includes('FeedItemInputAttachmentType.cls')).to.be.false; - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/codecoverage/colorizer.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/codecoverage/colorizer.test.ts deleted file mode 100644 index 0c5854083a..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/codecoverage/colorizer.test.ts +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { Range, RelativePattern, Uri, window, workspace } from 'vscode'; -import { - CodeCoverageHandler, - getLineRange -} from '../../../src/codecoverage/colorizer'; -import { StatusBarToggle } from '../../../src/codecoverage/statusBarToggle'; - -describe('Code coverage colorizer', () => { - let testCoverage: Uri[]; - - beforeEach(async () => { - testCoverage = await workspace.findFiles( - new RelativePattern( - workspace.workspaceFolders![0], - '**/DemoController.cls' - ), - new RelativePattern( - workspace.workspaceFolders![0], - '**/DemoControllerTest.cls' - ) - ); - }); - - it('Should report correct status on statusbaritem', async () => { - const statusBarToggle = new StatusBarToggle(); - const colorizer = new CodeCoverageHandler(statusBarToggle); - - expect(statusBarToggle.isHighlightingEnabled).to.equal(false); - colorizer.toggleCoverage(); - expect(statusBarToggle.isHighlightingEnabled).to.equal(true); - colorizer.toggleCoverage(); - expect(statusBarToggle.isHighlightingEnabled).to.equal(false); - }); - - it('Should report correct covered and uncovered lines for apex with code coverage', async () => { - const apexDocument = await workspace.openTextDocument(testCoverage[0]); - await window.showTextDocument(apexDocument); - - const statusBarToggle = new StatusBarToggle(); - const colorizer = new CodeCoverageHandler(statusBarToggle); - - expect(statusBarToggle.isHighlightingEnabled).to.equal(false); - expect(colorizer.coveredLines).to.be.empty; - expect(colorizer.uncoveredLines).to.be.empty; - - colorizer.toggleCoverage(); - expect(colorizer.coveredLines.length).to.equal(6); - expect(colorizer.uncoveredLines.length).to.equal(1); - const uncovered = Array(); - uncovered.push(getLineRange(apexDocument, 5)); - expect(uncovered).to.deep.equal(colorizer.uncoveredLines); - const covered = Array(); - covered.push(getLineRange(apexDocument, 10)); - covered.push(getLineRange(apexDocument, 12)); - covered.push(getLineRange(apexDocument, 14)); - covered.push(getLineRange(apexDocument, 16)); - covered.push(getLineRange(apexDocument, 19)); - covered.push(getLineRange(apexDocument, 27)); - expect(covered).to.deep.equal(colorizer.coveredLines); - expect(statusBarToggle.isHighlightingEnabled).to.equal(true); - - colorizer.toggleCoverage(); - expect(statusBarToggle.isHighlightingEnabled).to.equal(false); - // tslint:disable-next-line:no-unused-expression - expect(colorizer.coveredLines).to.be.empty; - // tslint:disable-next-line:no-unused-expression - expect(colorizer.uncoveredLines).to.be.empty; - }); - - it('Should report no lines for apex with out code coverage', async () => { - const apexTestDoc = await workspace.openTextDocument(testCoverage[1]); - await window.showTextDocument(apexTestDoc); - - const statusBarToggle = new StatusBarToggle(); - const colorizer = new CodeCoverageHandler(statusBarToggle); - - expect(statusBarToggle.isHighlightingEnabled).to.equal(false); - // tslint:disable-next-line:no-unused-expression - expect(colorizer.coveredLines).to.be.empty; - // tslint:disable-next-line:no-unused-expression - expect(colorizer.uncoveredLines).to.be.empty; - - colorizer.toggleCoverage(); - expect(colorizer.coveredLines.length).to.equal(0); - expect(colorizer.uncoveredLines.length).to.equal(0); - - colorizer.toggleCoverage(); - expect(statusBarToggle.isHighlightingEnabled).to.equal(false); - // tslint:disable-next-line:no-unused-expression - expect(colorizer.coveredLines).to.be.empty; - // tslint:disable-next-line:no-unused-expression - expect(colorizer.uncoveredLines).to.be.empty; - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexExecute.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexExecute.test.ts deleted file mode 100644 index c5f59d081e..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexExecute.test.ts +++ /dev/null @@ -1,575 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { ExecuteService } from '@salesforce/apex-node'; -import { AuthInfo, ConfigAggregator, Connection } from '@salesforce/core'; -import { MockTestOrgData, TestContext } from '@salesforce/core/lib/testSetup'; -import { - ChannelService, - ContinueResponse, - projectPaths, - SFDX_CORE_CONFIGURATION_NAME, - TraceFlags -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import { createSandbox, SinonSandbox, SinonSpy, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { channelService } from '../../../src/channels'; -import { - AnonApexGatherer, - AnonApexLibraryExecuteExecutor -} from '../../../src/commands/anonApexExecute'; -import { workspaceContext } from '../../../src/context'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Apex Execute', () => { - const $$ = new TestContext(); - const testData = new MockTestOrgData(); - let mockConnection: Connection; - let sb: SinonSandbox; - let traceFlagsStub: SinonStub; - let settingStub: SinonStub; - let writeFileStub: SinonStub; - let executeCommandStub: SinonStub; - - beforeEach(async () => { - sb = createSandbox(); - settingStub = sb.stub(); - sb.stub(vscode.workspace, 'getConfiguration') - .withArgs(SFDX_CORE_CONFIGURATION_NAME) - .returns({ - get: settingStub - }); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await Connection.create({ - authInfo: await AuthInfo.create({ - username: testData.username - }) - }); - sb.stub(ConfigAggregator.prototype, 'getPropertyValue') - .withArgs('target-org') - .returns(testData.username); - sb.stub(workspaceContext, 'getConnection').returns(mockConnection); - - traceFlagsStub = sb - .stub(TraceFlags.prototype, 'ensureTraceFlags') - .returns(true); - - sb.stub(vscode.window, 'activeTextEditor').get(() => ({ - document: { - uri: vscode.Uri.file('/test') - } - })); - - writeFileStub = sb.stub(fs, 'writeFileSync').returns(true); - - executeCommandStub = sb - .stub(vscode.commands, 'executeCommand') - .withArgs('sf.launch.replay.debugger.logfile.path') - .returns(true); - }); - - afterEach(() => { - sb.restore(); - }); - - describe('AnonApexGatherer', async () => { - it('should return the selected file to execute anonymous apex', async () => { - const fileName = path.join( - projectPaths.stateFolder(), - 'tools', - 'tempApex.input' - ); - const mockActiveTextEditor = { - document: { - uri: { fsPath: fileName }, - isUntitled: false - }, - selection: { isEmpty: true } - }; - - sb.stub(vscode.window, 'activeTextEditor').get(() => { - return mockActiveTextEditor; - }); - - const fileNameGatherer = new AnonApexGatherer(); - const result = (await fileNameGatherer.gather()) as ContinueResponse<{ - fileName: string; - }>; - expect(result.data.fileName).to.equal(fileName); - }); - - it('should return the text in file if file has not been created yet', async () => { - const text = 'System.assert(true);'; - const fileName = path.join( - projectPaths.stateFolder(), - 'tools', - 'tempApex.input' - ); - const mockActiveTextEditor = { - document: { - uri: { fsPath: fileName }, - getText: () => text, - isUntitled: true, - isDirty: true - }, - selection: { - isEmpty: true, - text: 'System.assert(false);' - } - }; - sb.stub(vscode.window, 'activeTextEditor').get(() => { - return mockActiveTextEditor; - }); - - const fileNameGatherer = new AnonApexGatherer(); - const result = (await fileNameGatherer.gather()) as ContinueResponse<{ - apexCode: string; - }>; - expect(result.data.apexCode).to.equal(text); - }); - - it("should return the currently highlighted 'selection' to execute anonymous apex", async () => { - const mockActiveTextEditor = { - document: { - getText: (doc: { isEmpty: boolean; text: string }) => doc.text, - isUntitled: true, - isDirty: false - }, - selection: { - isEmpty: false, - text: 'System.assert(true);', - start: new vscode.Position(1, 1), - end: new vscode.Position(1, 19) - } - }; - sb.stub(vscode.window, 'activeTextEditor').get(() => { - return mockActiveTextEditor; - }); - - const apexCodeGatherer = new AnonApexGatherer(); - const result = (await apexCodeGatherer.gather()) as ContinueResponse<{ - apexCode: string; - }>; - expect(result.data.apexCode).to.equal('System.assert(true);'); - }); - }); - - describe('Format Execute Anonymous Response', () => { - let outputStub: SinonStub; - let showChannelOutputStub: SinonSpy; - let setDiagnosticStub: SinonStub; - let debugLogsfolder: SinonStub; - const file = '/test'; - - beforeEach(() => { - outputStub = sb.stub(channelService, 'appendLine'); - showChannelOutputStub = sb.spy( - ChannelService.prototype, - 'showChannelOutput' - ); - setDiagnosticStub = sb.stub( - AnonApexLibraryExecuteExecutor.diagnostics, - 'set' - ); - debugLogsfolder = sb - .stub(projectPaths, 'debugLogsFolder') - .returns('.sfdx/tools/debug/logs'); - }); - - it('should format result correctly for a successful execution', async () => { - const executor = new AnonApexLibraryExecuteExecutor(true); - const execAnonResponse = { - compiled: true, - success: true, - logs: '47.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO\nExecute Anonymous: System.assert(true);|EXECUTION_FINISHED\n', - diagnostic: [ - { - lineNumber: -1, - columnNumber: -1, - compileProblem: '', - exceptionMessage: '', - exceptionStackTrace: '' - } - ] - }; - const expectedOutput = `${nls.localize( - 'apex_execute_compile_success' - )}\n${nls.localize('apex_execute_runtime_success')}\n\n${ - execAnonResponse.logs - }`; - sb.stub(ExecuteService.prototype, 'executeAnonymous').resolves( - execAnonResponse - ); - - await executor.run({ type: 'CONTINUE', data: {} }); - expect(showChannelOutputStub.notCalled).to.be.true; - expect(outputStub.firstCall.args[0]).to.equal(expectedOutput); - }); - - it('should format result correctly for a compilation failure', async () => { - const executor = new AnonApexLibraryExecuteExecutor(true); - const execAnonResponse = { - compiled: false, - success: false, - logs: '', - diagnostic: [ - { - columnNumber: 1, - lineNumber: 6, - compileProblem: "Unexpected token '('.", - exceptionMessage: '', - exceptionStackTrace: '' - } - ] - }; - const expectedOutput = `Error: Line: ${execAnonResponse.diagnostic[0].lineNumber}, Column: ${execAnonResponse.diagnostic[0].columnNumber}\nError: ${execAnonResponse.diagnostic[0].compileProblem}\n`; - sb.stub(ExecuteService.prototype, 'executeAnonymous').resolves( - execAnonResponse - ); - - await executor.run({ type: 'CONTINUE', data: {} }); - expect(showChannelOutputStub.notCalled).to.be.true; - expect(outputStub.firstCall.args[0]).to.equal(expectedOutput); - }); - - it('should format result correctly for a runtime failure', async () => { - const executor = new AnonApexLibraryExecuteExecutor(true); - const execAnonResponse = { - compiled: true, - success: false, - logs: '47.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO\nExecute Anonymous: System.assert(false);|EXECUTION_FINISHED\n', - diagnostic: [ - { - columnNumber: 1, - lineNumber: 6, - compileProblem: '', - exceptionMessage: 'System.AssertException: Assertion Failed', - exceptionStackTrace: 'AnonymousBlock: line 1, column 1' - } - ] - }; - const { exceptionMessage, exceptionStackTrace } = - execAnonResponse.diagnostic[0]; - const expectedOutput = `${nls.localize( - 'apex_execute_compile_success' - )}\nError: ${exceptionMessage}\nError: ${exceptionStackTrace}\n\n${ - execAnonResponse.logs - }`; - sb.stub(ExecuteService.prototype, 'executeAnonymous').resolves( - execAnonResponse - ); - - await executor.run({ type: 'CONTINUE', data: {} }); - expect(showChannelOutputStub.notCalled).to.be.true; - expect(outputStub.firstCall.args[0]).to.equal(expectedOutput); - }); - - it('should translate result line position correctly for a selected text failure', async () => { - const executor = new AnonApexLibraryExecuteExecutor(true); - const execAnonResponse = { - compiled: true, - success: false, - logs: '47.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO\nExecute Anonymous: System.assert(false);|EXECUTION_FINISHED\n', - diagnostic: [ - { - columnNumber: 1, - lineNumber: 1, - compileProblem: '', - exceptionMessage: 'System.AssertException: Assertion Failed', - exceptionStackTrace: 'AnonymousBlock: line 1, column 1' - } - ] - }; - sb.stub(ExecuteService.prototype, 'executeAnonymous').resolves( - execAnonResponse - ); - - const expectedDiagnostic = { - message: execAnonResponse.diagnostic[0].exceptionMessage, - severity: vscode.DiagnosticSeverity.Error, - source: file, - range: new vscode.Range(3, 0, 3, 0) - }; - - await executor.run({ - type: 'CONTINUE', - data: { - fileName: file, - selection: new vscode.Range( - new vscode.Position(3, 1), - new vscode.Position(3, 22) - ) - } - }); - - expect(setDiagnosticStub.firstCall.args[1]).to.deep.equal([ - expectedDiagnostic - ]); - }); - }); - - describe('Report Diagnostics', () => { - const executor = new AnonApexLibraryExecuteExecutor(true); - const file = '/test'; - const defaultResponse = { - compiled: true, - success: false, - logs: '47.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO\nExecute Anonymous: System.assert(false);|EXECUTION_FINISHED\n', - diagnostic: [ - { - columnNumber: '1', - lineNumber: '6', - compileProblem: '', - exceptionMessage: 'System.AssertException: Assertion Failed', - exceptionStackTrace: 'AnonymousBlock: line 6, column 1' - } - ] - }; - - let setDiagnosticStub: SinonStub; - let executeStub: SinonStub; - - beforeEach(() => { - setDiagnosticStub = sb.stub( - AnonApexLibraryExecuteExecutor.diagnostics, - 'set' - ); - executeStub = sb - .stub(ExecuteService.prototype, 'executeAnonymous') - .resolves(defaultResponse); - }); - - it('should clear diagnostics before setting new ones', async () => { - const clearStub = sb.stub( - AnonApexLibraryExecuteExecutor.diagnostics, - 'clear' - ); - - await executor.run({ data: { fileName: file }, type: 'CONTINUE' }); - - expect(clearStub.calledBefore(setDiagnosticStub)).to.be.true; - }); - - it('should report diagnostic with zero based range', async () => { - const expectedDiagnostic = { - message: defaultResponse.diagnostic[0].exceptionMessage, - severity: vscode.DiagnosticSeverity.Error, - source: file, - range: new vscode.Range(5, 0, 5, 0) - }; - - await executor.run({ data: { fileName: file }, type: 'CONTINUE' }); - - expect(setDiagnosticStub.calledOnce).to.be.true; - expect(setDiagnosticStub.firstCall.args[0].path).to.deep.equal(file); - expect(setDiagnosticStub.firstCall.args[1]).to.deep.equal([ - expectedDiagnostic - ]); - }); - - it('should set compile problem as message if present', async () => { - const response = Object.assign({}, defaultResponse, { - diagnostic: [ - { - columnNumber: 1, - lineNumber: 6, - compileProblem: 'An error happened while compiling', - exceptionMessage: '', - exceptionStackTrace: 'AnonymousBlock: line 6, column 1' - } - ] - }); - const expectedDiagnostic = { - message: response.diagnostic[0].compileProblem, - severity: vscode.DiagnosticSeverity.Error, - source: file, - range: new vscode.Range(5, 0, 5, 0) - }; - executeStub.resolves(response); - - await executor.run({ data: { fileName: file }, type: 'CONTINUE' }); - - expect(setDiagnosticStub.calledOnce).to.be.true; - expect(setDiagnosticStub.firstCall.args[0].path).to.deep.equal(file); - expect(setDiagnosticStub.firstCall.args[1]).to.deep.equal([ - expectedDiagnostic - ]); - }); - - it('should set exception message as message if compile problem not present', async () => { - const response = Object.assign({}, defaultResponse, { - diagnostic: [ - { - columnNumber: 1, - lineNumber: 6, - exceptionMessage: 'System.AssertException: Assertion Failed', - exceptionStackTrace: 'AnonymousBlock: line 6, column 1' - } - ] - }); - executeStub.resolves(response); - const expectedDiagnostic = { - message: response.diagnostic[0].exceptionMessage, - severity: vscode.DiagnosticSeverity.Error, - source: file, - range: new vscode.Range(5, 0, 5, 0) - }; - - await executor.run({ data: { fileName: file }, type: 'CONTINUE' }); - - expect(setDiagnosticStub.calledOnce).to.be.true; - expect(setDiagnosticStub.firstCall.args[0].path).to.deep.equal(file); - expect(setDiagnosticStub.firstCall.args[1]).to.deep.equal([ - expectedDiagnostic - ]); - }); - - it('should set exception message as message if compile problem empty string', async () => { - const response = Object.assign({}, defaultResponse, { - diagnostic: [ - { - columnNumber: 1, - lineNumber: 6, - compileProblem: '', - exceptionMessage: 'System.AssertException: Assertion Failed', - exceptionStackTrace: 'AnonymousBlock: line 6, column 1' - } - ] - }); - executeStub.resolves(response); - const expectedDiagnostic = { - message: response.diagnostic[0].exceptionMessage, - severity: vscode.DiagnosticSeverity.Error, - source: file, - range: new vscode.Range(5, 0, 5, 0) - }; - - await executor.run({ data: { fileName: file }, type: 'CONTINUE' }); - - expect(setDiagnosticStub.calledOnce).to.be.true; - expect(setDiagnosticStub.firstCall.args[0].path).to.deep.equal(file); - expect(setDiagnosticStub.firstCall.args[1]).to.deep.equal([ - expectedDiagnostic - ]); - }); - - it('should set unexpected message as message if compile problem and exception message empty strings', async () => { - const response = Object.assign({}, defaultResponse, { - diagnostic: [ - { - columnNumber: 1, - lineNumber: 6, - compileProblem: '', - exceptionMessage: '', - exceptionStackTrace: 'AnonymousBlock: line 6, column 1' - } - ] - }); - executeStub.resolves(response); - const expectedDiagnostic = { - message: nls.localize('apex_execute_unexpected_error'), - severity: vscode.DiagnosticSeverity.Error, - source: file, - range: new vscode.Range(5, 0, 5, 0) - }; - - await executor.run({ data: { fileName: file }, type: 'CONTINUE' }); - - expect(setDiagnosticStub.calledOnce).to.be.true; - expect(setDiagnosticStub.firstCall.args[0].path).to.deep.equal(file); - expect(setDiagnosticStub.firstCall.args[1]).to.deep.equal([ - expectedDiagnostic - ]); - }); - }); - - describe('Apex Replay Debugger', () => { - let outputStub: SinonStub; - let showChannelOutputStub: SinonSpy; - let setDiagnosticStub: SinonStub; - const file = '/test'; - - beforeEach(() => { - outputStub = sb.stub(channelService, 'appendLine'); - showChannelOutputStub = sb.spy( - ChannelService.prototype, - 'showChannelOutput' - ); - setDiagnosticStub = sb.stub( - AnonApexLibraryExecuteExecutor.diagnostics, - 'set' - ); - }); - - it('should set up trace flags and run the Apex replay debugger when AnonApexLibraryExecuteExecutor(true) runs', async () => { - const executor = new AnonApexLibraryExecuteExecutor(true); - const execAnonResponse = { - compiled: true, - success: true, - logs: '47.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO\nExecute Anonymous: System.assert(true);|EXECUTION_FINISHED\n', - diagnostic: [ - { - lineNumber: -1, - columnNumber: -1, - compileProblem: '', - exceptionMessage: '', - exceptionStackTrace: '' - } - ] - }; - const expectedOutput = `${nls.localize( - 'apex_execute_compile_success' - )}\n${nls.localize('apex_execute_runtime_success')}\n\n${ - execAnonResponse.logs - }`; - sb.stub(ExecuteService.prototype, 'executeAnonymous').resolves( - execAnonResponse - ); - - await executor.run({ type: 'CONTINUE', data: {} }); - - expect(traceFlagsStub.called).to.be.true; - expect(executeCommandStub.called).to.be.true; - }); - - it('should not set up trace flags and should not run the Apex replay debugger when AnonApexLibraryExecuteExecutor(false) runs', async () => { - const executor = new AnonApexLibraryExecuteExecutor(false); - const execAnonResponse = { - compiled: true, - success: true, - logs: '47.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO\nExecute Anonymous: System.assert(true);|EXECUTION_FINISHED\n', - diagnostic: [ - { - lineNumber: -1, - columnNumber: -1, - compileProblem: '', - exceptionMessage: '', - exceptionStackTrace: '' - } - ] - }; - const expectedOutput = `${nls.localize( - 'apex_execute_compile_success' - )}\n${nls.localize('apex_execute_runtime_success')}\n\n${ - execAnonResponse.logs - }`; - sb.stub(ExecuteService.prototype, 'executeAnonymous').resolves( - execAnonResponse - ); - - await executor.run({ type: 'CONTINUE', data: {} }); - - expect(traceFlagsStub.called).to.be.false; - expect(executeCommandStub.called).to.be.false; - }); - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexLogGet.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexLogGet.test.ts deleted file mode 100644 index d171155ad4..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexLogGet.test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import { createSandbox, SinonSandbox } from 'sinon'; -import * as vscode from 'vscode'; -import { - ApexDebugLogObject, - LogFileSelector -} from '../../../src/commands/apexLogGet'; - -// tslint:disable:no-unused-expression -describe('Apex Log Get Logging', () => { - const newerStartTime = new Date(Date.now()); - const olderStartTime = new Date(Date.now() - 10 * 60000); - const oldestStartTime = new Date(Date.now() - 20 * 60000); - const logInfos: ApexDebugLogObject[] = [ - { - Id: 'id3', - LogLength: 300, - Operation: '/should/show/up/third', - Request: 'Api', - StartTime: oldestStartTime.toISOString(), - Status: 'Success', - LogUser: { - Name: 'Marco' - } - }, - { - Id: 'id2', - LogLength: 200, - Operation: '/should/show/up/second', - Request: 'Api', - StartTime: olderStartTime.toISOString(), - Status: 'Success', - LogUser: { - Name: 'Marco' - } - }, - { - Id: 'id1', - LogLength: 100, - Operation: '/should/show/up/first', - Request: 'Api', - StartTime: newerStartTime.toISOString(), - Status: 'Success', - LogUser: { - Name: 'Marco' - } - } - ]; - - let sb: SinonSandbox; - let showQuickPickStub: sinon.SinonStub; - let apexLogListStub: sinon.SinonStub; - - beforeEach(() => { - sb = createSandbox(); - apexLogListStub = sb - .stub(LogFileSelector.prototype, 'getLogRecords') - .onFirstCall() - .resolves([]) - .onSecondCall() - .resolves(logInfos.slice(0, 1)) - .onThirdCall() - .resolves(logInfos.slice(0, 1)) - .resolves(logInfos); - - showQuickPickStub = sb - .stub(vscode.window, 'showQuickPick') - .returns(logInfos[0]); - }); - - afterEach(() => { - sb.restore(); - }); - - it('Should show error notification if no logs exist using apex library', async () => { - const logFileSelector = new LogFileSelector(); - await logFileSelector.gather(); - expect(showQuickPickStub.called).to.be.false; - expect(apexLogListStub.called).to.be.true; - }); - - it('Should display one logInfo using apex library', async () => { - const logFileSelector = new LogFileSelector(); - await logFileSelector.gather(); - showQuickPickStub.calledWith([logInfos[0]]); - expect(apexLogListStub.called).to.be.true; - }); - - it('Should display two logInfos in reverse chronological order using apex library', async () => { - const logFileSelector = new LogFileSelector(); - await logFileSelector.gather(); - showQuickPickStub.calledWith([logInfos[1], logInfos[0]]); - expect(apexLogListStub.called).to.be.true; - }); - - it('Should display the loginfos in reverse chronological order using apex library', async () => { - const logFileSelector = new LogFileSelector(); - await logFileSelector.gather(); - showQuickPickStub.calledWith([logInfos[2], logInfos[1], logInfos[0]]); - expect(apexLogListStub.called).to.be.true; - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestRun.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestRun.test.ts deleted file mode 100644 index efdbb11a5b..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestRun.test.ts +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { HumanReporter, TestLevel, TestService } from '@salesforce/apex-node'; -import { expect } from 'chai'; -import { assert, createSandbox, match, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { - ApexLibraryTestRunExecutor, - ApexTestQuickPickItem, - TestsSelector, - TestType -} from '../../../src/commands/apexTestRun'; -import { workspaceContext } from '../../../src/context'; -import { nls } from '../../../src/messages'; -import * as settings from '../../../src/settings'; - -const sb = createSandbox(); - -/* tslint:disable:no-unused-expression */ -describe('Apex Library Test Run Executor', async () => { - let runTestStub: SinonStub; - let buildPayloadStub: SinonStub; - let writeResultFilesStub: SinonStub; - let reportStub: SinonStub; - let progress: vscode.Progress; - let cancellationTokenEventEmitter; - let cancellationToken: vscode.CancellationToken; - - beforeEach(async () => { - sb.stub(settings, 'retrieveTestCodeCoverage').returns(true); - runTestStub = sb.stub(TestService.prototype, 'runTestAsynchronous'); - sb.stub(workspaceContext, 'getConnection'); - buildPayloadStub = sb.stub(TestService.prototype, 'buildAsyncPayload'); - sb.stub(HumanReporter.prototype, 'format'); - writeResultFilesStub = sb.stub(TestService.prototype, 'writeResultFiles'); - - reportStub = sb.stub(); - progress = { report: reportStub }; - cancellationTokenEventEmitter = new vscode.EventEmitter(); - cancellationToken = { - isCancellationRequested: false, - onCancellationRequested: cancellationTokenEventEmitter.event - }; - }); - - afterEach(async () => { - sb.restore(); - }); - - it('should run test with correct parameters for specified class', async () => { - buildPayloadStub.resolves({ - classNames: 'testClass', - testLevel: TestLevel.RunSpecifiedTests - }); - - const apexLibExecutor = new ApexLibraryTestRunExecutor(); - await apexLibExecutor.run( - { - data: { type: TestType.Class, label: 'testClass' }, - type: 'CONTINUE' - }, - progress, - cancellationToken - ); - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - 'RunSpecifiedTests', - undefined, - 'testClass' - ]); - assert.calledOnce(runTestStub); - assert.calledWith( - runTestStub, - { - classNames: 'testClass', - testLevel: TestLevel.RunSpecifiedTests - }, - true, - false, - match.any, - cancellationToken - ); - }); - - it('should run test with correct parameters for specified suite', async () => { - buildPayloadStub.resolves({ - suiteNames: 'testSuite', - testLevel: TestLevel.RunSpecifiedTests - }); - - const apexLibExecutor = new ApexLibraryTestRunExecutor(); - await apexLibExecutor.run( - { - data: { type: TestType.Suite, label: 'testSuite' }, - type: 'CONTINUE' - }, - progress, - cancellationToken - ); - - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - 'RunSpecifiedTests', - undefined, - undefined, - 'testSuite' - ]); - assert.calledOnce(runTestStub); - assert.calledWith( - runTestStub, - { suiteNames: 'testSuite', testLevel: TestLevel.RunSpecifiedTests }, - true, - false, - match.any, - cancellationToken - ); - }); - - it('should run test with correct parameters for all tests', async () => { - const apexLibExecutor = new ApexLibraryTestRunExecutor(); - await apexLibExecutor.run( - { - data: { type: TestType.AllLocal, label: '' }, - type: 'CONTINUE' - }, - progress, - cancellationToken - ); - - assert.calledOnce(runTestStub); - assert.calledWith( - runTestStub, - { testLevel: TestLevel.RunLocalTests }, - true, - false, - match.any, - cancellationToken - ); - }); - - it('should run test with correct parameters for all tests', async () => { - const apexLibExecutor = new ApexLibraryTestRunExecutor(); - await apexLibExecutor.run( - { - data: { type: TestType.All, label: '' }, - type: 'CONTINUE' - }, - progress, - cancellationToken - ); - - assert.calledOnce(runTestStub); - assert.calledWith( - runTestStub, - { testLevel: TestLevel.RunAllTestsInOrg }, - true, - false, - match.any, - cancellationToken - ); - }); - - it('should report progress', async () => { - const apexLibExecutor = new ApexLibraryTestRunExecutor(); - runTestStub.callsFake( - (payload, codecoverage, exitEarly, progressReporter, token) => { - progressReporter.report({ - type: 'StreamingClientProgress', - value: 'streamingTransportUp', - message: 'Listening for streaming state changes...' - }); - progressReporter.report({ - type: 'StreamingClientProgress', - value: 'streamingProcessingTestRun', - message: 'Processing test run 707500000000000001', - testRunId: '707500000000000001' - }); - progressReporter.report({ - type: 'FormatTestResultProgress', - value: 'retrievingTestRunSummary', - message: 'Retrieving test run summary record' - }); - progressReporter.report({ - type: 'FormatTestResultProgress', - value: 'queryingForAggregateCodeCoverage', - message: 'Querying for aggregate code coverage results' - }); - } - ); - - await apexLibExecutor.run( - { - data: { type: TestType.All, label: '' }, - type: 'CONTINUE' - }, - progress, - cancellationToken - ); - - assert.calledWith(reportStub, { - message: 'Listening for streaming state changes...' - }); - assert.calledWith(reportStub, { - message: 'Processing test run 707500000000000001' - }); - assert.calledWith(reportStub, { - message: 'Retrieving test run summary record' - }); - assert.calledWith(reportStub, { - message: 'Querying for aggregate code coverage results' - }); - }); - - it('should return if cancellation is requested', async () => { - const apexLibExecutor = new ApexLibraryTestRunExecutor(); - runTestStub.callsFake(() => { - cancellationToken.isCancellationRequested = true; - }); - - const result = await apexLibExecutor.run( - { - data: { type: TestType.All, label: '' }, - type: 'CONTINUE' - }, - progress, - cancellationToken - ); - - assert.calledOnce(runTestStub); - assert.notCalled(writeResultFilesStub); - expect(result).to.eql(false); - }); - - describe('Tests selector', () => { - let quickPickStub: sinon.SinonStub; - - beforeEach(() => { - quickPickStub = sb.stub(vscode.window, 'showQuickPick').returns({ - label: nls.localize('apex_test_run_all_test_label'), - description: nls.localize('apex_test_run_all_tests_description_text'), - type: TestType.All - }); - }); - - it('Should have test suite and class', async () => { - const gatherer = new TestsSelector(); - const result = await gatherer.gather(); - - expect(result.type).to.equal('CONTINUE'); - expect(quickPickStub.getCall(0).args.length).to.equal(1); - const fileItems: ApexTestQuickPickItem[] = - quickPickStub.getCall(0).args[0]; - expect(fileItems.length).to.equal(4); - expect(fileItems[0].label).to.equal('DemoSuite'); - expect(fileItems[0].type).to.equal(TestType.Suite); - expect(fileItems[3].label).to.equal('DemoControllerTests'); - expect(fileItems[3].type).to.equal(TestType.Class); - expect(fileItems[1].label).to.equal( - nls.localize('apex_test_run_all_local_test_label') - ); - expect(fileItems[1].description).to.equal( - nls.localize('apex_test_run_all_local_tests_description_text') - ); - expect(fileItems[1].type).to.equal(TestType.AllLocal); - expect(fileItems[2].label).to.equal( - nls.localize('apex_test_run_all_test_label') - ); - expect(fileItems[2].description).to.equal( - nls.localize('apex_test_run_all_tests_description_text') - ); - expect(fileItems[2].type).to.equal(TestType.All); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestRunCodeAction.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestRunCodeAction.test.ts deleted file mode 100644 index d178efcc10..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestRunCodeAction.test.ts +++ /dev/null @@ -1,607 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - ApexTestResultOutcome, - HumanReporter, - TestLevel, - TestResult, - TestService -} from '@salesforce/apex-node'; -import { SfProject } from '@salesforce/core'; -import * as pathUtils from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; -import { expect } from 'chai'; -import { join } from 'path'; -import { assert, createSandbox, match, SinonStub } from 'sinon'; -import { - CancellationToken, - DiagnosticSeverity, - EventEmitter, - Progress, - Range, - Uri -} from 'vscode'; -import { - ApexLibraryTestRunExecutor, - resolveTestClassParam, - resolveTestMethodParam -} from '../../../src/commands/apexTestRunCodeAction'; -import { workspaceContext } from '../../../src/context'; - -// return undefined: used to get around strict checks -const getUndefined = (): any => { - return undefined; -}; - -/* eslint-disable @typescript-eslint/no-unused-expressions */ -describe('Apex Test Run - Code Action', () => { - describe('Cached Test Class', () => { - const testClass = 'MyTests'; - const testClass2 = 'MyTests2'; - it('Should return cached value', async () => { - let resolvedTestClass = await resolveTestClassParam(getUndefined()); - expect(resolvedTestClass).to.equal(undefined); - - resolvedTestClass = await resolveTestClassParam(testClass); - expect(resolvedTestClass).to.equal(testClass); - - resolvedTestClass = await resolveTestClassParam(''); - expect(resolvedTestClass).to.equal(testClass); - - resolvedTestClass = await resolveTestClassParam(getUndefined()); - expect(resolvedTestClass).to.equal(testClass); - - resolvedTestClass = await resolveTestClassParam(testClass2); - expect(resolvedTestClass).to.equal(testClass2); - - resolvedTestClass = await resolveTestClassParam(''); - expect(resolvedTestClass).to.equal(testClass2); - }); - }); - - describe('Cached Test Method', () => { - const testMethod = 'MyTests.testMe'; - const testMethod2 = 'MyTests.testMe2'; - it('Should return cached value', async () => { - let resolvedTestMethod = await resolveTestMethodParam(getUndefined()); - expect(resolvedTestMethod).to.equal(undefined); - - resolvedTestMethod = await resolveTestMethodParam(testMethod); - expect(resolvedTestMethod).to.equal(testMethod); - - resolvedTestMethod = await resolveTestMethodParam(''); - expect(resolvedTestMethod).to.equal(testMethod); - - resolvedTestMethod = await resolveTestMethodParam(getUndefined()); - expect(resolvedTestMethod).to.equal(testMethod); - - resolvedTestMethod = await resolveTestMethodParam(testMethod2); - expect(resolvedTestMethod).to.equal(testMethod2); - - resolvedTestMethod = await resolveTestMethodParam(''); - expect(resolvedTestMethod).to.equal(testMethod2); - }); - }); - - const testResult: TestResult = { - summary: { - failRate: '0%', - failing: 0, - testsRan: 2, - orgId: 'xxxx908373', - outcome: 'Failed', - passRate: '100%', - passing: 5, - skipRate: '0%', - skipped: 0, - testExecutionTimeInMs: 25, - testStartTime: '2:00:00PM', - testTotalTimeInMs: 25, - commandTimeInMs: 25, - hostname: 'NA95', - username: 'testusername@testing.com', - testRunId: 'xxxx9056', - userId: 'xxx555' - }, - tests: [ - { - asyncApexJobId: 'xxx9678', - id: 'xxxx56', - apexClass: { - fullName: 'TestClass', - name: 'TestClass', - namespacePrefix: '', - id: 'xx567' - }, - queueItemId: 'xxxQUEUEID', - stackTrace: 'System.AssertException: Assertion Failed Col: 18 Line: 2', - message: 'System.AssertException: Assertion Failed', - methodName: 'testMethod', - outcome: ApexTestResultOutcome.Fail, - runTime: 5, - apexLogId: 'xxxLogId90', - testTimestamp: '2:00:00PM', - fullName: 'TestClass.testMethod', - diagnostic: { - exceptionMessage: 'System.AssertException: Assertion Failed', - exceptionStackTrace: - 'System.AssertException: Assertion Failed Col: 18 Line: 2', - compileProblem: '', - lineNumber: 6, - columnNumber: 1, - className: 'TestClass' - } - }, - { - asyncApexJobId: 'xxx9678', - id: 'xxxx56', - apexClass: { - fullName: 'TestClass', - name: 'TestClassTwo', - namespacePrefix: '', - id: 'xx567' - }, - queueItemId: 'xxxQUEUEID', - stackTrace: 'System.AssertException: Assertion Failed Col: 15 Line: 3', - message: 'System.AssertException: Assertion Failed', - methodName: 'testMethodTwo', - outcome: ApexTestResultOutcome.Fail, - runTime: 5, - apexLogId: 'xxxLogId90', - testTimestamp: '2:00:00PM', - fullName: 'TestClassTwo.testMethodTwo', - diagnostic: { - exceptionMessage: 'System.AssertException: Assertion Failed', - exceptionStackTrace: - 'System.AssertException: Assertion Failed Col: 15 Line: 3', - compileProblem: '', - lineNumber: 3, - columnNumber: 15, - className: 'TestClassTwo' - } - } - ] - }; - const passingResult: TestResult = { - summary: { - failRate: '0%', - failing: 0, - testsRan: 2, - orgId: 'xxxx908373', - outcome: 'Passed', - passRate: '100%', - passing: 5, - skipRate: '0%', - skipped: 0, - testExecutionTimeInMs: 25, - testStartTime: '2:00:00PM', - testTotalTimeInMs: 25, - commandTimeInMs: 25, - hostname: 'NA95', - username: 'testusername@testing.com', - testRunId: 'xxxx9056', - userId: 'xxx555' - }, - tests: [ - { - asyncApexJobId: 'xxx9678', - id: 'xxxx56', - apexClass: { - fullName: 'TestClass', - name: 'TestClass', - namespacePrefix: '', - id: 'xx567' - }, - queueItemId: 'xxxQUEUEID', - stackTrace: '', - message: '', - methodName: 'testMethod', - outcome: ApexTestResultOutcome.Pass, - runTime: 5, - apexLogId: 'xxxLogId90', - testTimestamp: '2:00:00PM', - fullName: 'TestClass.testMethod' - }, - { - asyncApexJobId: 'xxx9678', - id: 'xxxx56', - apexClass: { - fullName: 'TestClass', - name: 'TestClassTwo', - namespacePrefix: '', - id: 'xx567' - }, - queueItemId: 'xxxQUEUEID', - stackTrace: '', - message: '', - methodName: 'testMethodTwo', - outcome: ApexTestResultOutcome.Pass, - runTime: 5, - apexLogId: 'xxxLogId90', - testTimestamp: '2:00:00PM', - fullName: 'TestClassTwo.testMethodTwo' - } - ] - }; - const sb = createSandbox(); - describe('Apex Library Test Run Executor', () => { - let runTestStub: SinonStub; - let buildPayloadStub: SinonStub; - let writeResultFilesStub: SinonStub; - const defaultPackageDir = 'default/package/dir'; - const componentPath = join( - defaultPackageDir, - 'main', - 'default', - 'TestClass.cls' - ); - let reportStub: SinonStub; - let progress: Progress; - let cancellationTokenEventEmitter; - let cancellationToken: CancellationToken; - beforeEach(() => { - runTestStub = sb - .stub(TestService.prototype, 'runTestAsynchronous') - .resolves(passingResult); - sb.stub(workspaceContext, 'getConnection'); - buildPayloadStub = sb.stub(TestService.prototype, 'buildAsyncPayload'); - sb.stub(HumanReporter.prototype, 'format'); - writeResultFilesStub = sb.stub(TestService.prototype, 'writeResultFiles'); - sb.stub(SfProject, 'resolve').returns({ - getDefaultPackage: () => { - return { fullPath: 'default/package/dir' }; - } - }); - sb.stub(ComponentSet, 'fromSource').returns({ - getSourceComponents: () => { - return { - first: () => { - return { content: componentPath }; - } - }; - } - }); - sb.stub(ApexLibraryTestRunExecutor.diagnostics, 'set'); - - reportStub = sb.stub(); - progress = { report: reportStub }; - cancellationTokenEventEmitter = new EventEmitter(); - cancellationToken = { - isCancellationRequested: false, - onCancellationRequested: cancellationTokenEventEmitter.event - }; - }); - afterEach(() => { - sb.restore(); - }); - - it('should run test with correct parameters for single test method with code coverage', async () => { - buildPayloadStub.resolves({ - tests: [{ className: 'testClass', testMethods: ['oneTest'] }], - testLevel: TestLevel.RunSpecifiedTests - }); - const apexLibExecutor = new ApexLibraryTestRunExecutor( - ['testClass.oneTest'], - 'path/to/dir', - true - ); - await apexLibExecutor.run(undefined, progress, cancellationToken); - - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - 'RunSpecifiedTests', - 'testClass.oneTest' - ]); - assert.calledOnce(runTestStub); - assert.calledWith( - runTestStub, - { - tests: [{ className: 'testClass', testMethods: ['oneTest'] }], - testLevel: TestLevel.RunSpecifiedTests - }, - true, - false, - match.any, - cancellationToken - ); - }); - - it('should run test with correct parameters for multiple test methods without code coverage', async () => { - buildPayloadStub.resolves({ - tests: [ - { className: 'testClass', testMethods: ['oneTest'] }, - { className: 'testClass', testMethods: ['twoTest'] } - ], - testLevel: TestLevel.RunSpecifiedTests - }); - const apexLibExecutor = new ApexLibraryTestRunExecutor( - ['testClass.oneTest', 'testClass.twoTest'], - 'path/to/dir', - false - ); - await apexLibExecutor.run(undefined, progress, cancellationToken); - - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - 'RunSpecifiedTests', - 'testClass.oneTest,testClass.twoTest' - ]); - assert.calledOnce(runTestStub); - assert.calledWith( - runTestStub, - { - tests: [ - { className: 'testClass', testMethods: ['oneTest'] }, - { className: 'testClass', testMethods: ['twoTest'] } - ], - testLevel: TestLevel.RunSpecifiedTests - }, - false, - false, - match.any, - cancellationToken - ); - }); - - it('should run test with correct parameters for single test class with code coverage', async () => { - buildPayloadStub.resolves({ - tests: [{ className: 'testClass' }], - testLevel: TestLevel.RunSpecifiedTests - }); - const apexLibExecutor = new ApexLibraryTestRunExecutor( - ['testClass'], - 'path/to/dir', - true - ); - await apexLibExecutor.run(undefined, progress, cancellationToken); - - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - 'RunSpecifiedTests', - 'testClass' - ]); - assert.calledOnce(runTestStub); - assert.calledWith( - runTestStub, - { - tests: [{ className: 'testClass' }], - testLevel: TestLevel.RunSpecifiedTests - }, - true, - false, - match.any, - cancellationToken - ); - }); - - it('should run test with correct parameters for multiple test classes without code coverage', async () => { - buildPayloadStub.resolves({ - tests: [{ className: 'testClass' }, { className: 'secondTestClass' }], - testLevel: TestLevel.RunSpecifiedTests - }); - const apexLibExecutor = new ApexLibraryTestRunExecutor( - ['testClass', 'secondTestClass'], - 'path/to/dir', - false - ); - await apexLibExecutor.run(undefined, progress, cancellationToken); - - expect(buildPayloadStub.called).to.be.true; - expect(buildPayloadStub.args[0]).to.eql([ - 'RunSpecifiedTests', - 'testClass,secondTestClass' - ]); - assert.calledOnce(runTestStub); - assert.calledWith( - runTestStub, - { - tests: [{ className: 'testClass' }, { className: 'secondTestClass' }], - testLevel: TestLevel.RunSpecifiedTests - }, - false, - false, - match.any, - cancellationToken - ); - }); - - it('should report progress', async () => { - buildPayloadStub.resolves({ - tests: [ - { className: 'testClass' }, - { - className: 'secondTestClass' - } - ], - testLevel: TestLevel.RunSpecifiedTests - }); - const apexLibExecutor = new ApexLibraryTestRunExecutor( - ['testClass', 'secondTestClass'], - 'path/to/dir', - false - ); - runTestStub.callsFake( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (payload, codecoverage, exitEarly, progressReporter, token) => { - progressReporter.report({ - type: 'StreamingClientProgress', - value: 'streamingTransportUp', - message: 'Listening for streaming state changes...' - }); - progressReporter.report({ - type: 'StreamingClientProgress', - value: 'streamingProcessingTestRun', - message: 'Processing test run 707500000000000001', - testRunId: '707500000000000001' - }); - progressReporter.report({ - type: 'FormatTestResultProgress', - value: 'retrievingTestRunSummary', - message: 'Retrieving test run summary record' - }); - progressReporter.report({ - type: 'FormatTestResultProgress', - value: 'queryingForAggregateCodeCoverage', - message: 'Querying for aggregate code coverage results' - }); - return passingResult; - } - ); - - await apexLibExecutor.run(undefined, progress, cancellationToken); - - assert.calledWith(reportStub, { - message: 'Listening for streaming state changes...' - }); - assert.calledWith(reportStub, { - message: 'Processing test run 707500000000000001' - }); - assert.calledWith(reportStub, { - message: 'Retrieving test run summary record' - }); - assert.calledWith(reportStub, { - message: 'Querying for aggregate code coverage results' - }); - }); - - it('should return if cancellation is requested', async () => { - const apexLibExecutor = new ApexLibraryTestRunExecutor( - ['testClass', 'secondTestClass'], - 'path/to/dir', - false - ); - runTestStub.callsFake(() => { - cancellationToken.isCancellationRequested = true; - }); - - const result = await apexLibExecutor.run( - undefined, - progress, - cancellationToken - ); - - assert.calledOnce(runTestStub); - assert.notCalled(writeResultFilesStub); - expect(result).to.eql(false); - }); - }); - - describe('Report Diagnostics', () => { - const executor = new ApexLibraryTestRunExecutor( - ['TestClass', 'TestClassTwo'], - 'path/to/dir', - false - ); - const defaultPackageDir = 'default/package/dir'; - const componentPath = join( - defaultPackageDir, - 'main', - 'default', - 'TestClass.cls' - ); - const diagnostics = testResult.tests.map(() => { - const { exceptionMessage, exceptionStackTrace } = - testResult.tests[0].diagnostic!; - return { - message: `${exceptionMessage}\n${exceptionStackTrace}`, - severity: DiagnosticSeverity.Error, - source: componentPath, - range: new Range(5, 0, 5, 0) - }; - }); - - let setDiagnosticStub: SinonStub; - let runTestStub: SinonStub; - let componentPathStub: SinonStub; - - beforeEach(() => { - sb.stub(TestService.prototype, 'writeResultFiles'); - sb.stub(workspaceContext, 'getConnection'); - sb.stub(SfProject, 'resolve').returns({ - getDefaultPackage: () => { - return { fullPath: 'default/package/dir' }; - } - }); - componentPathStub = sb.stub(ComponentSet, 'fromSource').returns({ - getSourceComponents: () => { - return { - first: () => { - return { content: componentPath }; - } - }; - } - }); - setDiagnosticStub = sb.stub( - ApexLibraryTestRunExecutor.diagnostics, - 'set' - ); - runTestStub = sb - .stub(TestService.prototype, 'runTestAsynchronous') - .resolves(testResult); - sb.stub(pathUtils, 'getTestResultsFolder'); - }); - - afterEach(() => { - sb.restore(); - }); - - it('should clear diagnostics before setting new ones', async () => { - const clearStub = sb.stub( - ApexLibraryTestRunExecutor.diagnostics, - 'clear' - ); - - await executor.run(); - expect(clearStub.calledBefore(setDiagnosticStub)).to.be.true; - }); - - it('should set all diagnostic properties correctly', async () => { - await executor.run(); - - expect( - setDiagnosticStub.calledWith(Uri.file(defaultPackageDir), [ - diagnostics[0] - ]) - ); - }); - - it('should set multiple diagnostics correctly', async () => { - await executor.run(); - expect( - setDiagnosticStub.calledWith(Uri.file(defaultPackageDir), [ - diagnostics[0] - ]) - ); - expect( - setDiagnosticStub.calledWith(Uri.file(defaultPackageDir), [ - diagnostics[1] - ]) - ); - }); - - it('should not set diagnostic if filepath was not found', async () => { - componentPathStub.returns({ - getSourceComponents: () => { - return { - first: () => { - return { content: undefined }; - } - }; - } - }); - await executor.run(); - expect(setDiagnosticStub.notCalled).to.be.true; - }); - - it('should not set diagnostic if test has no associated diagnostic', async () => { - runTestStub.resolves(passingResult); - await executor.run(); - expect(setDiagnosticStub.notCalled).to.be.true; - }); - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestSuite.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestSuite.test.ts deleted file mode 100644 index cb53c9fb28..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/apexTestSuite.test.ts +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { TestService } from '@salesforce/apex-node'; -import { ContinueResponse } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { createSandbox } from 'sinon'; -import * as vscode from 'vscode'; -import { - ApexTestQuickPickItem, - TestType -} from '../../../src/commands/apexTestRun'; -import { - ApexTestSuiteOptions, - TestSuiteBuilder, - TestSuiteCreator, - TestSuiteSelector -} from '../../../src/commands/apexTestSuite'; -import { workspaceContext } from '../../../src/context'; - -const sb = createSandbox(); - -describe('Test Suite Selector', () => { - let quickPickStub: sinon.SinonStub; - - beforeEach(() => { - sb.stub(workspaceContext, 'getConnection'); - quickPickStub = sb.stub(vscode.window, 'showQuickPick').returns({ - label: 'SuiteOne', - type: TestType.Suite - }); - - sb.stub(TestService.prototype, 'retrieveAllSuites').resolves([ - { TestSuiteName: 'SuiteOne', Id: 'xxxxxxxxxxx27343' }, - { TestSuiteName: 'SuiteTwo', Id: 'xxxxxxxxxxx27343' } - ]); - }); - - afterEach(() => { - sb.restore(); - }); - - it('Should have two test suites', async () => { - const gatherer = new TestSuiteSelector(); - const result = await gatherer.gather(); - - expect(result.type).to.equal('CONTINUE'); - expect(quickPickStub.getCall(0).args.length).to.equal(1); - const fileItems: ApexTestQuickPickItem[] = quickPickStub.getCall(0).args[0]; - expect(fileItems.length).to.equal(2); - expect(fileItems[0].label).to.equal('SuiteOne'); - expect(fileItems[0].type).to.equal(TestType.Suite); - expect(fileItems[1].label).to.equal('SuiteTwo'); - expect(fileItems[1].type).to.equal(TestType.Suite); - }); - - it('Should select suite one', async () => { - const gatherer = new TestSuiteSelector(); - const result = await gatherer.gather(); - - expect(result.type).to.equal('CONTINUE'); - expect((result as ContinueResponse).data).to.eql({ - label: 'SuiteOne', - type: TestType.Suite - }); - }); -}); - -describe('Test Suite Builder', () => { - let quickPickStub: sinon.SinonStub; - - beforeEach(() => { - sb.stub(workspaceContext, 'getConnection'); - quickPickStub = sb.stub(vscode.window, 'showQuickPick').returns([ - { - label: 'SuiteOne', - type: TestType.Suite - } - ]); - - sb.stub(TestService.prototype, 'retrieveAllSuites').resolves([ - { TestSuiteName: 'SuiteOne', Id: 'xxxxxxxxxxx27343' }, - { TestSuiteName: 'SuiteTwo', Id: 'xxxxxxxxxxx27343' } - ]); - }); - - afterEach(() => { - sb.restore(); - }); - - it('Should have two test suites', async () => { - const gatherer = new TestSuiteBuilder(); - const result = await gatherer.gather(); - - expect(result.type).to.equal('CONTINUE'); - expect(quickPickStub.getCall(0).args.length).to.equal(1); - const fileItems: ApexTestQuickPickItem[] = quickPickStub.getCall(0).args[0]; - expect(fileItems.length).to.equal(2); - expect(fileItems[0].label).to.equal('SuiteOne'); - expect(fileItems[0].type).to.equal(TestType.Suite); - expect(fileItems[1].label).to.equal('SuiteTwo'); - expect(fileItems[1].type).to.equal(TestType.Suite); - }); - - it('Should select suite one', async () => { - const gatherer = new TestSuiteBuilder(); - const result = await gatherer.gather(); - - expect(result.type).to.equal('CONTINUE'); - expect((result as ContinueResponse).data).to.eql({ - suitename: undefined, - tests: ['SuiteOne'] - }); - }); -}); - -describe('Test Suite Creator', async () => { - let quickPickStub: sinon.SinonStub; - - beforeEach(async () => { - sb.stub(workspaceContext, 'getConnection'); - quickPickStub = sb.stub(vscode.window, 'showQuickPick').returns([ - { - label: 'NewClass', - type: TestType.Class - } - ]); - sb.stub(vscode.window, 'showInputBox').resolves('NewSuite'); - }); - - afterEach(async () => { - sb.restore(); - }); - - it('Should create Test Suite and select one Apex Class', async () => { - const gatherer = new TestSuiteCreator(); - const result = await gatherer.gather(); - - expect(result.type).to.equal('CONTINUE'); - expect(quickPickStub.getCall(0).args.length).to.equal(2); - const fileItems: ApexTestQuickPickItem[] = quickPickStub.getCall(0).args[0]; - expect(fileItems.length).to.equal(1); - expect(fileItems[0].label).to.equal('DemoControllerTests'); - expect(fileItems[0].type).to.equal(TestType.Class); - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/launchApexReplayDebuggerWithCurrentFile.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/launchApexReplayDebuggerWithCurrentFile.test.ts deleted file mode 100644 index 3c0de80d0b..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/commands/launchApexReplayDebuggerWithCurrentFile.test.ts +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { TestContext } from '@salesforce/core/lib/testSetup'; -import { - fileUtils, - notificationService, - SfCommandlet -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { launchApexReplayDebuggerWithCurrentFile } from '../../../src/commands/launchApexReplayDebuggerWithCurrentFile'; -import { nls } from '../../../src/messages'; -import { ApexTestOutlineProvider } from '../../../src/views/testOutlineProvider'; - -describe('Launch Replay Debugger', () => { - const $$ = new TestContext(); - const sb = createSandbox(); - let flushFilePathStub: SinonStub; - beforeEach(async () => { - flushFilePathStub = sb.stub(fileUtils, 'flushFilePath'); - }); - - afterEach(() => { - sb.restore(); - }); - - it('should return an error when the editor is not found', async () => { - sb.stub(vscode.window, 'activeTextEditor').get(() => undefined); - - const showErrorMessageStub = sb.stub( - notificationService, - 'showErrorMessage' - ); - - await launchApexReplayDebuggerWithCurrentFile(); - - expect(showErrorMessageStub.called).to.equal(true); - expect( - showErrorMessageStub.calledWith(nls.localize('unable_to_locate_editor')) - ).to.equal(true); - }); - - it("should return an error when the document's URI is not found", async () => { - sb.stub(vscode.window, 'activeTextEditor').get(() => ({ - document: { - uri: undefined - } - })); - - const showErrorMessageStub = sb.stub( - notificationService, - 'showErrorMessage' - ); - - await launchApexReplayDebuggerWithCurrentFile(); - - expect(showErrorMessageStub.called).to.equal(true); - expect( - showErrorMessageStub.calledWith(nls.localize('unable_to_locate_document')) - ).to.equal(true); - }); - - it('should return an error when not a log file, not an anon apex file, and not an apex test class', async () => { - sb.stub(vscode.window, 'activeTextEditor').get(() => ({ - document: { - uri: vscode.Uri.file('foo.txt') - } - })); - - const showErrorMessageStub = sb.stub( - notificationService, - 'showErrorMessage' - ); - - sb.stub(ApexTestOutlineProvider.prototype, 'refresh').returns(undefined); - - sb.stub(ApexTestOutlineProvider.prototype, 'getTestClassName').returns( - undefined - ); - - flushFilePathStub.returns(undefined); - - await launchApexReplayDebuggerWithCurrentFile(); - - expect(showErrorMessageStub.called).to.equal(true); - expect( - showErrorMessageStub.calledWith( - nls.localize('launch_apex_replay_debugger_unsupported_file') - ) - ).to.equal(true); - }); - - it('should call executeCommand() if file is a log file', async () => { - sb.stub(vscode.window, 'activeTextEditor').get(() => ({ - document: { - uri: vscode.Uri.file('foo.log') - } - })); - - const executeCommandSpy = sb - .stub(vscode.commands, 'executeCommand') - .resolves(true); - - await launchApexReplayDebuggerWithCurrentFile(); - - expect(executeCommandSpy.called).to.equal(true); - expect( - executeCommandSpy.calledWith('sf.launch.replay.debugger.logfile') - ).to.equal(true); - }); - - it('should call SfCommandlet.run() if file is an anon apex file', async () => { - sb.stub(vscode.window, 'activeTextEditor').get(() => ({ - document: { - uri: vscode.Uri.file('foo.apex') - } - })); - - const runStub = sb.stub(SfCommandlet.prototype, 'run').returns(undefined); - - await launchApexReplayDebuggerWithCurrentFile(); - - expect(runStub.called).to.equal(true); - }); - - it('should call executeCommand if file is an apex test class', async () => { - sb.stub(vscode.window, 'activeTextEditor').get(() => ({ - document: { - uri: vscode.Uri.file('foo.cls') - } - })); - - sb.stub(ApexTestOutlineProvider.prototype, 'refresh').returns(undefined); - - sb.stub(ApexTestOutlineProvider.prototype, 'getTestClassName').returns( - 'foo.cls' - ); - - sb.stub(SfCommandlet.prototype, 'run').returns(undefined); - - flushFilePathStub.returns('foo.cls'); - - const executeCommandSpy = sb - .stub(vscode.commands, 'executeCommand') - .resolves(true); - - await launchApexReplayDebuggerWithCurrentFile(); - - expect(executeCommandSpy.called).to.equal(true); - expect(executeCommandSpy.calledWith('sf.test.view.debugTests')).to.equal( - true - ); - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/embeddedSoql/soqlCompletion.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/embeddedSoql/soqlCompletion.test.ts deleted file mode 100644 index 84ac9430f1..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/embeddedSoql/soqlCompletion.test.ts +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - commands, - CompletionContext, - CompletionItem, - CompletionItemKind, - CompletionList, - CompletionTriggerKind, - extensions, - Position, - TextDocument, - Uri, - window, - workspace -} from 'vscode'; - -import { - CancellationToken, - ProvideCompletionItemsSignature -} from 'vscode-languageclient'; -import ProtocolCompletionItem from 'vscode-languageclient/lib/common/protocolCompletionItem'; -import { soqlMiddleware } from '../../../src/embeddedSoql'; - -const SOQL_SPECIAL_COMPLETION_ITEM_LABEL = '_SOQL_'; - -interface JavaApexLocation { - startIndex: number; - endIndex: number; - line: number; - column: number; -} -const createApexLSPSpecialSOQLCompletionItem = ( - soqlText: string, - location: JavaApexLocation -): CompletionItem => { - const item = new ProtocolCompletionItem(SOQL_SPECIAL_COMPLETION_ITEM_LABEL); - item.kind = CompletionItemKind.Snippet; - item.detail = soqlText; - item.data = location; - return item; -}; -const FAKE_APEX_COMPLETION_ITEM = new CompletionItem( - 'ApexCompletionItem', - CompletionItemKind.Class -); -const FAKE_SOQL_COMPLETION_ITEM = new CompletionItem( - 'SoqlCompletionItem', - CompletionItemKind.Class -); - -describe('Test embedded SOQL middleware to forward to SOQL LSP for code-completion', () => { - let sandbox: sinon.SinonSandbox; - let tempDoc: Uri; - - beforeEach(async () => { - sandbox = sinon.createSandbox(); - }); - - afterEach(async () => { - sandbox.restore(); - await commands.executeCommand('workbench.action.closeActiveEditor'); - await workspace.fs.delete(tempDoc); - }); - - describe('When outside SOQL block', () => { - it('Should return Apex completion items unchanged', async () => { - const executeCommandSpy = sandbox.spy(commands, 'executeCommand'); - const { doc, position } = await prepareFile('class Test { | }'); - tempDoc = doc.uri; - const items = await invokeSoqlMiddleware(doc, position, [ - FAKE_APEX_COMPLETION_ITEM - ]); - - expect(items.length).to.equal(1); - // eslint-disable-next-line @typescript-eslint/no-unused-expressions - expect(executeCommandSpy.called).to.be.false; - }); - }); - - describe('When inside SOQL block', () => { - it('Should drop Apex LSP items, invoke SOQL completion and return SOQL LSP items', async () => { - const lines: string[] = [ - 'class Test {', - ' private Account[] account = [SELECT Id |];', - '}' - ]; - const soqlOnlyLines: string[] = [ - ' ', - ' SELECT Id | ', - ' ' - ]; - const apexCode = lines.join('\n'); - const soqlCode = soqlOnlyLines.join('\n'); - - const executeCommandSpy = sandbox - .stub(commands, 'executeCommand') - .returns([FAKE_SOQL_COMPLETION_ITEM]); - - const { doc, position } = await prepareFile(apexCode); - tempDoc = doc.uri; - - const items = await invokeSoqlMiddleware(doc, position, [ - FAKE_APEX_COMPLETION_ITEM, - createApexLSPSpecialSOQLCompletionItem('SELECT Id ', { - startIndex: apexCode.indexOf('[SELECT Id'), - endIndex: apexCode.indexOf('];'), - line: 2, - column: lines[1].indexOf('SELECT') - }) - ]); - - // eslint-disable-next-line @typescript-eslint/no-unused-expressions - expect(executeCommandSpy.called).to.be.true; - expect(items.length).to.equal(1); - expect(items[0]).to.equal(FAKE_SOQL_COMPLETION_ITEM); - const virtualDocUri = executeCommandSpy.lastCall.args[1]; - const soqlVirtualDoc = await vscode.workspace.openTextDocument( - virtualDocUri - ); - expect(soqlVirtualDoc.getText()).to.equal(soqlCode.replace('|', '')); - }); - }); -}); - -const invokeSoqlMiddleware = async ( - doc: TextDocument, - position: Position, - itemsReturnedByApexLsp: CompletionItem[] -): Promise => { - const context: CompletionContext = { - triggerKind: CompletionTriggerKind.Invoke, - triggerCharacter: undefined - }; - const token = {} as CancellationToken; - - const apexLSPCompletionFn: ProvideCompletionItemsSignature = () => { - return itemsReturnedByApexLsp; - }; - - const finalItems: ProtocolCompletionItem[] = []; - if (soqlMiddleware.provideCompletionItem) { - const soqlItems = await soqlMiddleware.provideCompletionItem( - doc, - position, - context, - token, - apexLSPCompletionFn - ); - - const items: ProtocolCompletionItem[] = Array.isArray(soqlItems) - ? (soqlItems as ProtocolCompletionItem[]) - : ((soqlItems as CompletionList).items as ProtocolCompletionItem[]); - - finalItems.push(...items); - } - return finalItems; -}; - -const prepareFile = async ( - text: string -): Promise<{ doc: TextDocument; position: Position }> => { - const position = getCursorPosition(text); - const finalText = text.replace('|', ''); - - const encoder = new TextEncoder(); - - const workspacePath = workspace.workspaceFolders![0].uri.fsPath; - const fileUri = Uri.file( - path.join(workspacePath, `test_embeddedSoql_${generateRandomInt()}.cls`) - ); - await workspace.fs.writeFile(fileUri, encoder.encode(finalText)); - return { doc: await activate(fileUri), position }; -}; - -const getCursorPosition =(text: string, cursorChar: string = '|'): Position => { - for (const [line, lineText] of text.split('\n').entries()) { - const column = lineText.indexOf(cursorChar); - if (column >= 0) return new Position(line, column); - } - throw new Error(`Cursor ${cursorChar} not found in ${text} !`); -}; - -export const activate = async (docUri: Uri): Promise => { - const ext = extensions.getExtension('salesforce.salesforcedx-vscode-apex')!; - await ext.activate(); - try { - const doc = await workspace.openTextDocument(docUri); - await window.showTextDocument(doc); - return doc; - } catch (e) { - console.error(e); - throw e; - } -}; - -const generateRandomInt = () => { - return Math.floor(Math.random() * Math.floor(Number.MAX_SAFE_INTEGER)); -}; diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/index.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/index.ts deleted file mode 100644 index 7cd0595ba2..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { join, normalize } from 'path'; - -// eslint-disable-next-line @typescript-eslint/no-var-requires -const testRunner = require('@salesforce/salesforcedx-test-utils-vscode/out/src/testrunner'); - -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure( - { - ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results - timeout: 360000, - retries: 2, - fullTrace: true, - slow: 0 - }, - normalize(join(__dirname, '..', '..', '..')) -); - -module.exports = testRunner; diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/javaConfiguration.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/javaConfiguration.test.ts deleted file mode 100644 index 9a382756da..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/javaConfiguration.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// tslint:disable:no-unused-expression - -import { expect } from 'chai'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as vscode from 'vscode'; -import { JAVA_HOME_KEY, JAVA_MEMORY_KEY } from '../../src/requirements'; - -describe('Java Configuration Test', () => { - - it('The jar should be signed', () => { - shell.config.execPath = process.execPath; - const apexJarPath = path.join(__dirname, '..', '..', 'apex-jorje-lsp.jar'); - expect( - shell - .exec(`jarsigner -verify ${apexJarPath}`) - .stdout.includes('jar verified') - ).to.be.true; - }); - - it('Should have java.home section', () => { - const config = vscode.workspace.getConfiguration(); - expect(config.has(JAVA_HOME_KEY)).to.be.true; - }); - - it('Should have java.memory section', () => { - const config = vscode.workspace.getConfiguration(); - expect(config.has(JAVA_MEMORY_KEY)).to.be.true; - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/languageClient.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/languageClient.test.ts deleted file mode 100644 index 8863701f14..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/languageClient.test.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// tslint:disable:no-unused-expression - -import { expect } from 'chai'; -import * as fs from 'fs'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { Uri } from 'vscode'; -import { RevealOutputChannelOn } from 'vscode-languageclient'; -import { - buildClientOptions, - code2ProtocolConverter -} from '../../src/languageServer'; - -describe('Apex Language Server Client', () => { - describe('Should properly handle sending URI to server on Windows', () => { - let originalPlatform: PropertyDescriptor; - - beforeEach(() => { - originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform')!; - Object.defineProperty(process, 'platform', { value: 'win32' }); - }); - - afterEach(() => { - Object.defineProperty(process, 'platform', originalPlatform); - }); - - it('Should only replace first :', () => { - const actual = code2ProtocolConverter( - Uri.parse('file:///c%3A/path/to/file/with%20%3A%20in%20name') - ); - expect(actual).to.be.eql( - 'file:///c:/path/to/file/with%20%3A%20in%20name' - ); - }); - }); - - describe('Should properly handle sending URI to server on *nix', () => { - let originalPlatform: PropertyDescriptor; - - beforeEach(() => { - originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform')!; - Object.defineProperty(process, 'platform', { value: 'darwin' }); - }); - - afterEach(() => { - Object.defineProperty(process, 'platform', originalPlatform); - }); - - it('Should not replace first :', () => { - const actual = code2ProtocolConverter( - Uri.parse('file:///path/to/file/with%20%3A%20in%20name') - ); - expect(actual).to.be.eql('file:///path/to/file/with%20%3A%20in%20name'); - }); - }); - - describe('Should conditionally initialize server for SOQL block detection', () => { - const sandbox = createSandbox(); - - beforeEach(() => {}); - afterEach(() => sandbox.restore()); - - it('should enable it when SOQL extension is present', () => { - sandbox - .stub(vscode.extensions, 'getExtension') - .withArgs('salesforce.salesforcedx-vscode-soql') - .returns({}); - - const clientOptions = buildClientOptions(); - - expect(clientOptions.middleware).not.to.be.undefined; - expect(clientOptions.initializationOptions).not.to.be.undefined; - expect(clientOptions.initializationOptions.enableEmbeddedSoqlCompletion) - .to.be.true; - }); - - it('should disable it when SOQL extension is present', () => { - sandbox - .stub(vscode.extensions, 'getExtension') - .withArgs('salesforce.salesforcedx-vscode-soql') - .returns(undefined); - - const clientOptions = buildClientOptions(); - - expect(clientOptions.middleware).to.be.undefined; - expect(clientOptions.initializationOptions).not.to.be.undefined; - expect(clientOptions.initializationOptions.enableEmbeddedSoqlCompletion) - .to.be.false; - }); - }); - - describe('Should not actively disturb user while running in the background', () => { - const sandbox = createSandbox(); - - beforeEach(() => {}); - afterEach(() => sandbox.restore()); - - it('should never reveal output channel', () => { - sandbox - .stub(vscode.extensions, 'getExtension') - .withArgs('salesforce.salesforcedx-vscode-soql') - .returns({}); - - const clientOptions = buildClientOptions(); - - expect(clientOptions.revealOutputChannelOn).to.equal( - RevealOutputChannelOn.Never - ); - }); - }); - - describe('Anonymous Apex Support', () => { - const sandbox = createSandbox(); - - beforeEach(() => {}); - afterEach(() => sandbox.restore()); - - it('should enable document selector for anon-apex', () => { - const clientOptions = buildClientOptions(); - - expect(clientOptions.documentSelector).not.to.be.undefined; - expect(clientOptions.documentSelector).to.deep.include.members([ - { - language: 'apex-anon', - scheme: 'file' - } - ]); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/settings.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/settings.test.ts deleted file mode 100644 index f8de8ea972..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/settings.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { SFDX_CORE_CONFIGURATION_NAME } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { retrieveTestCodeCoverage } from '../../src/settings'; - -const sandbox = createSandbox(); - -describe('Settings', () => { - let settingStub: SinonStub; - - beforeEach(() => { - settingStub = sandbox.stub(); - sandbox - .stub(vscode.workspace, 'getConfiguration') - .withArgs(SFDX_CORE_CONFIGURATION_NAME) - .returns({ - get: settingStub - }); - }); - - afterEach(() => sandbox.restore()); - - describe('retrieveTestCodeCoverage', () => { - it('should return true if configuration value is true', () => { - settingStub.withArgs('retrieve-test-code-coverage').returns(true); - - expect(retrieveTestCodeCoverage()).to.equal(true); - }); - - it('should return false if configuration value is false', () => { - settingStub.withArgs('retrieve-test-code-coverage').returns(false); - - expect(retrieveTestCodeCoverage()).to.equal(false); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testDataUtil.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testDataUtil.ts deleted file mode 100644 index 6b4ee56109..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testDataUtil.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import * as vscode from 'vscode'; -import { ApexTestMethod } from '../../../src/views/lspConverter'; - -export const generateApexTestMethod = (namespace?: string): ApexTestMethod[] => { - const apexTestInfo: ApexTestMethod[] = new Array(); - // All test methods, has same info as file1, file2, file3, file4 - for (let i = 0; i < 8; i++) { - const methodName = `test${i}`; - const fileName = 'file' + Math.floor(i / 2); // Parent is either file1, file2, file3, or file4 - const definingType = namespace ? `${namespace}.${fileName}` : fileName; - const line = (i / 2) * 4 + 3; - const startPos = new vscode.Position(line, 0); - const endPos = new vscode.Position(line, 5); - const file = `/bogus/path/to/${fileName}.cls`; - const uri = vscode.Uri.file(file); - const location = new vscode.Location( - uri, - new vscode.Range(startPos, endPos) - ); - const testInfo: ApexTestMethod = { - methodName, - definingType, - location - }; - apexTestInfo.push(testInfo); - } - return apexTestInfo; -}; diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testJSONOutputs.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testJSONOutputs.ts deleted file mode 100644 index 9262d36200..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testJSONOutputs.ts +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { - ApexTestResultData, - ApexTestResultOutcome -} from '@salesforce/apex-node'; -import * as vscode from 'vscode'; -import { FAIL_RESULT, PASS_RESULT } from '../../../src/constants'; - -export const apexLibOneFileSummary = { - outcome: PASS_RESULT, - testsRan: 1, - passing: 1, - failing: 0, - skipped: 0, - passRate: '100%', - failRate: '0%', - skipRate: '0%', - testStartTime: 'Now', - testExecutionTimeInMs: 'Later', - testTotalTimeInMs: 'two', - commandTime: '12', - hostname: 'salesforce', - orgId: 'org', - username: 'name', - testRunId: '1', - userId: '1' -}; - -export const apexLibMultipleSummary = { - outcome: FAIL_RESULT, - testsRan: 3, - passing: 2, - failing: 1, - skipped: 0, - passRate: '66%', - failRate: '33%', - skipRate: '0%', - testStartTime: 'Now', - testExecutionTimeInMs: 'Later', - testTotalTimeInMs: 'two', - commandTime: '12', - hostname: 'salesforce', - orgId: 'org', - username: 'name', - testRunId: '1', - userId: '1' -}; - -const apexLibClass = { - id: 'fakeId', - name: 'file0', - namespacePrefix: '', - fullName: 'file0' -}; - -const apexLibOneFileTests: ApexTestResultData[] = [ - { - apexClass: apexLibClass, - methodName: 'test0', - outcome: ApexTestResultOutcome.Pass, - runTime: 1, - message: '', - stackTrace: '', - fullName: 'file0.test0', - id: '0000x1432', - queueItemId: '0000QUEUE', - asyncApexJobId: '0000JOBID', - apexLogId: '000LogID', - testTimestamp: '00:00:000' - } -]; - -const apexLibMultipleTests: ApexTestResultData[] = [ - { - apexClass: apexLibClass, - methodName: 'test0', - outcome: ApexTestResultOutcome.Pass, - runTime: 1, - message: '', - stackTrace: '', - fullName: 'file0.test0', - id: '0000x1432', - queueItemId: '0000QUEUE', - asyncApexJobId: '0000JOBID', - apexLogId: '000LogID', - testTimestamp: '00:00:000' - }, - { - apexClass: apexLibClass, - methodName: 'test1', - outcome: ApexTestResultOutcome.Fail, - runTime: 1, - message: 'System.AssertException: Assertion Failed', - stackTrace: 'Class.fakeClass.test1: line 40, column 1', - fullName: 'file0.test1', - id: '0000x1432', - queueItemId: '0000QUEUE', - asyncApexJobId: '0000JOBID', - apexLogId: '000LogID', - testTimestamp: '00:00:000' - }, - { - apexClass: apexLibClass, - methodName: 'test2', - outcome: ApexTestResultOutcome.Pass, - runTime: 1, - message: '', - stackTrace: '', - fullName: 'file0.test2', - id: '0000x1432', - queueItemId: '0000QUEUE', - asyncApexJobId: '0000JOBID', - apexLogId: '000LogID', - testTimestamp: '00:00:000' - } -]; - -export const apexLibOneFileResult = { - summary: apexLibOneFileSummary, - tests: apexLibOneFileTests -}; - -export const apexLibMultipleResult = { - summary: apexLibMultipleSummary, - tests: apexLibMultipleTests -}; - -const startPos = new vscode.Position(2, 0); -const endPos = new vscode.Position(2, 5); -const location = new vscode.Location( - vscode.Uri.file('path/to/file0'), - new vscode.Range(startPos, endPos) -); -const definingType = 'file0'; -export const apexLibTestInfo = [ - { methodName: 'test0', definingType, location }, - { methodName: 'test1', definingType, location }, - { methodName: 'test2', definingType, location } -]; diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testNamespacedOutputs.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testNamespacedOutputs.ts deleted file mode 100644 index f3f85ebee6..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testNamespacedOutputs.ts +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { - ApexTestResultData, - ApexTestResultOutcome -} from '@salesforce/apex-node'; -import * as vscode from 'vscode'; -import { - apexLibMultipleSummary, - apexLibOneFileSummary -} from './testJSONOutputs'; - -const apexLibClass = { - id: 'fakeId', - name: 'file0', - namespacePrefix: 'tester', - fullName: 'tester.file0' -}; - -const apexLibOneFileTests: ApexTestResultData[] = [ - { - apexClass: apexLibClass, - methodName: 'test0', - outcome: ApexTestResultOutcome.Pass, - runTime: 1, - message: '', - stackTrace: '', - fullName: 'tester.file0.test0', - id: '0000x1432', - queueItemId: '0000QUEUE', - asyncApexJobId: '0000JOBID', - apexLogId: '000LogID', - testTimestamp: '00:00:000' - } -]; - -const apexLibMultipleTests: ApexTestResultData[] = [ - { - apexClass: apexLibClass, - methodName: 'test0', - outcome: ApexTestResultOutcome.Pass, - runTime: 1, - message: '', - stackTrace: '', - fullName: 'tester.file0.test0', - id: '0000x1432', - queueItemId: '0000QUEUE', - asyncApexJobId: '0000JOBID', - apexLogId: '000LogID', - testTimestamp: '00:00:000' - }, - { - apexClass: apexLibClass, - methodName: 'test1', - outcome: ApexTestResultOutcome.Fail, - runTime: 1, - message: 'System.AssertException: Assertion Failed', - stackTrace: 'Class.fakeClass.test1: line 40, column 1', - fullName: 'tester.file0.test1', - id: '0000x1432', - queueItemId: '0000QUEUE', - asyncApexJobId: '0000JOBID', - apexLogId: '000LogID', - testTimestamp: '00:00:000' - }, - { - apexClass: apexLibClass, - methodName: 'test2', - outcome: ApexTestResultOutcome.Pass, - runTime: 1, - message: '', - stackTrace: '', - fullName: 'tester.file0.test2', - id: '0000x1432', - queueItemId: '0000QUEUE', - asyncApexJobId: '0000JOBID', - apexLogId: '000LogID', - testTimestamp: '00:00:000' - } -]; - -export const apexLibNsResult = { - summary: apexLibOneFileSummary, - tests: apexLibOneFileTests -}; - -export const apexLibMultipleNsResult = { - summary: apexLibMultipleSummary, - tests: apexLibMultipleTests -}; - -const startPos = new vscode.Position(2, 0); -const endPos = new vscode.Position(2, 5); -const location = new vscode.Location( - vscode.Uri.file('path/to/file0'), - new vscode.Range(startPos, endPos) -); -const definingType = 'tester.file0'; -export const apexLibNsTestInfo = [ - { methodName: 'test0', definingType, location }, - { methodName: 'test1', definingType, location }, - { methodName: 'test2', definingType, location } -]; - -const fakeApexClasses = []; -for (let i = 0; i < 4; i++) { - fakeApexClasses.push({ - attributes: { type: 'FakeType' }, - Id: 'fakeId', - Name: `file${i}`, - NamespacePrefix: 'tester' - }); -} diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testOutline.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testOutline.test.ts deleted file mode 100644 index 712ba33c40..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testOutline.test.ts +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// tslint:disable:no-unused-expression -import { SfCommandlet } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as events from 'events'; -import * as fs from 'fs'; -import { createSandbox, SinonSandbox, SinonSpy, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { - APEX_GROUP_RANGE, - APEX_TESTS, - FAIL_RESULT, - PASS_RESULT -} from '../../../src/constants'; -import { - ClientStatus, - LanguageClientUtils -} from '../../../src/languageUtils/languageClientUtils'; -import { nls } from '../../../src/messages'; -import * as settings from '../../../src/settings'; -import { apexTestRunCacheService } from '../../../src/testRunCache'; -import { ApexTestMethod } from '../../../src/views/lspConverter'; -import { - ApexTestGroupNode, - ApexTestNode, - ApexTestOutlineProvider -} from '../../../src/views/testOutlineProvider'; -import { ApexTestRunner, TestRunType } from '../../../src/views/testRunner'; -import { generateApexTestMethod } from './testDataUtil'; -import { - apexLibMultipleResult, - apexLibOneFileResult, - apexLibTestInfo -} from './testJSONOutputs'; - -const NO_TESTS_DESCRIPTION = nls.localize('test_view_no_tests_description'); - -describe('TestView', () => { - let testOutline: ApexTestOutlineProvider; - const apexTestInfo: ApexTestMethod[] = generateApexTestMethod(); - const sb: SinonSandbox = createSandbox(); - - afterEach(() => { - sb.restore(); - }); - - describe('Code Coverage', () => { - let commandletSpy: SinonSpy; - let getCoverageStub: SinonStub; - let languageClientUtils: LanguageClientUtils; - - beforeEach(() => { - commandletSpy = sb.spy(SfCommandlet.prototype, 'run'); - getCoverageStub = sb.stub(settings, 'retrieveTestCodeCoverage'); - languageClientUtils = LanguageClientUtils.getInstance(); - languageClientUtils.setStatus(ClientStatus.Ready, 'Apex client is ready'); - }); - - it('Should honor code coverage setting with Apex Library', async () => { - const testRunner = new ApexTestRunner(testOutline); - getCoverageStub.onFirstCall().returns(true); - getCoverageStub.onSecondCall().returns(false); - - await testRunner.runApexTests(['MyTestTrue'], TestRunType.Method); - let { executor } = commandletSpy.getCall(0).thisValue; - expect(executor.codeCoverage).to.be.true; - - await testRunner.runApexTests(['MyTestFalse'], TestRunType.Method); - executor = commandletSpy.getCall(1).thisValue.executor; - expect(executor.codeCoverage).to.be.false; - }); - }); - - describe('Runtest caching for re-run', () => { - const testRunner = new ApexTestRunner(testOutline); - const testMethod = 'MyTestMethod'; - const testClass = 'MyTestClass'; - const testRunAll = 'RunAll'; - let languageClientUtils: LanguageClientUtils; - - beforeEach(() => { - languageClientUtils = LanguageClientUtils.getInstance(); - languageClientUtils.setStatus(ClientStatus.Ready, 'Apex client is ready'); - }); - - it('Should cache the last run test method', async () => { - // apexTestRunCacheService is a singleton which means the values need to be - // reset back to their default values otherwise they'll be set by the earlier - // calls testRunner.runApexTests in this test suite - await apexTestRunCacheService.setCachedClassTestParam(''); - await apexTestRunCacheService.setCachedMethodTestParam(''); - await testRunner.runApexTests([`${testMethod}`], TestRunType.Method); - expect(apexTestRunCacheService.getLastMethodTestParam()).to.eq( - testMethod - ); - // the test class value should remain unchanged - expect(apexTestRunCacheService.getLastClassTestParam()).to.eq(''); - }); - it('Should cache the last run test class', async () => { - await testRunner.runApexTests([`${testClass}`], TestRunType.Class); - expect(apexTestRunCacheService.getLastClassTestParam()).to.eq(testClass); - // the test method value should remain unchanged - expect(apexTestRunCacheService.getLastMethodTestParam()).to.eq( - testMethod - ); - }); - it('Should not change last run class or method when all tests are selected', async () => { - await testRunner.runApexTests([`${testRunAll}`], TestRunType.All); - expect(apexTestRunCacheService.getLastClassTestParam()).to.eq(testClass); - expect(apexTestRunCacheService.getLastMethodTestParam()).to.eq( - testMethod - ); - }); - }); - - describe('Get Tests and Create Tree', () => { - it('Should add no tests', () => { - testOutline = new ApexTestOutlineProvider(null); - const expected = new ApexTestGroupNode(APEX_TESTS, null); - expected.description = NO_TESTS_DESCRIPTION; - expect(testOutline.getHead()).to.deep.equal( - new ApexTestGroupNode(APEX_TESTS, null) - ); - }); - - it('Should create one test and one class', () => { - testOutline = new ApexTestOutlineProvider(apexTestInfo.slice(0, 1)); - if (testOutline.getHead()) { - expect(testOutline.getHead().name).to.equal(APEX_TESTS); - expect(testOutline.getHead().children.length).to.equal(1); - const testChildGroup = testOutline.getHead().children[0]; - expect(testChildGroup).instanceof(ApexTestGroupNode); - const groupLocation = new vscode.Location( - apexTestInfo[0].location.uri, - APEX_GROUP_RANGE - ); - expect(testChildGroup.location).to.deep.equal(groupLocation); - expect(testChildGroup.name).to.equal(apexTestInfo[0].definingType); - expect(testChildGroup.children.length).to.equal(1); - const testChild = testChildGroup.children[0]; - const fullName = - apexTestInfo[0].definingType + '.' + apexTestInfo[0].methodName; - expect(testChild.name).to.deep.equal(fullName); - expect(testChild.location).to.deep.equal(apexTestInfo[0].location); - expect( - testOutline.getTestClassName(apexTestInfo[0].location.uri) - ).to.equal(apexTestInfo[0].definingType); - } - }); - - it('Should update tests with 8 tests and 4 classes', () => { - testOutline = new ApexTestOutlineProvider(apexTestInfo); - if (testOutline.getHead()) { - expect(testOutline.getHead().children.length).to.equal(4); - let i = 0; - for (const testChildGroup of testOutline.getHead().children) { - const testInfo1 = apexTestInfo[i]; - i++; - const testInfo2 = apexTestInfo[i]; - expect(testChildGroup.children.length).to.equal(2); // Each group has two children - expect(testChildGroup.name).to.equal(testInfo1.definingType); - const groupLocation = new vscode.Location( - testInfo1.location.uri, - APEX_GROUP_RANGE - ); - expect(testChildGroup.location).to.deep.equal(groupLocation); - // Check child test - const test1 = testChildGroup.children[0]; - const test2 = testChildGroup.children[1]; - const fullName1 = testInfo1.definingType + '.' + testInfo1.methodName; - const fullName2 = testInfo2.definingType + '.' + testInfo2.methodName; - expect(test1.name).to.equal(fullName1); - expect(test2.name).to.equal(fullName2); - expect(test1.location).to.deep.equal(testInfo1.location); - expect(test2.location).to.deep.equal(testInfo2.location); - i++; - - expect(testOutline.getTestClassName(testInfo1.location.uri)).to.equal( - testInfo1.definingType - ); - expect(testOutline.getTestClassName(testInfo2.location.uri)).to.equal( - testInfo2.definingType - ); - } - } - }); - - it('Should index test classes', () => { - const pos = new vscode.Position(0, 0); - testOutline = new ApexTestOutlineProvider([ - { - definingType: 'Test1', - methodName: 'validate1', - location: { - uri: vscode.Uri.file('/force-app/test/Test1.cls'), - range: new vscode.Range(pos, pos) - } - }, - { - definingType: 'Test1', - methodName: 'validate2', - location: { - uri: vscode.Uri.file('/force-app/test/Test1.cls'), - range: new vscode.Range(pos, pos) - } - }, - { - definingType: 'Test2', - methodName: 'verify', - location: { - uri: vscode.Uri.file('/force-app/test/Test2.cls'), - range: new vscode.Range(pos, pos) - } - } - ]); - - expect( - testOutline.getTestClassName( - vscode.Uri.file('/force-app/test/Test1.cls') - ) - ).to.equal('Test1'); - expect( - testOutline.getTestClassName( - vscode.Uri.file('/force-app/test/Test2.cls') - ) - ).to.equal('Test2'); - expect( - testOutline.getTestClassName( - vscode.Uri.file('/force-app/test/Test3.cls') - ) - ).to.be.undefined; - }); - }); - - describe('Read JSON file and update tests', () => { - let readFolderStub: SinonStub; - let readFileStub: SinonStub; - let parseJSONStub: SinonStub; - - beforeEach(() => { - readFolderStub = sb.stub(fs, 'readdirSync'); - readFolderStub.callsFake(folderName => { - return ['test-result.json']; - }); - readFileStub = sb.stub(fs, 'readFileSync'); - readFileStub.callsFake(fileName => { - return 'nonsense'; - }); - parseJSONStub = sb.stub(JSON, 'parse'); - }); - - it('Should update single test with Pass result using Apex library', () => { - parseJSONStub.callsFake(() => { - return apexLibOneFileResult; - }); - - testOutline = new ApexTestOutlineProvider(apexTestInfo.slice(0, 1)); - testOutline.updateTestResults('oneFilePass'); - const testGroupNode = testOutline.getHead() - .children[0] as ApexTestGroupNode; - expect(testGroupNode.passing).to.equal(1); - const testNode = testGroupNode.children[0] as ApexTestNode; - expect(testNode.outcome).to.equal(PASS_RESULT); - }); - - it('Should update tests and test groups with passing/failing tests using Apex library', () => { - parseJSONStub.callsFake(() => { - return apexLibMultipleResult; - }); - testOutline = new ApexTestOutlineProvider(apexLibTestInfo); - testOutline.updateTestResults('multipleFilesMixed'); - - expect(testOutline.getHead().children.length).to.equal(1); - const groupNode = testOutline.getHead().children[0] as ApexTestGroupNode; - expect(groupNode.passing).to.eql(2); - expect(groupNode.failing).to.eql(1); - - expect(groupNode.children[0].name).to.equal('file0.test0'); - expect((groupNode.children[0] as ApexTestNode).outcome).to.equal( - PASS_RESULT - ); - expect(groupNode.children[1].name).to.equal('file0.test1'); - expect((groupNode.children[1] as ApexTestNode).outcome).to.equal( - FAIL_RESULT - ); - expect(groupNode.children[2].name).to.equal('file0.test2'); - expect((groupNode.children[2] as ApexTestNode).outcome).to.equal( - PASS_RESULT - ); - }); - }); - - describe('Navigate to test definition or error', () => { - let readFolderStub: SinonStub; - let readFileStub: SinonStub; - let parseJSONStub: SinonStub; - let showTextDocumentStub: SinonStub; - let eventEmitterStub: SinonStub; - - let testRunner: ApexTestRunner; - const eventEmitter = new events.EventEmitter(); - - beforeEach(() => { - readFolderStub = sb.stub(fs, 'readdirSync'); - readFolderStub.callsFake(folderName => ['test-result.json']); - readFileStub = sb.stub(fs, 'readFileSync'); - readFileStub.callsFake(fileName => 'nonsense'); - parseJSONStub = sb.stub(JSON, 'parse'); - parseJSONStub.callsFake(() => apexLibMultipleResult); - eventEmitterStub = sb.stub(eventEmitter, 'emit'); - showTextDocumentStub = sb.stub(vscode.window, 'showTextDocument'); - showTextDocumentStub.returns(Promise.resolve()); - - testOutline = new ApexTestOutlineProvider(apexTestInfo); - testOutline.updateTestResults('multipleFilesMixed'); - testRunner = new ApexTestRunner(testOutline, eventEmitter); - }); - - it('Should go to definition if a test does not have an error message', async () => { - const testNode = new ApexTestNode('sampleTest', apexTestInfo[0].location); - const testRange = testNode.location!.range; - - await testRunner.showErrorMessage(testNode); - - // make sure we emit the update_selection event with the correct position - expect(eventEmitterStub.getCall(0).args).to.be.deep.equal([ - 'sf:update_selection', - testRange - ]); - }); - - it('Should go to error if a test has one', async () => { - const lineFailure = 22; - const testNode = new ApexTestNode('failedTest', apexTestInfo[0].location); - testNode.errorMessage = 'System.AssertException: Assertion Failed'; - testNode.stackTrace = `Class.fakeClass.test0: line ${lineFailure}, column 1`; - - await testRunner.showErrorMessage(testNode); - - expect(eventEmitterStub.getCall(0).args).to.be.deep.equal([ - 'sf:update_selection', - lineFailure - 1 - ]); - }); - - it('Should go to error of first failing test in a failed test class', async () => { - const testClass = testOutline.getHead().children[0] as ApexTestGroupNode; - const lineFailure = 40; // first failure in apexLibMultipleResult.apexLibMultipleTests - - await testRunner.showErrorMessage(testClass); - - expect(eventEmitterStub.getCall(0).args).to.be.deep.equal([ - 'sf:update_selection', - lineFailure - 1 - ]); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testOutlineNamespace.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testOutlineNamespace.test.ts deleted file mode 100644 index 5fbdad1687..0000000000 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/views/testOutlineNamespace.test.ts +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as events from 'events'; -import * as fs from 'fs'; -import { createSandbox, SinonSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { - APEX_GROUP_RANGE, - APEX_TESTS, - FAIL_RESULT, - PASS_RESULT -} from '../../../src/constants'; -import { ApexTestMethod } from '../../../src/views/lspConverter'; -import { - ApexTestGroupNode, - ApexTestNode, - ApexTestOutlineProvider -} from '../../../src/views/testOutlineProvider'; -import { ApexTestRunner } from '../../../src/views/testRunner'; -import { generateApexTestMethod } from './testDataUtil'; -import { - apexLibMultipleNsResult, - apexLibNsResult, - apexLibNsTestInfo -} from './testNamespacedOutputs'; - -describe('Test View with namespace', () => { - let testOutline: ApexTestOutlineProvider; - const apexNamespacedTestInfo: ApexTestMethod[] = - generateApexTestMethod('tester'); - - describe('Get Tests and Create Tree', () => { - it('Should create one test and one class when using namespace', () => { - testOutline = new ApexTestOutlineProvider( - apexNamespacedTestInfo.slice(0, 1) - ); - if (testOutline.getHead()) { - expect(testOutline.getHead().name).to.equal(APEX_TESTS); - expect(testOutline.getHead().children.length).to.equal(1); - const testChildGroup = testOutline.getHead().children[0]; - expect(testChildGroup).instanceof(ApexTestGroupNode); - const groupLocation = new vscode.Location( - apexNamespacedTestInfo[0].location.uri, - APEX_GROUP_RANGE - ); - expect(testChildGroup.location).to.deep.equal(groupLocation); - expect(testChildGroup.name).to.equal( - apexNamespacedTestInfo[0].definingType - ); - expect(testChildGroup.children.length).to.equal(1); - const testChild = testChildGroup.children[0]; - const fullName = - apexNamespacedTestInfo[0].definingType + - '.' + - apexNamespacedTestInfo[0].methodName; - expect(testChild.name).to.deep.equal(fullName); - expect(testChild.location).to.deep.equal( - apexNamespacedTestInfo[0].location - ); - } - }); - - it('Should update tests with 8 tests and 4 classes when using namespace', () => { - testOutline = new ApexTestOutlineProvider(apexNamespacedTestInfo); - if (testOutline.getHead()) { - expect(testOutline.getHead().children.length).to.equal(4); - let i = 0; - for (const testChildGroup of testOutline.getHead().children) { - const testInfo1 = apexNamespacedTestInfo[i]; - i++; - const testInfo2 = apexNamespacedTestInfo[i]; - expect(testChildGroup.children.length).to.equal(2); // Each group has two children - expect(testChildGroup.name).to.equal(testInfo1.definingType); - const groupLocation = new vscode.Location( - testInfo1.location.uri, - APEX_GROUP_RANGE - ); - expect(testChildGroup.location).to.deep.equal(groupLocation); - // Check child test - const test1 = testChildGroup.children[0]; - const test2 = testChildGroup.children[1]; - const fullName1 = testInfo1.definingType + '.' + testInfo1.methodName; - const fullName2 = testInfo2.definingType + '.' + testInfo2.methodName; - expect(test1.name).to.equal(fullName1); - expect(test2.name).to.equal(fullName2); - expect(test1.location).to.deep.equal(testInfo1.location); - expect(test2.location).to.deep.equal(testInfo2.location); - i++; - } - } - }); - }); - - describe('Read JSON file and update tests', () => { - let readFolderStub: SinonStub; - let readFileStub: SinonStub; - let parseJSONStub: SinonStub; - let sb: SinonSandbox; - - beforeEach(() => { - sb = createSandbox(); - readFolderStub = sb.stub(fs, 'readdirSync'); - readFolderStub.callsFake(folderName => { - return ['test-result.json']; - }); - readFileStub = sb.stub(fs, 'readFileSync'); - readFileStub.callsFake(fileName => { - return 'nonsense'; - }); - parseJSONStub = sb.stub(JSON, 'parse'); - }); - - afterEach(() => { - sb.restore(); - }); - - it('Should update single test with Pass result using Apex library', () => { - parseJSONStub.callsFake(() => { - return apexLibNsResult; - }); - testOutline = new ApexTestOutlineProvider( - apexNamespacedTestInfo.slice(0, 1) - ); - testOutline.updateTestResults('oneFilePass'); - const testGroupNode = testOutline.getHead() - .children[0] as ApexTestGroupNode; - expect(testGroupNode.passing).to.equal(1); - const testNode = testGroupNode.children[0] as ApexTestNode; - expect(testNode.outcome).to.equal(PASS_RESULT); - }); - - it('Should update tests and test groups with passing/failing results using Apex library', async () => { - parseJSONStub.callsFake(() => { - return apexLibMultipleNsResult; - }); - testOutline = new ApexTestOutlineProvider(apexLibNsTestInfo); - testOutline.updateTestResults('multipleFilesMixed'); - - expect(testOutline.getHead().children.length).to.equal(1); - const groupNode = testOutline.getHead().children[0] as ApexTestGroupNode; - expect(groupNode.passing).to.eql(2); - expect(groupNode.failing).to.eql(1); - - expect(groupNode.children[0].name).to.equal('tester.file0.test0'); - expect((groupNode.children[0] as ApexTestNode).outcome).to.equal( - PASS_RESULT - ); - expect(groupNode.children[1].name).to.equal('tester.file0.test1'); - expect((groupNode.children[1] as ApexTestNode).outcome).to.equal( - FAIL_RESULT - ); - expect(groupNode.children[2].name).to.equal('tester.file0.test2'); - expect((groupNode.children[2] as ApexTestNode).outcome).to.equal( - PASS_RESULT - ); - }); - }); - - describe('Navigate to test definition or error', () => { - let readFolderStub: SinonStub; - let readFileStub: SinonStub; - let parseJSONStub: SinonStub; - let showTextDocumentStub: SinonStub; - let eventEmitterStub: SinonStub; - let sb: SinonSandbox; - let testRunner: ApexTestRunner; - const eventEmitter = new events.EventEmitter(); - - beforeEach(() => { - sb = createSandbox(); - readFolderStub = sb.stub(fs, 'readdirSync'); - readFolderStub.callsFake(folderName => ['test-result.json']); - readFileStub = sb.stub(fs, 'readFileSync'); - readFileStub.callsFake(fileName => 'nonsense'); - parseJSONStub = sb.stub(JSON, 'parse'); - parseJSONStub.callsFake(() => apexLibMultipleNsResult); - eventEmitterStub = sb.stub(eventEmitter, 'emit'); - showTextDocumentStub = sb.stub(vscode.window, 'showTextDocument'); - showTextDocumentStub.returns(Promise.resolve()); - - testOutline = new ApexTestOutlineProvider(apexNamespacedTestInfo); - testOutline.updateTestResults('multipleFilesMixed'); - testRunner = new ApexTestRunner(testOutline, eventEmitter); - }); - - afterEach(() => { - sb.restore(); - }); - - it('Should go to definition if a test does not have an error message', async () => { - const testNode = new ApexTestNode( - 'sampleTest', - apexNamespacedTestInfo[0].location - ); - const testRange = testNode.location!.range; - - await testRunner.showErrorMessage(testNode); - - // make sure we emit the update_selection event with the correct position - expect(eventEmitterStub.getCall(0).args).to.be.deep.equal([ - 'sf:update_selection', - testRange - ]); - }); - - it('Should go to error if a test has one', async () => { - const lineFailure = 22; - const testNode = new ApexTestNode( - 'failedTest', - apexNamespacedTestInfo[0].location - ); - testNode.errorMessage = 'System.AssertException: Assertion Failed'; - testNode.stackTrace = `Class.fakeClass.test0: line ${lineFailure}, column 1`; - - await testRunner.showErrorMessage(testNode); - - expect(eventEmitterStub.getCall(0).args).to.be.deep.equal([ - 'sf:update_selection', - lineFailure - 1 - ]); - }); - - it('Should go to error of first failing test in a failed test class', async () => { - const testClass = testOutline.getHead().children[0] as ApexTestGroupNode; - const lineFailure = 40; // first failure in apexLibMultipleNsResult.apexLibMultipleTests - - await testRunner.showErrorMessage(testClass); - - expect(eventEmitterStub.getCall(0).args).to.be.deep.equal([ - 'sf:update_selection', - lineFailure - 1 - ]); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/aliasList.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/aliasList.test.ts deleted file mode 100644 index 84d0be3a77..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/aliasList.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { AliasList } from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Alias List', () => { - it('Should build the alias list command', async () => { - const aliasList = new AliasList(); - const aliasListCommand = aliasList.build({}); - expect(aliasListCommand.toCommand()).to.equal('sf alias:list'); - expect(aliasListCommand.description).to.equal( - nls.localize('alias_list_text') - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/authParameterGatherer.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/authParameterGatherer.test.ts deleted file mode 100644 index ca7e28ddfb..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/authParameterGatherer.test.ts +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { assert, createSandbox, match, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { - AccessTokenParamsGatherer, - DEFAULT_ALIAS, - INSTANCE_URL_PLACEHOLDER -} from '../../../../src/commands'; -import { nls } from '../../../../src/messages'; - -const sandbox = createSandbox(); - -describe('Auth Parameter Gatherer', () => { - describe('Access Token Params Gatherer', () => { - let inputStub: SinonStub; - let gatherer: AccessTokenParamsGatherer; - const mockInputInstanceUrl = 'https://na42.salesforce.com'; - const mockInputAlias = 'myOrg'; - const mockInputAccessToken = 'mockAccessToken'; - const setGathererBehavior = ( - instanceUrl: string | undefined, - alias: string | undefined, - accessToken: string | undefined - ) => { - inputStub.onCall(0).returns(instanceUrl); - inputStub.onCall(1).returns(alias); - inputStub.onCall(2).returns(accessToken); - }; - beforeEach(() => { - gatherer = new AccessTokenParamsGatherer(); - inputStub = sandbox.stub(vscode.window, 'showInputBox'); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('Should return Cancel if instance URL is undefined', async () => { - setGathererBehavior(undefined, undefined, undefined); - const response = await gatherer.gather(); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Cancel if instance URL is invalid', async () => { - setGathererBehavior('invalidUrl', undefined, undefined); - const response = await gatherer.gather(); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Cancel if alias is undefined', async () => { - setGathererBehavior(mockInputInstanceUrl, undefined, undefined); - const response = await gatherer.gather(); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Cancel if access token is undefined', async () => { - setGathererBehavior(mockInputInstanceUrl, mockInputAlias, undefined); - const response = await gatherer.gather(); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return show localized prompts and placeholders', async () => { - setGathererBehavior( - mockInputInstanceUrl, - mockInputAlias, - mockInputAccessToken - ); - const response = await gatherer.gather(); - assert.calledWith( - inputStub, - match({ - prompt: nls.localize('parameter_gatherer_enter_instance_url'), - placeHolder: INSTANCE_URL_PLACEHOLDER, - ignoreFocusOut: true - }) - ); - assert.calledWith( - inputStub, - match({ - prompt: nls.localize('parameter_gatherer_enter_alias_name'), - placeHolder: DEFAULT_ALIAS, - ignoreFocusOut: true - }) - ); - assert.calledWith( - inputStub, - match({ - prompt: nls.localize('parameter_gatherer_enter_session_id'), - placeHolder: nls.localize( - 'parameter_gatherer_enter_session_id_placeholder' - ), - ignoreFocusOut: true - }) - ); - }); - - it('Should return Continue if user has input instance url, alias and access token', async () => { - setGathererBehavior( - mockInputInstanceUrl, - mockInputAlias, - mockInputAccessToken - ); - const response = await gatherer.gather(); - expect(response).to.eql({ - type: 'CONTINUE', - data: { - instanceUrl: mockInputInstanceUrl, - alias: mockInputAlias, - accessToken: mockInputAccessToken - } - }); - }); - - it('Should return Continue if user has input instance url, empty alias and access token', async () => { - setGathererBehavior(mockInputInstanceUrl, '', mockInputAccessToken); - const response = await gatherer.gather(); - expect(response).to.eql({ - type: 'CONTINUE', - data: { - instanceUrl: mockInputInstanceUrl, - alias: DEFAULT_ALIAS, - accessToken: mockInputAccessToken - } - }); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginAccessToken.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginAccessToken.test.ts deleted file mode 100644 index b5f5dd4edc..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginAccessToken.test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { AuthInfo } from '@salesforce/core'; -import { assert, createSandbox, SinonStub } from 'sinon'; -import { channelService } from '../../../../src/channels/index'; -import { - AccessTokenParamsGatherer, - orgLoginAccessToken -} from '../../../../src/commands'; -import { SfWorkspaceChecker } from '../../../../src/commands/util'; -import { nls } from '../../../../src/messages'; - -const sandbox = createSandbox(); - -describe('Org Login Access Token', () => { - let workspaceCheckerStub: SinonStub; - let accessTokenParamsGathererStub: SinonStub; - let authInfoCreateStub: SinonStub; - let handleAliasAndDefaultSettingsStub: SinonStub; - let channelServiceStub: SinonStub; - const mockAccessToken = 'mockAccessToken'; - const mockAlias = 'mockAlias'; - const mockInstanceUrl = 'https://na42.salesforce.com'; - - beforeEach(() => { - workspaceCheckerStub = sandbox.stub(SfWorkspaceChecker.prototype, 'check'); - workspaceCheckerStub.returns(true); - accessTokenParamsGathererStub = sandbox.stub( - AccessTokenParamsGatherer.prototype, - 'gather' - ); - accessTokenParamsGathererStub.returns({ - type: 'CONTINUE', - data: { - accessToken: mockAccessToken, - alias: mockAlias, - instanceUrl: mockInstanceUrl - } - }); - authInfoCreateStub = sandbox.stub(AuthInfo, 'create'); - authInfoCreateStub.returns( - new AuthInfo({ - accessTokenOptions: { - accessToken: mockAccessToken, - instanceUrl: mockInstanceUrl - } - }) - ); - handleAliasAndDefaultSettingsStub = sandbox - .stub(AuthInfo.prototype, 'handleAliasAndDefaultSettings') - .resolves(); - channelServiceStub = sandbox.stub(channelService, 'appendLine'); - }); - afterEach(() => { - sandbox.restore(); - }); - - it('Should create and save auth info', async () => { - await orgLoginAccessToken(); - assert.calledOnce(authInfoCreateStub); - assert.calledWith(authInfoCreateStub, { - accessTokenOptions: { - accessToken: mockAccessToken, - instanceUrl: mockInstanceUrl - } - }); - - assert.calledWith(handleAliasAndDefaultSettingsStub, { - alias: mockAlias, - setDefault: true, - setDefaultDevHub: false - }); - }); - - it('Should show a user friendly message on Bad_OAuth_Token', async () => { - authInfoCreateStub.callsFake(() => { - throw new Error( - 'Could not retrieve the username after successful auth code exchange.\nDue to: Bad_OAuth_Token' - ); - }); - - await orgLoginAccessToken(); - - assert.calledOnce(channelServiceStub); - assert.calledWith( - channelServiceStub, - nls.localize('org_login_access_token_bad_oauth_token_message') - ); - assert.notCalled(handleAliasAndDefaultSettingsStub); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWeb.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWeb.test.ts deleted file mode 100644 index 2d91739d69..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWeb.test.ts +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - AuthParamsGatherer, - createOrgLoginWebExecutor, - DEFAULT_ALIAS, - DeviceCodeResponse, - OrgLoginWebContainerExecutor, - OrgLoginWebDemoModeExecutor, - OrgLoginWebExecutor, - OrgTypeItem, - PRODUCTION_URL, - SANDBOX_URL -} from '../../../../src/commands'; -import { nls } from '../../../../src/messages'; - -const TEST_ALIAS = 'testAlias'; -const TEST_URL = 'https://my.testdomain.salesforce.com'; - -// tslint:disable:no-unused-expression -describe('Org Login Web', () => { - it('Should build the org login web login command', async () => { - const orgLoginWeb = new OrgLoginWebExecutor(); - const orgLoginWebCommand = orgLoginWeb.build({ - alias: TEST_ALIAS, - loginUrl: TEST_URL - }); - expect(orgLoginWebCommand.toCommand()).to.equal( - `sf org:login:web --alias ${TEST_ALIAS} --instance-url ${TEST_URL} --set-default` - ); - expect(orgLoginWebCommand.description).to.equal( - nls.localize('org_login_web_authorize_org_text') - ); - }); -}); - -describe('Org Login Web in Demo Mode', () => { - it('Should build the org login web login command', async () => { - const orgLoginWeb = new OrgLoginWebDemoModeExecutor(); - const orgLoginWebCommand = orgLoginWeb.build({ - alias: TEST_ALIAS, - loginUrl: TEST_URL - }); - expect(orgLoginWebCommand.toCommand()).to.equal( - `sf org:login:web --alias ${TEST_ALIAS} --instance-url ${TEST_URL} --set-default --no-prompt --json` - ); - expect(orgLoginWebCommand.description).to.equal( - nls.localize('org_login_web_authorize_org_text') - ); - }); -}); - -describe('Auth Params Gatherer', () => { - let inputBoxSpy: sinon.SinonStub; - let quickPickStub: sinon.SinonStub; - let getProjectUrlStub: sinon.SinonStub; - - let gatherer: AuthParamsGatherer; - - const setGathererBehavior = ( - orgType: OrgTypeItem | undefined, - customUrl: string | undefined, - orgAlias: string | undefined - ) => { - quickPickStub.returns(orgType); - let inputBoxCall = 0; - if (orgType && orgType === gatherer.orgTypes.custom) { - inputBoxSpy.onCall(inputBoxCall).returns(customUrl); - inputBoxCall += 1; - } - inputBoxSpy.onCall(inputBoxCall).returns(orgAlias); - }; - - beforeEach(() => { - gatherer = new AuthParamsGatherer(); - inputBoxSpy = sinon.stub(vscode.window, 'showInputBox'); - quickPickStub = sinon.stub(vscode.window, 'showQuickPick'); - getProjectUrlStub = sinon - .stub(gatherer, 'getProjectLoginUrl') - .returns(TEST_URL); - }); - - afterEach(() => { - inputBoxSpy.restore(); - quickPickStub.restore(); - getProjectUrlStub.restore(); - }); - - describe('Org Type Quick Pick Selection', () => { - it('Should return Cancel if org type selection is undefined', async () => { - setGathererBehavior(undefined, undefined, undefined); - const response = await gatherer.gather(); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should not give Project Default option is sfdcLoginUrl property doesn’t exist', async () => { - getProjectUrlStub.returns(undefined); - const items = await gatherer.getQuickPickItems(); - const { label } = gatherer.orgTypes.project; - expect(items.length).to.equal(3); - expect(items.some(i => i.label === label)).to.be.false; - }); - - it('Should return Continue with sfdcLoginUrl if Project Default is chosen', async () => { - setGathererBehavior(gatherer.orgTypes.project, undefined, ''); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.loginUrl).to.equal(TEST_URL); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should return Cancel if custom loginUrl is undefined', async () => { - setGathererBehavior(gatherer.orgTypes.custom, undefined, ''); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Continue with inputted URL if custom URL user input is not undefined or empty', async () => { - setGathererBehavior(gatherer.orgTypes.custom, TEST_URL, ''); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledTwice).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.loginUrl).to.equal(TEST_URL); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should consider URL invalid if it does not begin with http:// or https://', async () => { - expect(AuthParamsGatherer.validateUrl('http://example.com')).to.be.null; - expect(AuthParamsGatherer.validateUrl('https://example.com')).to.be.null; - expect(AuthParamsGatherer.validateUrl('example.com')).to.be.not.null; - }); - - it('Should return Continue with production URL if Production option is chosen', async () => { - setGathererBehavior(gatherer.orgTypes.production, undefined, ''); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.loginUrl).to.equal(PRODUCTION_URL); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should return Continue with sandbox URL if Sandbox option is chosen', async () => { - setGathererBehavior(gatherer.orgTypes.sandbox, undefined, ''); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.loginUrl).to.equal(SANDBOX_URL); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - }); - - describe('Org Alias Input', () => { - it('Should return Cancel if alias is undefined', async () => { - setGathererBehavior(gatherer.orgTypes.production, undefined, undefined); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Continue with default alias if user input is empty string', async () => { - setGathererBehavior(gatherer.orgTypes.production, undefined, ''); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.alias).to.equal(DEFAULT_ALIAS); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should return Continue with inputted alias if user input is not undefined or empty', async () => { - setGathererBehavior(gatherer.orgTypes.production, undefined, TEST_ALIAS); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.alias).to.equal(TEST_ALIAS); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - }); -}); - -describe('Org Login Web is based on environment variables', () => { - describe('in demo mode', () => { - let originalValue: any; - - beforeEach(() => { - originalValue = process.env.SFDX_ENV; - }); - - afterEach(() => { - process.env.SFDX_ENV = originalValue; - }); - - it('Should use OrgLoginWebDevHubDemoModeExecutor if demo mode is true', () => { - process.env.SFDX_ENV = 'DEMO'; - expect(createOrgLoginWebExecutor() instanceof OrgLoginWebDemoModeExecutor) - .to.be.true; - }); - - it('Should use OrgLoginWebDevHubExecutor if demo mode is false', () => { - process.env.SFDX_ENV = ''; - expect(createOrgLoginWebExecutor() instanceof OrgLoginWebExecutor).to.be - .true; - }); - }); - - describe('in container mode', () => { - afterEach(() => { - delete process.env.SF_CONTAINER_MODE; - }); - - it('Should use OrgLoginWebExecutor when container mode is not defined', () => { - expect(createOrgLoginWebExecutor() instanceof OrgLoginWebExecutor).to.be - .true; - }); - - it('Should use OrgLoginWebExecutor when container mode is empty', () => { - process.env.SF_CONTAINER_MODE = ''; - expect(createOrgLoginWebExecutor() instanceof OrgLoginWebExecutor).to.be - .true; - }); - - it('Should use OrgLoginWebContainerExecutor when container mode is defined', () => { - process.env.SF_CONTAINER_MODE = 'true'; - expect( - createOrgLoginWebExecutor() instanceof OrgLoginWebContainerExecutor - ).to.be.true; - }); - - it('should build the org:login:device command', () => { - const orgLoginWeb = new OrgLoginWebContainerExecutor(); - const orgLoginWebCommand = orgLoginWeb.build({ - alias: TEST_ALIAS, - loginUrl: TEST_URL - }); - expect(orgLoginWebCommand.toCommand()).to.equal( - `sf org:login:device --alias ${TEST_ALIAS} --instance-url ${TEST_URL} --set-default --json` - ); - expect(orgLoginWebCommand.description).to.equal( - nls.localize('org_login_web_authorize_org_text') - ); - }); - }); -}); - -describe('Org Login Web Container', () => { - class TestOrgLoginWebContainer extends OrgLoginWebContainerExecutor { - public deviceCodeReceived = false; - public stdOut = ''; - - public injectResponse(data: string) { - this.handleCliResponse(data); - } - } - - let sb: sinon.SinonSandbox; - let deviceExecutor: TestOrgLoginWebContainer; - const testResponse: Partial = { - user_code: '1234', - verification_uri: 'http://example.com' - }; - - beforeEach(() => { - deviceExecutor = new TestOrgLoginWebContainer(); - - sb = sinon.createSandbox(); - }); - - afterEach(async () => { - sb.restore(); - }); - - it('should open and external link to the correct url', () => { - const openExternal = sb.stub(vscode.env, 'openExternal'); - const responseStr = JSON.stringify(testResponse); - deviceExecutor.injectResponse(responseStr); - - expect(deviceExecutor.stdOut).to.be.equal(responseStr); - expect(openExternal.called).to.be.true; - expect(deviceExecutor.deviceCodeReceived).to.be.true; - - const uri: vscode.Uri = openExternal.getCall(0) - .args as unknown as vscode.Uri; - const targetUrl = uri.toString(); - expect(targetUrl).to.contain(testResponse.verification_uri); - expect(targetUrl).to.contain(testResponse.user_code); - expect(targetUrl).to.contain('user_code'); - expect(targetUrl).to.contain('prompt%3Dlogin'); - }); - - it('should handle partial data from CLI stdOut', () => { - const openExternal = sb.stub(vscode.env, 'openExternal'); - const responseStr1 = '{"user_code":"1234","verification'; - deviceExecutor.injectResponse(responseStr1); - - expect(deviceExecutor.stdOut).to.be.equal(responseStr1); - expect(openExternal.called).to.be.false; - expect(deviceExecutor.deviceCodeReceived).to.be.false; - - const responseStr2 = '_uri":"http://example.com"}'; - deviceExecutor.injectResponse(responseStr2); - expect(deviceExecutor.stdOut).to.be.equal(`${responseStr1}${responseStr2}`); - expect(openExternal.called).to.be.true; - expect(deviceExecutor.deviceCodeReceived).to.be.true; - }); - - it('should not open a browser if CLI responds with unexpected or bad data', () => { - const openExternal = sb.stub(vscode.env, 'openExternal'); - const responseStr = JSON.stringify({ - error: 500, - message: 'something went wrong' - }); - deviceExecutor.injectResponse(responseStr); - - expect(deviceExecutor.stdOut).to.be.equal(responseStr); - expect(openExternal.called).to.be.false; - expect(deviceExecutor.deviceCodeReceived).to.be.false; - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWebDevHub.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWebDevHub.test.ts deleted file mode 100644 index a6a2e5891e..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWebDevHub.test.ts +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ConfigFile } from '@salesforce/core'; -import { - instantiateContext, - restoreContext, - stubContext -} from '@salesforce/core/lib/testSetup'; -import { ConfigSource } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { SinonSandbox, SinonSpy, SinonStub } from 'sinon'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - AuthDevHubParams, - AuthDevHubParamsGatherer, - createAuthDevHubExecutor, - DEFAULT_ALIAS, - OrgLoginWebDevHubContainerExecutor, - OrgLoginWebDevHubDemoModeExecutor, - OrgLoginWebDevHubExecutor -} from '../../../../src/commands'; -import { nls } from '../../../../src/messages'; -import { OrgAuthInfo } from '../../../../src/util'; - -const TEST_ALIAS = 'testAlias'; - -class TestOrgLoginWebDevHubExecutor extends OrgLoginWebDevHubExecutor { - public getShowChannelOutput() { - return this.showChannelOutput; - } -} - -// tslint:disable:no-unused-expression -describe('Org Login Web for Dev Hub', () => { - it('Should build the org login web login command', async () => { - const orgLoginWeb = new OrgLoginWebDevHubExecutor(); - const orgLoginWebCommand = orgLoginWeb.build({ - alias: TEST_ALIAS - }); - expect(orgLoginWebCommand.toCommand()).to.equal( - `sf org:login:web --alias ${TEST_ALIAS} --set-default-dev-hub` - ); - expect(orgLoginWebCommand.description).to.equal( - nls.localize('org_login_web_authorize_dev_hub_text') - ); - }); -}); - -// Setup the test environment. -const $$ = instantiateContext(); - -describe('Org Login Web For Dev Hub in Demo Mode', () => { - it('Should build the org login web login command', async () => { - const orgLoginWeb = new OrgLoginWebDevHubDemoModeExecutor(); - const orgLoginWebCommand = orgLoginWeb.build({ - alias: TEST_ALIAS - }); - expect(orgLoginWebCommand.toCommand()).to.equal( - `sf org:login:web --alias ${TEST_ALIAS} --set-default-dev-hub --no-prompt --json` - ); - expect(orgLoginWebCommand.description).to.equal( - nls.localize('org_login_web_authorize_dev_hub_text') - ); - }); -}); - -describe('Auth Params Gatherer', () => { - let inputBoxSpy: sinon.SinonStub; - - let gatherer: AuthDevHubParamsGatherer; - - const setGathererBehavior = (orgAlias: string | undefined) => { - inputBoxSpy.onCall(0).returns(orgAlias); - }; - - beforeEach(() => { - gatherer = new AuthDevHubParamsGatherer(); - inputBoxSpy = sinon.stub(vscode.window, 'showInputBox'); - }); - - afterEach(() => { - inputBoxSpy.restore(); - }); - - describe('Org Alias Input', () => { - it('Should return Cancel if alias is undefined', async () => { - setGathererBehavior(undefined); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Continue with default alias if user input is empty string', async () => { - setGathererBehavior(''); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.alias).to.equal(DEFAULT_ALIAS); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should return Continue with inputted alias if user input is not undefined or empty', async () => { - setGathererBehavior(TEST_ALIAS); - - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.alias).to.equal(TEST_ALIAS); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - }); -}); - -describe('Org Login Web Dev Hub is based on environment variables', () => { - describe('in demo mode', () => { - let originalValue: any; - - beforeEach(() => { - originalValue = process.env.SFDX_ENV; - }); - - afterEach(() => { - process.env.SFDX_ENV = originalValue; - }); - - it('Should use OrgLoginWebDevHubDemoModeExecutor if demo mode is true', () => { - process.env.SFDX_ENV = 'DEMO'; - expect( - createAuthDevHubExecutor() instanceof OrgLoginWebDevHubDemoModeExecutor - ).to.be.true; - }); - - it('Should use OrgLoginWebDevHubExecutor if demo mode is false', () => { - process.env.SFDX_ENV = ''; - expect(createAuthDevHubExecutor() instanceof OrgLoginWebDevHubExecutor).to - .be.true; - }); - }); - - describe('in container mode', () => { - afterEach(() => { - delete process.env.SF_CONTAINER_MODE; - }); - it('Should not expose the output channel when not in container mode', () => { - const notContainerMode = new TestOrgLoginWebDevHubExecutor(); - expect(notContainerMode.getShowChannelOutput()).to.be.false; - }); - - it('Should use OrgLoginWebDevHubExecutor when container mode is not defined', () => { - const orgLoginWeb = new OrgLoginWebDevHubExecutor(); - expect(createAuthDevHubExecutor() instanceof OrgLoginWebDevHubExecutor).to - .be.true; - const orgLoginWebCommand = orgLoginWeb.build( - {} as unknown as AuthDevHubParams - ); - expect(orgLoginWebCommand.toCommand()).to.equal( - 'sf org:login:web --alias --set-default-dev-hub' - ); - }); - - it('Should use OrgLoginWebDevHubExecutor when container mode is empty', () => { - process.env.SF_CONTAINER_MODE = ''; - const orgLoginWeb = new OrgLoginWebDevHubExecutor(); - expect(createAuthDevHubExecutor() instanceof OrgLoginWebDevHubExecutor).to - .be.true; - const orgLoginWebCommand = orgLoginWeb.build( - {} as unknown as AuthDevHubParams - ); - expect(orgLoginWebCommand.toCommand()).to.equal( - 'sf org:login:web --alias --set-default-dev-hub' - ); - }); - - it('Should use OrgLoginWebDevHubContainerExecutor when container mode is defined', () => { - process.env.SF_CONTAINER_MODE = 'true'; - const authDevhubLogin = new OrgLoginWebDevHubContainerExecutor(); - expect( - createAuthDevHubExecutor() instanceof OrgLoginWebDevHubContainerExecutor - ).to.be.true; - const authDevhubLoginCommand = authDevhubLogin.build( - {} as unknown as AuthDevHubParams - ); - expect(authDevhubLoginCommand.toCommand()).to.equal( - 'sf org:login:device --alias --set-default-dev-hub --json' - ); - expect(authDevhubLoginCommand.description).to.equal( - nls.localize('org_login_web_authorize_dev_hub_text') - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLogout.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLogout.test.ts deleted file mode 100644 index 7cc0107ed5..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLogout.test.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { AuthRemover } from '@salesforce/core'; -import { notificationService } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { createSandbox, SinonSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { OrgLogoutAll, orgLogoutDefault } from '../../../../src/commands'; -import { SfCommandlet } from '../../../../src/commands/util'; -import { nls } from '../../../../src/messages'; -import { telemetryService } from '../../../../src/telemetry'; -import { OrgAuthInfo } from '../../../../src/util'; - -describe('Org Logout All', () => { - it('Should build the auth logout all command', async () => { - const authLogoutAll = new OrgLogoutAll(); - const authLogoutAllCommand = authLogoutAll.build({}); - expect(authLogoutAllCommand.toCommand()).to.equal( - 'sf org:logout --all --no-prompt' - ); - expect(authLogoutAllCommand.description).to.equal( - nls.localize('org_logout_all_text') - ); - }); -}); - -describe('Org Logout Default', () => { - let sb: SinonSandbox; - let getUsernameStub: SinonStub; - let scratchOrgStub: SinonStub; - let notificationStub: SinonStub; - let sendExceptionStub: SinonStub; - let commandletStub: SinonStub; - let inputMessageStub: SinonStub; - let authRemoverStub: SinonStub; - const alias = 'test user 1'; - const username = 'test-username1@example.com'; - - beforeEach(() => { - sb = createSandbox(); - getUsernameStub = sb.stub(OrgAuthInfo, 'getTargetOrgOrAlias'); - scratchOrgStub = sb.stub(OrgAuthInfo, 'isAScratchOrg'); - notificationStub = sb.stub(notificationService, 'showInformationMessage'); - sendExceptionStub = sb.stub(telemetryService, 'sendException'); - commandletStub = sb.stub(SfCommandlet.prototype, 'run'); - inputMessageStub = sb.stub(vscode.window, 'showInformationMessage'); - authRemoverStub = sb.stub(AuthRemover, 'create'); - }); - - afterEach(() => { - sb.restore(); - }); - - it('Should post a message for no default org', async () => { - getUsernameStub.resolves(undefined); - scratchOrgStub.resolves(false); - notificationStub.resolves(); - - await orgLogoutDefault(); - - expect(getUsernameStub.called, 'should have requested target org').to.equal( - true - ); - expect( - sendExceptionStub.called, - 'should not have reported an error' - ).to.equal(false); - expect(notificationStub.called, 'should have posted a message').to.equal( - true - ); - const notificationArgs = notificationStub.getCall(0).args; - expect(notificationArgs[0]).to.equal('No default org to logout from'); - }); - - it('Should handle an aliased org', async () => { - getUsernameStub.resolves(alias); - scratchOrgStub.resolves(false); - notificationStub.resolves(); - - await orgLogoutDefault(); - - expect(getUsernameStub.called, 'should have requested target org').to.equal( - true - ); - expect( - notificationStub.called, - 'should not have posted an error message' - ).to.equal(false); - expect(commandletStub.called).to.equal(true); - }); - - it('Should handle an un-aliased org', async () => { - getUsernameStub.resolves(username); - scratchOrgStub.resolves(false); - notificationStub.resolves(); - - await orgLogoutDefault(); - - expect(getUsernameStub.called, 'should have requested target org').to.equal( - true - ); - expect( - notificationStub.called, - 'should not have posted an error message' - ).to.equal(false); - expect(commandletStub.called).to.equal(true); - }); - - it('Should post a choice for a scratch org', async () => { - getUsernameStub.resolves(username); - scratchOrgStub.resolves(true); - notificationStub.resolves(); - - await orgLogoutDefault(); - - expect(getUsernameStub.called, 'should have requested target org').to.equal( - true - ); - expect( - sendExceptionStub.called, - 'should not have reported an error' - ).to.equal(false); - expect( - notificationStub.called, - 'should not have posted an error message' - ).to.equal(false); - expect(commandletStub.called).to.equal(true); - }); - - it('Should allow logout cancel for a scratch org', async () => { - getUsernameStub.resolves(username); - scratchOrgStub.resolves(true); - notificationStub.resolves(); - inputMessageStub.returns(undefined); - commandletStub.restore(); - - await orgLogoutDefault(); - - expect( - sendExceptionStub.called, - 'should not have reported an error' - ).to.equal(false); - expect( - notificationStub.called, - 'should not have posted an error message' - ).to.equal(false); - expect(inputMessageStub.called, 'should have prompted a message').to.equal( - true - ); - const messageArgs = inputMessageStub.getCall(0).args; - expect(messageArgs).to.deep.equal([ - nls.localize('org_logout_scratch_prompt', username), - { modal: true }, - nls.localize('org_logout_scratch_logout') - ]); - }); - - it('Should allow logout for a scratch org', async () => { - let removedUsername; - const logoutResponse = nls.localize('org_logout_scratch_logout'); - - getUsernameStub.resolves(username); - scratchOrgStub.resolves(true); - notificationStub.resolves(); - inputMessageStub.returns(logoutResponse); - commandletStub.restore(); - authRemoverStub.resolves({ - removeAuth: (name: string) => { - removedUsername = name; - } - }); - - await orgLogoutDefault(); - - expect( - sendExceptionStub.called, - 'should not have reported an error' - ).to.equal(false); - expect( - notificationStub.callCount, - 'should not have posted an error message' - ).to.equal(1); - const notificationArgs = notificationStub.getCall(0).args; - expect(notificationArgs).to.deep.equal([ - 'SFDX: Log Out from Default Org successfully ran', - 'Show', - 'Show Only in Status Bar' - ]); - expect(inputMessageStub.called, 'should have prompted a message').to.equal( - true - ); - const messageArgs = inputMessageStub.getCall(0).args; - expect(messageArgs).to.deep.equal([ - nls.localize('org_logout_scratch_prompt', username), - { modal: true }, - logoutResponse - ]); - expect(removedUsername, 'should have removed username').to.equal(username); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/baseDeployRetrieve.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/baseDeployRetrieve.test.ts deleted file mode 100644 index 2a4074c62c..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/baseDeployRetrieve.test.ts +++ /dev/null @@ -1,826 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { Connection } from '@salesforce/core'; -import { - instantiateContext, - MockTestOrgData, - restoreContext, - stubContext -} from '@salesforce/core/lib/testSetup'; -import { - ConfigUtil, - ContinueResponse, - SourceTrackingService, - Table -} from '@salesforce/salesforcedx-utils-vscode'; -import { - ComponentSet, - ComponentStatus, - DeployResult, - FileProperties, - MetadataApiDeploy, - MetadataApiRetrieve, - MetadataApiRetrieveStatus, - registry, - RetrieveResult, - SourceComponent -} from '@salesforce/source-deploy-retrieve'; -import { - MetadataApiDeployStatus, - RequestStatus -} from '@salesforce/source-deploy-retrieve/lib/src/client/types'; -import { fail } from 'assert'; -import { expect } from 'chai'; -import { basename, dirname, join, sep } from 'path'; -import { SinonSpy, SinonStub, spy } from 'sinon'; -import * as vscode from 'vscode'; -import { channelService } from '../../../src/channels'; -import { - DeployExecutor, - DeployRetrieveExecutor, - RetrieveExecutor -} from '../../../src/commands/baseDeployRetrieve'; -import { PersistentStorageService } from '../../../src/conflict/persistentStorageService'; -import { WorkspaceContext } from '../../../src/context'; -import { nls } from '../../../src/messages'; -import { SalesforcePackageDirectories } from '../../../src/salesforceProject'; -import { componentSetUtils } from '../../../src/services/sdr/componentSetUtils'; -import { DeployQueue } from '../../../src/settings'; -import { workspaceUtils } from '../../../src/util'; -import { MockExtensionContext } from '../telemetry/MockExtensionContext'; - -const $$ = instantiateContext(); -const sb = $$.SANDBOX; - -type DeployRetrieveOperation = MetadataApiDeploy | MetadataApiRetrieve; - -describe('Base Deploy Retrieve Commands', () => { - let mockConnection: Connection; - const dummyOrgApiVersion = '55.0'; - let connectionGetApiVersionStub: SinonStub; - - beforeEach(async () => { - const testData = new MockTestOrgData(); - stubContext($$); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await testData.getConnection(); - connectionGetApiVersionStub = sb - .stub(mockConnection, 'getApiVersion') - .returns(dummyOrgApiVersion); - sb.stub(WorkspaceContext.prototype, 'getConnection').resolves( - mockConnection - ); - }); - - afterEach(() => { - restoreContext($$); - }); - - describe('DeployRetrieveCommand', () => { - class TestDeployRetrieve extends DeployRetrieveExecutor<{}> { - public lifecycle = { - getComponentsStub: sb.stub().returns(new ComponentSet()), - doOperationStub: sb.stub(), - postOperationStub: sb.stub() - }; - - constructor() { - super('test', 'testlog'); - } - - protected getComponents( - response: ContinueResponse<{}> - ): Promise { - return this.lifecycle.getComponentsStub(); - } - protected doOperation(components: ComponentSet): Promise { - return this.lifecycle.doOperationStub(components); - } - protected postOperation(result: undefined): Promise { - return this.lifecycle.postOperationStub(result); - } - } - - it('should call lifecycle methods in correct order', async () => { - const executor = new TestDeployRetrieve(); - const { doOperationStub, getComponentsStub, postOperationStub } = - executor.lifecycle; - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(getComponentsStub.calledOnce).to.equal(true); - expect(doOperationStub.calledAfter(getComponentsStub)).to.equal(true); - expect(postOperationStub.calledAfter(doOperationStub)).to.equal(true); - }); - - it('should add component count to telemetry data', async () => { - const executor = new TestDeployRetrieve(); - const components = new ComponentSet([ - { fullName: 'MyClass', type: 'ApexClass' }, - { fullName: 'MyClass2', type: 'ApexClass' }, - { fullName: 'MyLayout', type: 'Layout' } - ]); - executor.lifecycle.getComponentsStub.returns(components); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - const { properties } = executor.telemetryData; - expect(properties).to.not.equal(undefined); - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - const { metadataCount } = properties!; - expect(metadataCount).to.not.equal(undefined); - - const componentCount = JSON.parse(metadataCount); - expect(componentCount).to.deep.equal([ - { type: 'ApexClass', quantity: 2 }, - { type: 'Layout', quantity: 1 } - ]); - }); - - it('should return success when operation status is "Succeeded"', async () => { - const executor = new TestDeployRetrieve(); - executor.lifecycle.doOperationStub.resolves({ - response: { status: RequestStatus.Succeeded } - }); - - const success = await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(success).to.equal(true); - }); - - it('should return success when operation status is "SucceededPartial"', async () => { - const executor = new TestDeployRetrieve(); - executor.lifecycle.doOperationStub.resolves({ - response: { status: RequestStatus.SucceededPartial } - }); - - const success = await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(success).to.equal(true); - }); - - it('should return unsuccessful when operation status is "Failed"', async () => { - const executor = new TestDeployRetrieve(); - executor.lifecycle.doOperationStub.resolves({ - response: { status: RequestStatus.Failed } - }); - - const success = await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(success).to.equal(false); - }); - - it('should format error with project path', async () => { - const executor = new TestDeployRetrieve(); - const projectPath = join( - 'force-app', - 'main', - 'default', - 'classes', - 'someclass.xyz' - ); - const fullPath = join(workspaceUtils.getRootWorkspacePath(), projectPath); - const error = new Error(`Problem with ${fullPath}`); - executor.lifecycle.getComponentsStub.throws(error); - - try { - await executor.run({ data: {}, type: 'CONTINUE' }); - fail('should have thrown an error'); - } catch (e) { - expect(e.message).to.equal(`Problem with ${sep}${projectPath}`); - } - }); - - it('should use the api version from SFDX configuration', async () => { - const executor = new TestDeployRetrieve(); - const configApiVersion = '30.0'; - const getUserConfiguredApiVersionStub = sb - .stub(ConfigUtil, 'getUserConfiguredApiVersion') - .resolves(configApiVersion); - - await executor.run({ data: {}, type: 'CONTINUE' }); - const components = executor.lifecycle.doOperationStub.firstCall.args[0]; - - expect(components.apiVersion).to.equal(configApiVersion); - expect(getUserConfiguredApiVersionStub.called).to.equal(true); - expect(connectionGetApiVersionStub.called).to.equal(false); - }); - - it('should use the api version from the Org when no User-configured api version is set', async () => { - const executor = new TestDeployRetrieve(); - const getUserConfiguredApiVersionStub = sb - .stub(ConfigUtil, 'getUserConfiguredApiVersion') - .resolves(undefined); - - await executor.run({ data: {}, type: 'CONTINUE' }); - const components = executor.lifecycle.doOperationStub.firstCall.args[0]; - - expect(getUserConfiguredApiVersionStub.called).to.equal(true); - expect(connectionGetApiVersionStub.callCount).to.be.greaterThan(0); - expect(components.apiVersion).to.equal(mockConnection.getApiVersion()); - }); - - it('should not override api version if getComponents set it already', async () => { - const executor = new TestDeployRetrieve(); - - const getComponentsResult = new ComponentSet(); - getComponentsResult.apiVersion = '41.0'; - executor.lifecycle.getComponentsStub.returns(getComponentsResult); - - const configApiVersion = '45.0'; - sb.stub(ConfigUtil, 'getUserConfiguredApiVersion').returns( - configApiVersion - ); - - await executor.run({ data: {}, type: 'CONTINUE' }); - const components = executor.lifecycle.doOperationStub.firstCall.args[0]; - - expect(components.apiVersion).to.equal(getComponentsResult.apiVersion); - }); - }); - - describe('DeployExecutor', () => { - let deployQueueStub: SinonStub; - let setApiVersionStub: SinonStub; - - const packageDir = 'test-app'; - - beforeEach(async () => { - sb.stub( - SalesforcePackageDirectories, - 'getPackageDirectoryPaths' - ).resolves([packageDir]); - - deployQueueStub = sb.stub(DeployQueue.prototype, 'unlock'); - setApiVersionStub = sb.stub(componentSetUtils, 'setApiVersion'); - const mockExtensionContext = new MockExtensionContext(false); - PersistentStorageService.initialize(mockExtensionContext); - sb.stub(SourceTrackingService, 'getSourceTracking').resolves({ - ensureLocalTracking: async () => {} - }); - }); - - class TestDeploy extends DeployExecutor<{}> { - public components: ComponentSet; - public getComponentsStub = sb.stub().returns(new ComponentSet()); - public pollStatusStub: SinonStub; - public deployStub: SinonStub; - public cancellationStub = sb.stub(); - public cacheSpy: SinonSpy; - public getFileResponsesStub = sb.stub(); - - private fileResponses: any[] = [ - { - fullName: 'MyClass', - type: 'ApexClass', - state: ComponentStatus.Changed, - filePath: join('project', packageDir, 'MyClass.cls') - }, - { - fullName: 'MyClass', - type: 'ApexClass', - state: ComponentStatus.Changed, - filePath: join('project', packageDir, 'MyClass.cls-meta.xml') - }, - { - fullName: 'MyLayout', - type: 'Layout', - state: ComponentStatus.Created, - filePath: join('project', packageDir, 'MyLayout.layout-meta.xml') - } - ]; - - constructor(toDeploy = new ComponentSet()) { - super('test', 'testlog'); - this.components = toDeploy; - this.pollStatusStub = sb.stub(); - this.deployStub = sb - .stub(this.components, 'deploy') - .returns({ pollStatus: this.pollStatusStub }); - this.cacheSpy = sb.spy( - PersistentStorageService.getInstance(), - 'setPropertiesForFilesDeploy' - ); - this.getFileResponsesStub = sb.stub().returns(this.fileResponses); - } - - protected async getComponents( - response: ContinueResponse<{}> - ): Promise { - return this.components; - } - protected async setupCancellation( - operation: DeployRetrieveOperation | undefined, - token?: vscode.CancellationToken - ) { - return this.cancellationStub; - } - } - - it('should call setup cancellation logic', async () => { - const executor = new TestDeploy(); - const operationSpy = spy(executor, 'setupCancellation' as any); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(operationSpy.calledOnce).to.equal(true); - }); - - it('should set the apiVersion and then call deploy on component set', async () => { - const executor = new TestDeploy(); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(setApiVersionStub.calledOnce).to.equal(true); - expect(executor.deployStub.calledOnce).to.equal(true); - expect(setApiVersionStub.calledBefore(executor.deployStub)).to.equal( - true - ); - expect(executor.deployStub.firstCall.args[0]).to.deep.equal({ - usernameOrConnection: mockConnection - }); - expect(executor.pollStatusStub.calledOnce).to.equal(true); - }); - - it('should store properties in metadata cache on successful deploy', async () => { - const executor = new TestDeploy(); - const props: FileProperties[] = [ - { - id: '1', - createdById: '2', - createdByName: 'Me', - createdDate: 'Today', - fileName: join('classes', 'One.cls'), - fullName: 'One', - lastModifiedById: '3', - lastModifiedByName: 'You', - lastModifiedDate: 'Tomorrow', - type: 'ApexClass' - }, - { - id: '4', - createdById: '2', - createdByName: 'Me', - createdDate: 'Yesterday', - fileName: join('objects', 'Two.cls'), - fullName: 'Two', - lastModifiedById: '2', - lastModifiedByName: 'Me', - lastModifiedDate: 'Yesterday', - type: 'CustomObject' - } - ]; - const deployPropsOne = { - name: 'One', - fullName: 'One', - type: registry.types.apexclass, - content: join('project', 'classes', 'One.cls'), - xml: join('project', 'classes', 'One.cls-meta.xml') - }; - const deployComponentOne = SourceComponent.createVirtualComponent( - deployPropsOne, - [ - { - dirPath: dirname(deployPropsOne.content), - children: [ - basename(deployPropsOne.content), - basename(deployPropsOne.xml) - ] - } - ] - ); - const deployPropsTwo = { - name: 'Two', - fullName: 'Two', - type: registry.types.customobject, - content: join('project', 'classes', 'Two.cls'), - xml: join('project', 'classes', 'Two.cls-meta.xml') - }; - const deployComponentTwo = SourceComponent.createVirtualComponent( - deployPropsTwo, - [ - { - dirPath: dirname(deployPropsTwo.content), - children: [ - basename(deployPropsTwo.content), - basename(deployPropsTwo.xml) - ] - } - ] - ); - const mockDeployResult = new DeployResult( - { - status: RequestStatus.Succeeded, - lastModifiedDate: 'Yesterday' - } as MetadataApiDeployStatus, - new ComponentSet([deployComponentOne, deployComponentTwo]) - ); - mockDeployResult.getFileResponses = sb.stub().returns([ - { fullName: 'one', type: 'ApexClass', state: '', filePath: '' }, - { fullName: 'two', type: 'CustomObject', state: '', filePath: '' } - ]); - const cache = PersistentStorageService.getInstance(); - executor.pollStatusStub.resolves(mockDeployResult); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(executor.cacheSpy.callCount).to.equal(1); - expect(executor.cacheSpy.args[0][0].components.size).to.equal(2); - expect( - cache.getPropertiesForFile(cache.makeKey('ApexClass', 'one')) - ?.lastModifiedDate - ).to.equal('Yesterday'); - expect( - cache.getPropertiesForFile(cache.makeKey('CustomObject', 'two')) - ?.lastModifiedDate - ).to.equal('Yesterday'); - }); - - it('should not store any properties in metadata cache on failed deploy', async () => { - const executor = new TestDeploy(); - const mockDeployResult = new DeployResult( - { - status: RequestStatus.Failed - } as MetadataApiDeployStatus, - new ComponentSet() - ); - const fileResponses: any[] = []; - sb.stub(mockDeployResult, 'getFileResponses').returns(fileResponses); - executor.pollStatusStub.resolves(mockDeployResult); - const success = await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(success).to.equal(false); - }); - - describe('Result Output', () => { - let appendLineStub: SinonStub; - - const fileResponses: any[] = [ - { - fullName: 'MyClass', - type: 'ApexClass', - state: ComponentStatus.Changed, - filePath: join('project', packageDir, 'MyClass.cls') - }, - { - fullName: 'MyClass', - type: 'ApexClass', - state: ComponentStatus.Changed, - filePath: join('project', packageDir, 'MyClass.cls-meta.xml') - }, - { - fullName: 'MyLayout', - type: 'Layout', - state: ComponentStatus.Created, - filePath: join('project', packageDir, 'MyLayout.layout-meta.xml') - } - ]; - - beforeEach(() => { - appendLineStub = sb.stub(channelService, 'appendLine'); - }); - - it('should output table of deployed components if successful', async () => { - const executor = new TestDeploy(); - - const mockDeployResult = new DeployResult( - { - status: RequestStatus.Succeeded - } as MetadataApiDeployStatus, - new ComponentSet() - ); - sb.stub(mockDeployResult, 'getFileResponses').returns(fileResponses); - executor.pollStatusStub.resolves(mockDeployResult); - - const formattedRows = fileResponses.map(r => ({ - fullName: r.fullName, - type: r.type, - state: r.state, - filePath: r.filePath.replace(`project${sep}`, '') - })); - const expectedOutput = new Table().createTable( - formattedRows, - [ - { key: 'state', label: nls.localize('table_header_state') }, - { key: 'fullName', label: nls.localize('table_header_full_name') }, - { key: 'type', label: nls.localize('table_header_type') }, - { - key: 'filePath', - label: nls.localize('table_header_project_path') - } - ], - nls.localize('table_title_deployed_source') - ); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(appendLineStub.calledOnce).to.equal(true); - expect(appendLineStub.firstCall.args[0]).to.equal(expectedOutput); - }); - - it('should output table of failed components if unsuccessful', async () => { - const executor = new TestDeploy(); - - const mockDeployResult = new DeployResult( - { - status: RequestStatus.Failed - } as MetadataApiDeployStatus, - new ComponentSet() - ); - executor.pollStatusStub.resolves(mockDeployResult); - - const failedRows = fileResponses.map(r => ({ - fullName: r.fullName, - type: r.type, - error: 'There was an issue', - filePath: r.filePath - })); - sb.stub(mockDeployResult, 'getFileResponses').returns(failedRows); - - const formattedRows = fileResponses.map(r => ({ - fullName: r.fullName, - type: r.type, - error: 'There was an issue', - filePath: r.filePath.replace(`project${sep}`, '') - })); - const expectedOutput = new Table().createTable( - formattedRows, - [ - { - key: 'filePath', - label: nls.localize('table_header_project_path') - }, - { key: 'error', label: nls.localize('table_header_errors') } - ], - nls.localize('table_title_deploy_errors') - ); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(appendLineStub.calledOnce).to.equal(true); - expect(appendLineStub.firstCall.args[0]).to.equal(expectedOutput); - }); - }); - - it('should unlock the deploy queue when finished', async () => { - const executor = new TestDeploy(); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(deployQueueStub.calledOnce).to.equal(true); - }); - }); - - describe('RetrieveExecutor', () => { - const packageDir = 'test-app'; - const props = { - name: 'MyTrigger', - type: registry.types.apextrigger, - content: join('project', 'classes', 'MyTrigger.cls'), - xml: join('project', 'classes', 'MyTrigger.cls-meta.xml') - }; - const component = SourceComponent.createVirtualComponent(props, [ - { - dirPath: dirname(props.content), - children: [basename(props.content), basename(props.xml)] - } - ]); - let setApiVersionStub: SinonStub; - - class TestRetrieve extends RetrieveExecutor<{}> { - public components: ComponentSet; - public pollStatusStub: SinonStub; - public retrieveStub: SinonStub; - public cacheSpy: SinonSpy; - - constructor(toRetrieve = new ComponentSet()) { - super('test', 'testlog'); - this.components = toRetrieve; - this.pollStatusStub = sb.stub(); - this.retrieveStub = sb - .stub(this.components, 'retrieve') - .returns({ pollStatus: this.pollStatusStub }); - this.cacheSpy = sb.spy( - PersistentStorageService.getInstance(), - 'setPropertiesForFilesRetrieve' - ); - } - - protected async getComponents( - response: ContinueResponse<{}> - ): Promise { - return this.components; - } - } - - beforeEach(() => { - sb.stub( - SalesforcePackageDirectories, - 'getPackageDirectoryPaths' - ).resolves([packageDir]); - const mockExtensionContext = new MockExtensionContext(false); - PersistentStorageService.initialize(mockExtensionContext); - setApiVersionStub = sb.stub(componentSetUtils, 'setApiVersion'); - sb.stub(SourceTrackingService, 'getSourceTracking').resolves({ - updateTrackingFromRetrieve: async () => {} - }); - }); - - it('should set the apiVersion and then call retrieve on component set', async () => { - const components = new ComponentSet([ - { fullName: 'MyClass', type: 'ApexClass' }, - { fullName: 'MyTrigger', type: 'ApexTrigger' } - ]); - const executor = new TestRetrieve(components); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(setApiVersionStub.calledOnce); - expect(executor.retrieveStub.calledOnce); - expect(setApiVersionStub.calledBefore(executor.retrieveStub)).to.equal( - true - ); - }); - - it('should call setup cancellation logic', async () => { - const executor = new TestRetrieve(); - const operationSpy = spy(executor, 'setupCancellation' as any); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(operationSpy.calledOnce).to.equal(true); - }); - - it('should store properties in metadata cache on successful retrieve', async () => { - const executor = new TestRetrieve(); - const mockRetrieveResult = new RetrieveResult( - { - status: RequestStatus.Succeeded, - fileProperties: [ - { fullName: 'one', type: 'ApexClass', lastModifiedDate: 'Today' }, - { - fullName: 'two', - type: 'CustomObject', - lastModifiedDate: 'Yesterday' - } - ] - } as MetadataApiRetrieveStatus, - new ComponentSet() - ); - const cache = PersistentStorageService.getInstance(); - executor.pollStatusStub.resolves(mockRetrieveResult); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(executor.cacheSpy.callCount).to.equal(1); - expect(executor.cacheSpy.args[0][0].length).to.equal(2); - expect( - cache.getPropertiesForFile(cache.makeKey('ApexClass', 'one')) - ?.lastModifiedDate - ).to.equal('Today'); - expect( - cache.getPropertiesForFile(cache.makeKey('CustomObject', 'two')) - ?.lastModifiedDate - ).to.equal('Yesterday'); - }); - - it('should not store any properties in metadata cache on failed retrieve', async () => { - const executor = new TestRetrieve(); - const mockRetrieveResult = new RetrieveResult( - { - status: RequestStatus.Failed, - fileProperties: [] as FileProperties[] - } as MetadataApiRetrieveStatus, - new ComponentSet() - ); - executor.pollStatusStub.resolves(mockRetrieveResult); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(executor.cacheSpy.callCount).to.equal(1); - expect(executor.cacheSpy.args[0][0].length).to.equal(0); - }); - - describe('Result Output', () => { - let appendLineStub: SinonStub; - - beforeEach(() => { - appendLineStub = sb.stub(channelService, 'appendLine'); - }); - - it('should output table of components for successful retrieve', async () => { - const executor = new TestRetrieve(); - const mockRetrieveResult = new RetrieveResult( - { - status: RequestStatus.Succeeded, - fileProperties: [] as FileProperties[] - } as MetadataApiRetrieveStatus, - new ComponentSet() - ); - executor.pollStatusStub.resolves(mockRetrieveResult); - - const fileResponses = [ - { - fullName: 'MyClass', - type: 'ApexClass', - filePath: join('project', packageDir, 'MyClass.cls') - }, - { - fullName: 'MyClass', - type: 'ApexClass', - filePath: join('project', packageDir, 'MyClass.cls') - }, - { - fullName: 'MyLayout', - type: 'Layout', - filePath: join('project', packageDir, 'MyLayout.layout-meta.xml') - } - ]; - sb.stub(mockRetrieveResult, 'getFileResponses').returns(fileResponses); - - const formattedRows = fileResponses.map(r => ({ - fullName: r.fullName, - type: r.type, - filePath: r.filePath.replace(`project${sep}`, '') - })); - const expectedOutput = new Table().createTable( - formattedRows, - [ - { key: 'fullName', label: nls.localize('table_header_full_name') }, - { key: 'type', label: nls.localize('table_header_type') }, - { - key: 'filePath', - label: nls.localize('table_header_project_path') - } - ], - nls.localize('lib_retrieve_result_title') - ); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(appendLineStub.calledOnce).to.equal(true); - expect(appendLineStub.firstCall.args[0]).to.equal(expectedOutput); - }); - - it('should output table of components for failed retrieve', async () => { - const executor = new TestRetrieve(); - const mockRetrieveResult = new RetrieveResult( - { - status: RequestStatus.Failed, - fileProperties: [] as FileProperties[] - } as MetadataApiRetrieveStatus, - new ComponentSet() - ); - executor.pollStatusStub.resolves(mockRetrieveResult); - - const fileResponses = [ - { - fullName: 'MyClass', - type: 'ApexClass', - state: ComponentStatus.Failed, - error: 'There was problem with this component', - problemType: 'Error' - }, - { - fullName: 'MyClass', - type: 'ApexClass', - state: ComponentStatus.Failed, - error: 'There was problem with this component', - problemType: 'Error' - } - ]; - sb.stub(mockRetrieveResult, 'getFileResponses').returns(fileResponses); - - const formattedRows = fileResponses.map(r => ({ - fullName: r.fullName, - type: r.type, - error: r.error - })); - const expectedOutput = new Table().createTable( - formattedRows, - [ - { key: 'fullName', label: nls.localize('table_header_full_name') }, - { key: 'type', label: nls.localize('table_header_type') }, - { - key: 'error', - label: nls.localize('table_header_message') - } - ], - nls.localize('lib_retrieve_message_title') - ); - - await executor.run({ data: {}, type: 'CONTINUE' }); - - expect(appendLineStub.calledOnce).to.equal(true); - expect(appendLineStub.firstCall.args[0]).to.equal(expectedOutput); - }); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/configList.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/configList.test.ts deleted file mode 100644 index 49ad8ba4d1..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/configList.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { ConfigList } from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Config List', () => { - it('Should build the config list command', async () => { - const configList = new ConfigList(); - const configListCommand = configList.build({}); - expect(configListCommand.toCommand()).to.equal('sf config:list'); - expect(configListCommand.description).to.equal( - nls.localize('config_list_text') - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/configSet.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/configSet.test.ts deleted file mode 100644 index d4e8ee5355..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/configSet.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ConfigUtil, Table } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import { channelService } from '../../../src/channels'; -import { configSet, ConfigSetExecutor } from '../../../src/commands'; -import { CONFIG_SET_NAME, TARGET_ORG_KEY } from '../../../src/constants'; -import { nls } from '../../../src/messages'; - -const sandbox = sinon.createSandbox(); -let channelSpy: sinon.SinonSpy; -let setTargetOrgOrAliasStub: sinon.SinonStub; -let tableSpy: sinon.SinonSpy; - -describe('Config Set', () => { - const errorMessage = 'An error occurred.'; - const usernameOrAlias = 'test-username1@gmail.com'; - - beforeEach(() => { - channelSpy = sandbox.spy(channelService, 'appendLine'); - setTargetOrgOrAliasStub = sandbox.stub(ConfigUtil, 'setTargetOrgOrAlias'); - tableSpy = sandbox.spy(Table.prototype, 'createTable'); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('should set config with the given username or alias', async () => { - await configSet(usernameOrAlias); - expect(setTargetOrgOrAliasStub.callCount).to.equal(1); - expect(setTargetOrgOrAliasStub.calledWith(usernameOrAlias)).to.equal(true); - }); - - it('should set config with first alias', async () => { - const aliases = ['alias1', 'alias2']; - const expectedAlias = aliases[0]; - await configSet(aliases.join(',')); - expect(setTargetOrgOrAliasStub.callCount).to.equal(1); - expect(setTargetOrgOrAliasStub.calledWith(expectedAlias)).to.equal(true); - }); - - it('should display formatted output in output channel', async () => { - const expectedOutput = 'Successful table row'; - sandbox - .stub(ConfigSetExecutor.prototype as any, 'formatOutput') - .returns(expectedOutput); - await configSet(usernameOrAlias); - expect(channelSpy.callCount).to.equal(1); - expect(channelSpy.calledWith(expectedOutput)).to.equal(true); - }); - - it('should display correct output to user', async () => { - const outputTableRow = { - name: TARGET_ORG_KEY, - val: usernameOrAlias, - success: String(true) - }; - const configSetInstance = new ConfigSetExecutor(usernameOrAlias); - const formatOutput = (configSetInstance as any).formatOutput( - outputTableRow - ); - expect(tableSpy.callCount).to.equal(1); - expect(formatOutput).to.contain( - nls.localize(CONFIG_SET_NAME), - TARGET_ORG_KEY - ); - expect(formatOutput).to.contain(usernameOrAlias, String(true)); - }); - - it('should display error message in output channel', async () => { - setTargetOrgOrAliasStub.throws(new Error(errorMessage)); - await configSet(usernameOrAlias); - expect(channelSpy.callCount).to.equal(2); - expect(channelSpy.lastCall.args.length).to.equal(1); - expect(channelSpy.lastCall.args[0]).to.contain(errorMessage); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/debuggerStop.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/debuggerStop.test.ts deleted file mode 100644 index 17bb995cfa..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/debuggerStop.test.ts +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ContinueResponse } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as childProcess from 'child_process'; -import * as sinon from 'sinon'; -import { - DebuggerSessionDetachExecutor, - IdGatherer, - IdSelection, - StopActiveDebuggerSessionExecutor -} from '../../../src/commands'; -import { SfCommandlet, SfWorkspaceChecker } from '../../../src/commands/util'; -import { nls } from '../../../src/messages'; -import { notificationService } from '../../../src/notifications'; - -describe('Debugger stop command', () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const mockSpawn = require('mock-spawn'); - - describe('Session query', () => { - let origSpawn: any; - let mySpawn: any; - let workspaceCheckerStub: sinon.SinonStub; - let idGathererStub: sinon.SinonStub; - let detachExecutorSpy: sinon.SinonSpy; - let sessionDetachRunSpy: sinon.SinonSpy; - let executor: StopActiveDebuggerSessionExecutor; - let infoSpy: sinon.SinonSpy; - - beforeEach(() => { - origSpawn = childProcess.spawn; - mySpawn = mockSpawn(); - (childProcess as any).spawn = mySpawn; - workspaceCheckerStub = sinon - .stub(SfWorkspaceChecker.prototype, 'check') - .returns(true); - idGathererStub = sinon - .stub(IdGatherer.prototype, 'gather') - .returns({ type: 'CONTINUE' }); - detachExecutorSpy = sinon.spy( - DebuggerSessionDetachExecutor.prototype, - 'execute' - ); - sessionDetachRunSpy = sinon.spy(SfCommandlet.prototype, 'run'); - executor = new StopActiveDebuggerSessionExecutor(); - infoSpy = sinon.stub(notificationService, 'showInformationMessage'); - }); - - afterEach(() => { - (childProcess as any).spawn = origSpawn; - workspaceCheckerStub.restore(); - idGathererStub.restore(); - detachExecutorSpy.restore(); - sessionDetachRunSpy.restore(); - infoSpy.restore(); - }); - - it('Should build query command', () => { - const command = executor.build({}); - - expect(command.toCommand()).to.equal( - "sf data:query --query SELECT Id FROM ApexDebuggerSession WHERE Status = 'Active' LIMIT 1 --use-tooling-api --json" - ); - expect(command.description).to.equal( - nls.localize('debugger_query_session_text') - ); - }); - - it('Should query & stop', async () => { - mySpawn.sequence.add( - mySpawn.simple( - 0, - '{"status":0,"result":{"size":1,"records":[{"Id":"07aFAKE"}]}}' - ) - ); - mySpawn.sequence.add(mySpawn.simple(0, '{}')); - - await executor.execute({} as ContinueResponse<{}>); - - expect(workspaceCheckerStub.calledOnce).to.equal(true); - expect(idGathererStub.calledOnce).to.equal(true); - expect(detachExecutorSpy.calledOnce).to.equal(true); - expect(sessionDetachRunSpy.calledOnce).to.equal(true); - }); - - it('Should handle zero query result', async () => { - mySpawn.sequence.add( - mySpawn.simple(0, '{"status":0,"result":{"size":0,"records":[]}}') - ); - - await executor.execute({} as ContinueResponse<{}>); - - expect(workspaceCheckerStub.calledOnce).to.equal(false); - expect(idGathererStub.called).to.equal(false); - expect(detachExecutorSpy.called).to.equal(false); - expect(sessionDetachRunSpy.calledOnce).to.equal(false); - expect(infoSpy.calledOnce).to.equal(true); - expect(infoSpy.getCall(0).args).to.have.same.members([ - nls.localize('debugger_stop_none_found_text') - ]); - }); - - it('Should handle unexpected Apex Debugger session ID', async () => { - mySpawn.sequence.add( - mySpawn.simple( - 0, - '{"status":0,"result":{"size":1,"records":[{"Id":"foo"}]}}' - ) - ); - - await executor.execute({} as ContinueResponse<{}>); - - expect(workspaceCheckerStub.calledOnce).to.equal(false); - expect(idGathererStub.called).to.equal(false); - expect(detachExecutorSpy.called).to.equal(false); - expect(sessionDetachRunSpy.calledOnce).to.equal(false); - }); - - it('Should handle JSON parse error', async () => { - mySpawn.sequence.add(mySpawn.simple(0, 'error')); - - await executor.execute({} as ContinueResponse<{}>); - - expect(workspaceCheckerStub.calledOnce).to.equal(false); - expect(idGathererStub.called).to.equal(false); - expect(detachExecutorSpy.called).to.equal(false); - expect(sessionDetachRunSpy.calledOnce).to.equal(false); - }); - - it('Should handle process error', async () => { - mySpawn.sequence.add(mySpawn.simple(1, '', 'error')); - - await executor.execute({} as ContinueResponse<{}>); - - expect(workspaceCheckerStub.calledOnce).to.equal(false); - expect(idGathererStub.called).to.equal(false); - expect(detachExecutorSpy.called).to.equal(false); - expect(sessionDetachRunSpy.calledOnce).to.equal(false); - }); - }); - - describe('Session detach', () => { - it('Should build update command', () => { - const executor = new DebuggerSessionDetachExecutor(); - - const command = executor.build({ id: '07aFAKE' } as IdSelection); - - expect(command.toCommand()).to.equal( - 'sf data:update:record --sobject ApexDebuggerSession --record-id 07aFAKE --values Status="Detach" --use-tooling-api' - ); - expect(command.description).to.equal(nls.localize('debugger_stop_text')); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/deleteSource.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/deleteSource.test.ts deleted file mode 100644 index d7f3a8175b..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/deleteSource.test.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { - ContinueResponse, - fileUtils -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - ConfirmationAndSourcePathGatherer, - ManifestChecker -} from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('ManifestChecker', () => { - let workspaceStub: sinon.SinonStub; - const workspaceFolderPath = path.join('path', 'to', 'workspace', 'folder'); - - before(() => { - const workspaceFolders = [{ uri: { fsPath: workspaceFolderPath } }]; - workspaceStub = sinon - .stub(vscode.workspace, 'workspaceFolders') - .value(workspaceFolders); - }); - - after(() => { - workspaceStub.restore(); - }); - - it('fails the check if the selected resource is in the manifest directory', () => { - const manifestFilePath = path.join( - workspaceFolderPath, - 'manifest', - 'package.xml' - ); - const manifestUri = { fsPath: manifestFilePath } as vscode.Uri; - const flushFilePathStub = sinon - .stub(fileUtils, 'flushFilePath') - .returns(manifestFilePath); - const checker = new ManifestChecker(manifestUri); - const response = checker.check(); - expect(response).to.be.false; - - flushFilePathStub.restore(); - }); - - it('passes the check if the selected resource is not in the manifest directory', () => { - const sourcePath = path.join(workspaceFolderPath, 'src', 'exampleFile.js'); - const sourceUri = { fsPath: sourcePath } as vscode.Uri; - const flushFilePathStub = sinon - .stub(fileUtils, 'flushFilePath') - .returns(sourcePath); - const checker = new ManifestChecker(sourceUri); - const response = checker.check(); - expect(response).to.be.true; - - flushFilePathStub.restore(); - }); -}); - -describe('ConfirmationAndSourcePathGatherer', () => { - const examplePath = path.join('example', 'path'); - const explorerPathUri = { fsPath: examplePath } as vscode.Uri; - - let informationMessageStub: sinon.SinonStub; - let flushFilePathStub: sinon.SinonStub; - - beforeEach(() => { - informationMessageStub = sinon.stub( - vscode.window, - 'showInformationMessage' - ); - - flushFilePathStub = sinon.stub(fileUtils, 'flushFilePath'); - - flushFilePathStub.returns(examplePath); - }); - - afterEach(() => { - informationMessageStub.restore(); - flushFilePathStub.restore(); - }); - - it('Should return cancel if the user cancels the command', async () => { - informationMessageStub.returns( - nls.localize('cancel_delete_source_button_text') - ); - - const gatherer = new ConfirmationAndSourcePathGatherer(explorerPathUri); - const response = await gatherer.gather(); - expect(informationMessageStub.calledOnce).to.be.true; - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Continue if the user chooses to proceed', async () => { - informationMessageStub.returns( - nls.localize('confirm_delete_source_button_text') - ); - - const gatherer = new ConfirmationAndSourcePathGatherer(explorerPathUri); - const response = (await gatherer.gather()) as ContinueResponse<{ - filePath: string; - }>; - expect(informationMessageStub.calledOnce).to.be.true; - expect(response.type).to.equal('CONTINUE'); - expect(response.data).to.eql({ filePath: examplePath }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/deployManifest.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/deployManifest.test.ts deleted file mode 100644 index ea00d91ce4..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/deployManifest.test.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { Connection } from '@salesforce/core'; -import { - instantiateContext, - MockTestOrgData, - restoreContext, - stubContext -} from '@salesforce/core/lib/testSetup'; -import { SourceTrackingService } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; -import { expect } from 'chai'; -import * as path from 'path'; -import { SinonStub } from 'sinon'; -import { LibraryDeployManifestExecutor } from '../../../src/commands/deployManifest'; -import { WorkspaceContext } from '../../../src/context'; -import { SalesforcePackageDirectories } from '../../../src/salesforceProject'; -import { workspaceUtils } from '../../../src/util'; - -const $$ = instantiateContext(); -const env = $$.SANDBOX; - -describe('Deploy Using Manifest Option', () => { - beforeEach(() => { - stubContext($$); - }); - - afterEach(() => { - restoreContext($$); - }); - - describe('Library Executor', () => { - const manifestPath = 'package.xml'; - const packageDirs = ['p1', 'p2']; - const mockComponents = new ComponentSet([ - { fullName: 'Test', type: 'apexclass' }, - { fullName: 'Test2', type: 'layout' } - ]); - - let mockConnection: Connection; - let deployStub: SinonStub; - let pollStatusStub: SinonStub; - - const executor = new LibraryDeployManifestExecutor(); - - beforeEach(async () => { - const testData = new MockTestOrgData(); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await testData.getConnection(); - env - .stub(WorkspaceContext.prototype, 'getConnection') - .resolves(mockConnection); - - env - .stub(SalesforcePackageDirectories, 'getPackageDirectoryPaths') - .resolves(packageDirs); - - env - .stub(ComponentSet, 'fromManifest') - .withArgs({ - manifestPath, - resolveSourcePaths: packageDirs.map(p => - path.join(workspaceUtils.getRootWorkspacePath(), p) - ), - forceAddWildcards: undefined - }) - .returns(mockComponents); - - pollStatusStub = env.stub(); - deployStub = env.stub(mockComponents, 'deploy').returns({ - pollStatus: pollStatusStub - }); - env.stub(SourceTrackingService, 'getSourceTracking').resolves({ - ensureLocalTracking: async () => {} - }); - }); - - afterEach(() => { - env.restore(); - }); - - it('should deploy components in a manifest', async () => { - await executor.run({ data: manifestPath, type: 'CONTINUE' }); - - expect(deployStub.calledOnce).to.equal(true); - expect(deployStub.firstCall.args[0]).to.deep.equal({ - usernameOrConnection: mockConnection - }); - expect(pollStatusStub.calledOnce).to.equal(true); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/deploySourcePath.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/deploySourcePath.test.ts deleted file mode 100644 index b17f19148d..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/deploySourcePath.test.ts +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { Connection } from '@salesforce/core'; -import { - instantiateContext, - MockTestOrgData, - restoreContext, - stubContext -} from '@salesforce/core/lib/testSetup'; -import { - ContinueResponse, - fileUtils, - SourceTrackingService -} from '@salesforce/salesforcedx-utils-vscode'; -import { - ComponentSet, - MetadataResolver -} from '@salesforce/source-deploy-retrieve'; -import { expect } from 'chai'; -import * as path from 'path'; -import { SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { LibraryDeploySourcePathExecutor } from '../../../src/commands'; -import * as deploySourcePath from '../../../src/commands/deploySourcePath'; -import { TimestampConflictChecker } from '../../../src/commands/util/timestampConflictChecker'; -import { WorkspaceContext } from '../../../src/context'; -import { - SalesforcePackageDirectories, - SalesforceProjectConfig -} from '../../../src/salesforceProject'; -import { workspaceUtils } from '../../../src/util'; - -const $$ = instantiateContext(); -const sb = $$.SANDBOX; - -describe('Deploy Using Sourcepath Option', () => { - afterEach(() => { - restoreContext($$); - }); - - describe('Library Executor', () => { - let mockConnection: Connection; - - let getComponentsFromPathStub: SinonStub; - let pollStatusStub: SinonStub; - let deployStub: SinonStub; - - beforeEach(async () => { - const testData = new MockTestOrgData(); - stubContext($$); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - - mockConnection = await testData.getConnection(); - - getComponentsFromPathStub = sb - .stub(MetadataResolver.prototype, 'getComponentsFromPath') - .returns([]); - - sb.stub(WorkspaceContext.prototype, 'getConnection').resolves( - mockConnection - ); - sb.stub(WorkspaceContext.prototype, 'username').get( - () => testData.username - ); - - pollStatusStub = sb.stub().resolves(undefined); - deployStub = sb - .stub(ComponentSet.prototype, 'deploy') - .withArgs({ usernameOrConnection: mockConnection }) - .returns({ - pollStatus: pollStatusStub - }); - - sb.stub(SalesforceProjectConfig, 'getValue').resolves('11.0'); - sb.stub(SourceTrackingService, 'getSourceTracking').resolves({ - ensureLocalTracking: async () => {} - }); - }); - - afterEach(() => { - sb.restore(); - }); - - it('should deploy with a single path', async () => { - const filePath = path.join('classes', 'MyClass.cls'); - const executor = new LibraryDeploySourcePathExecutor(); - - await executor.run({ - type: 'CONTINUE', - data: [filePath] - }); - - expect(getComponentsFromPathStub.calledOnce).to.equal(true); - expect(getComponentsFromPathStub.firstCall.args[0]).to.equal(filePath); - expect(deployStub.calledOnce).to.equal(true); - expect(deployStub.firstCall.args[0]).to.deep.equal({ - usernameOrConnection: mockConnection - }); - expect(pollStatusStub.calledOnce).to.equal(true); - }); - - it('should deploy with multiple paths', async () => { - const executor = new LibraryDeploySourcePathExecutor(); - const filePath1 = path.join('classes', 'MyClass1.cls'); - const filePath2 = path.join('classes', 'MyClass2.cls'); - const filePath3 = path.join('lwc', 'myBundle', 'myBundle'); - - await executor.run({ - type: 'CONTINUE', - data: [filePath1, filePath2, filePath3] - }); - - expect(getComponentsFromPathStub.calledThrice).to.equal(true); - expect(getComponentsFromPathStub.firstCall.args[0]).to.equal(filePath1); - expect(getComponentsFromPathStub.secondCall.args[0]).to.equal(filePath2); - expect(getComponentsFromPathStub.thirdCall.args[0]).to.equal(filePath3); - expect(deployStub.calledOnce).to.equal(true); - expect(deployStub.firstCall.args[0]).to.deep.equal({ - usernameOrConnection: mockConnection - }); - expect(pollStatusStub.calledOnce).to.equal(true); - }); - - it('should deploy multiple files', async () => { - const filePath1 = path.join('classes', 'MyClass1.cls'); - const filePath2 = path.join('classes', 'MyClass2.cls'); - const filePath3 = path.join('lwc', 'myBundle', 'myBundle'); - const uris = [ - vscode.Uri.file(filePath1), - vscode.Uri.file(filePath2), - vscode.Uri.file(filePath3) - ]; - const filePaths = uris.map(uri => { - return uri.fsPath; - }); - const timestampConflictCheckerCheckStub = sb - .stub(TimestampConflictChecker.prototype, 'check') - .returns({ - type: 'CONTINUE', - data: filePaths - }); - const isInPackageDirectoryStub = sb - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .returns(true); - - const flushFilePathsStub = sb - .stub(fileUtils, 'flushFilePaths') - .returns([ - path.sep + filePath1, - path.sep + filePath2, - path.sep + filePath3 - ]); - - await deploySourcePath.deploySourcePaths(uris[0], uris); - - expect(timestampConflictCheckerCheckStub.called).to.equal(true); - const continueResponse = timestampConflictCheckerCheckStub - .args[0][0] as ContinueResponse; - expect(JSON.stringify(continueResponse.data)).to.equal( - JSON.stringify(filePaths) - ); - - flushFilePathsStub.restore(); - isInPackageDirectoryStub.restore(); - }); - - it('should deploy a single file', async () => { - const filePath1 = path.join('classes', 'MyClass1.cls'); - const uris = [vscode.Uri.file(filePath1)]; - const filePaths = uris.map(uri => { - return uri.fsPath; - }); - const timestampConflictCheckerCheckStub = sb - .stub(TimestampConflictChecker.prototype, 'check') - .returns({ - type: 'CONTINUE', - data: filePaths - }); - const isInPackageDirectoryStub = sb - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .returns(true); - const flushFilePathsStub = sb - .stub(fileUtils, 'flushFilePaths') - .returns([path.sep + filePath1]); - - await deploySourcePath.deploySourcePaths(uris[0], uris); - - expect(timestampConflictCheckerCheckStub.called).to.equal(true); - const continueResponse = timestampConflictCheckerCheckStub - .args[0][0] as ContinueResponse; - expect(JSON.stringify(continueResponse.data)).to.equal( - JSON.stringify(filePaths) - ); - - flushFilePathsStub.restore(); - isInPackageDirectoryStub.restore(); - timestampConflictCheckerCheckStub.restore(); - }); - - it('should deploy when editing single file and "Deploy This Source from Org" is executed', async () => { - const filePath1 = path.join('classes', 'MyClass1.cls'); - const uris = [vscode.Uri.file(filePath1)]; - const filePaths = uris.map(uri => { - return uri.fsPath; - }); - const timestampConflictCheckerCheckStub = sb - .stub(TimestampConflictChecker.prototype, 'check') - .returns({ - type: 'CONTINUE', - data: filePaths - }); - const isInPackageDirectoryStub = sb - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .returns(true); - const flushFilePathsStub = sb - .stub(fileUtils, 'flushFilePaths') - .returns([path.sep + filePath1]); - - await deploySourcePath.deploySourcePaths(uris[0], undefined); - - expect(timestampConflictCheckerCheckStub.called).to.equal(true); - const continueResponse = timestampConflictCheckerCheckStub - .args[0][0] as ContinueResponse; - expect(JSON.stringify(continueResponse.data)).to.equal( - JSON.stringify(filePaths) - ); - - flushFilePathsStub.restore(); - isInPackageDirectoryStub.restore(); - timestampConflictCheckerCheckStub.restore(); - }); - - it('should deploy when using the command palette', async () => { - const filePath1 = path.join('classes', 'MyClass1.cls'); - - // When deploying via the command palette, - // sourceUri is undefined, and uris is undefined as well, - // and the path is obtained from the active editor - // (and calling getUriFromActiveEditor()) - const sourceUri = undefined; - const uris = undefined; - - const filePaths = [filePath1]; - const timestampConflictCheckerCheckStub = sb - .stub(TimestampConflictChecker.prototype, 'check') - .returns({ - type: 'CONTINUE', - data: filePaths - }); - const isInPackageDirectoryStub = sb - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .returns(true); - const getUriFromActiveEditorStub = sb - .stub(deploySourcePath, 'getUriFromActiveEditor') - .returns(filePath1); - const flushFilePathsStub = sb - .stub(fileUtils, 'flushFilePaths') - .returns([undefined]); - - await deploySourcePath.deploySourcePaths(sourceUri, uris); - - expect(getUriFromActiveEditorStub.called).to.equal(true); - - flushFilePathsStub.restore(); - getUriFromActiveEditorStub.restore(); - isInPackageDirectoryStub.restore(); - timestampConflictCheckerCheckStub.restore(); - }); - - it('should deploy when saving and the "salesforcedx-vscode-core.push-or-deploy-on-save" setting is on', async () => { - const filePath1 = path.join('classes', 'MyClass1.cls'); - - // When the push-or-deploy-on-save setting is on, - // sourceUri is an array, and uris is undefined. - const sourceUris: vscode.Uri[] = [vscode.Uri.file(filePath1)]; - const uris = undefined; - - const filePaths = sourceUris.map(uri => { - return uri.fsPath; - }); - const timestampConflictCheckerCheckStub = sb - .stub(TimestampConflictChecker.prototype, 'check') - .returns({ - type: 'CONTINUE', - data: filePaths - }); - const isInPackageDirectoryStub = sb - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .returns(true); - const flushFilePathsStub = sb - .stub(fileUtils, 'flushFilePaths') - .returns([path.sep + filePath1]); - - await deploySourcePath.deploySourcePaths(sourceUris, uris); - - expect(timestampConflictCheckerCheckStub.called).to.equal(true); - const continueResponse = timestampConflictCheckerCheckStub - .args[0][0] as ContinueResponse; - expect(JSON.stringify(continueResponse.data)).to.equal( - JSON.stringify(filePaths) - ); - - flushFilePathsStub.restore(); - isInPackageDirectoryStub.restore(); - timestampConflictCheckerCheckStub.restore(); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/describeMetadata.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/describeMetadata.test.ts deleted file mode 100644 index 1812b40ab6..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/describeMetadata.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { CommandOutput } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as sinon from 'sinon'; -import { - describeMetadata, - DescribeMetadataExecutor -} from '../../../src/commands'; - -// tslint:disable:no-unused-expression -describe('Describe Metadata', () => { - it('Should build describe metadata command', async () => { - const describeMetadataExec = new DescribeMetadataExecutor(); - const describeMetadataCmd = describeMetadataExec.build({}); - expect(describeMetadataCmd.toCommand()).to.equal( - 'sf org:list:metadata-types --json' - ); - }); - - it('Should write a file with metadata describe output', async () => { - const execStub = sinon.stub(DescribeMetadataExecutor.prototype, 'execute'); - const writeFileStub = sinon.stub(fs, 'writeFileSync'); - - const outputFolder = './test/folder/'; - const resultData = '{status: 0}'; - const cmdOutputStub = sinon - .stub(CommandOutput.prototype, 'getCmdResult') - .returns(resultData); - - const result = await describeMetadata(outputFolder); - expect(writeFileStub.calledOnce).to.equal(true); - expect(result).to.equal(resultData); - - writeFileStub.restore(); - cmdOutputStub.restore(); - execStub.restore(); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/bootstrapCmd.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/bootstrapCmd.test.ts deleted file mode 100644 index ca60b51a8b..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/bootstrapCmd.test.ts +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { ContinueResponse } from '@salesforce/salesforcedx-utils-vscode'; -import * as AdmZip from 'adm-zip'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - EnterForceIdeUri, - IsvDebugBootstrapConfig, - IsvDebugBootstrapExecutor -} from '../../../../src/commands/isvdebugging'; -import { projectTemplateEnum } from '../../../../src/commands/projectGenerate'; -import { nls } from '../../../../src/messages'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('ISV Debugging Project Bootstrap Command', () => { - const LOGIN_URL = 'a.b.c'; - const SESSION_ID = '0x123'; - const PROJECT_NAME = 'sfdx-simple-clone'; - const ORIGINAL_PROJECT = 'sfdx-simple'; - const WORKSPACE_PATH = path.join(workspaceUtils.getRootWorkspacePath(), '..'); - const PROJECT_DIR: vscode.Uri[] = [vscode.Uri.parse(WORKSPACE_PATH)]; - - describe('EnterForceIdeUri Gatherer', () => { - let inputBoxSpy: sinon.SinonStub; - let showErrorMessageSpy: sinon.SinonStub; - - before(() => { - inputBoxSpy = sinon.stub(vscode.window, 'showInputBox'); - inputBoxSpy.onCall(0).returns(undefined); - inputBoxSpy.onCall(1).returns(''); - inputBoxSpy - .onCall(2) - .returns(`forceide://abc?url=${LOGIN_URL}&sessionId=${SESSION_ID}`); - inputBoxSpy.onCall(3).returns(`forceide://abc?url=${LOGIN_URL}`); - inputBoxSpy.onCall(4).returns(`forceide://abc?sessionId=${SESSION_ID}`); - inputBoxSpy - .onCall(5) - .returns(`forceide://abc?url=${LOGIN_URL}&sessionId=${SESSION_ID}`); - inputBoxSpy - .onCall(6) - .returns( - `forceide://abc?url=${LOGIN_URL}&secure=0&sessionId=${SESSION_ID}` - ); - showErrorMessageSpy = sinon.stub(vscode.window, 'showErrorMessage'); - }); - - after(() => { - inputBoxSpy.restore(); - showErrorMessageSpy.restore(); - }); - - it('Should return cancel if forceide url is undefined', async () => { - const gatherer = new EnterForceIdeUri(); - const response = await gatherer.gather(); - expect(inputBoxSpy.calledOnce).to.be.true; - expect(response.type).to.equal('CANCEL'); - expect(showErrorMessageSpy.notCalled).to.be.true; - }); - - it('Should return cancel if user input is empty string', async () => { - const gatherer = new EnterForceIdeUri(); - const response = await gatherer.gather(); - expect(inputBoxSpy.calledTwice).to.be.true; - expect(response.type).to.equal('CANCEL'); - expect(showErrorMessageSpy.notCalled).to.be.true; - }); - - it('Should return Continue with inputted url if not undefined or empty', async () => { - const gatherer = new EnterForceIdeUri(); - const response = await gatherer.gather(); - expect(inputBoxSpy.calledThrice).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.loginUrl).to.not.be.undefined; - expect(response.data.sessionId).to.equal(SESSION_ID); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should return cancel and show error if forceide url is missing sessionId', async () => { - expect(showErrorMessageSpy.calledOnce).to.be.false; - const gatherer = new EnterForceIdeUri(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).equal(4); - expect(response.type).to.equal('CANCEL'); - expect(showErrorMessageSpy.calledOnce).to.be.true; - }); - - it('Should return cancel and show error if forceide url is missing login address', async () => { - expect(showErrorMessageSpy.calledTwice).to.be.false; - const gatherer = new EnterForceIdeUri(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).equal(5); - expect(response.type).to.equal('CANCEL'); - expect(showErrorMessageSpy.calledTwice).to.be.true; - }); - - it('Should add proper https:// prefix for url', async () => { - const gatherer = new EnterForceIdeUri(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).equal(6); - if (response.type === 'CONTINUE') { - expect(response.data.loginUrl).to.equal('https://' + LOGIN_URL); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should add proper http:// prefix for non-secure url', async () => { - const gatherer = new EnterForceIdeUri(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).equal(7); - if (response.type === 'CONTINUE') { - expect(response.data.loginUrl).to.equal('http://' + LOGIN_URL); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should accept valid URI', async () => { - const response = EnterForceIdeUri.uriValidator( - `forceide://abc?url=${LOGIN_URL}&sessionId=${SESSION_ID}` - ); - expect(response).to.be.null; - }); - - it('Should complain about invalid URI', async () => { - expect( - EnterForceIdeUri.uriValidator( - `forceide://abc?url=${LOGIN_URL}&missingSessionId` - ) - ).to.equal(nls.localize('parameter_gatherer_invalid_forceide_url')); - expect( - EnterForceIdeUri.uriValidator( - `forceide://abc?sessionId=${SESSION_ID}&missingUrl` - ) - ).to.equal(nls.localize('parameter_gatherer_invalid_forceide_url')); - expect( - EnterForceIdeUri.uriValidator('forceide://abc?url=&missingSessionId') - ).to.equal(nls.localize('parameter_gatherer_invalid_forceide_url')); - expect(EnterForceIdeUri.uriValidator('totaly-bogus')).to.equal( - nls.localize('parameter_gatherer_invalid_forceide_url') - ); - }); - }); - - describe('CLI Builder', () => { - it('Verify buildCreateProjectCommand', async () => { - const projectGenerateBuilder = new IsvDebugBootstrapExecutor(); - const createCommand = projectGenerateBuilder.buildCreateProjectCommand({ - loginUrl: LOGIN_URL, - sessionId: SESSION_ID, - orgName: PROJECT_NAME, - projectName: PROJECT_NAME, - projectUri: PROJECT_DIR[0].fsPath, - projectTemplate: projectTemplateEnum.standard - }); - expect(createCommand.toCommand()).to.equal( - `sf project:generate --name ${PROJECT_NAME} --output-dir ${PROJECT_DIR[0].fsPath} --template standard` - ); - expect(createCommand.description).to.equal( - nls.localize('isv_debug_bootstrap_create_project') - ); - }); - - it('Verify buildConfigureProjectCommand', async () => { - const forceProjectConfigBuilder = new IsvDebugBootstrapExecutor(); - const configureCommand = - forceProjectConfigBuilder.buildConfigureProjectCommand({ - loginUrl: LOGIN_URL, - sessionId: SESSION_ID, - orgName: PROJECT_NAME, - projectName: PROJECT_NAME, - projectUri: PROJECT_DIR[0].fsPath, - projectTemplate: projectTemplateEnum.standard - }); - expect(configureCommand.toCommand()).to.equal( - `sf config:set org-isv-debugger-sid=${SESSION_ID} org-isv-debugger-url=${LOGIN_URL} org-instance-url=${LOGIN_URL}` - ); - expect(configureCommand.description).to.equal( - nls.localize('isv_debug_bootstrap_configure_project') - ); - }); - - it('Verify buildQueryForOrgNamespacePrefixCommand', async () => { - const forceProjectConfigBuilder = new IsvDebugBootstrapExecutor(); - const command = - forceProjectConfigBuilder.buildQueryForOrgNamespacePrefixCommand({ - loginUrl: LOGIN_URL, - sessionId: SESSION_ID, - orgName: PROJECT_NAME, - projectName: PROJECT_NAME, - projectUri: PROJECT_DIR[0].fsPath, - projectTemplate: projectTemplateEnum.standard - }); - expect(command.toCommand()).to.equal( - `sf data:query --query SELECT NamespacePrefix FROM Organization LIMIT 1 --target-org ${SESSION_ID} --json` - ); - expect(command.description).to.equal( - nls.localize('isv_debug_bootstrap_configure_project_retrieve_namespace') - ); - }); - - it('Verify parseOrgNamespaceQueryResultJson', async () => { - const forceProjectConfigBuilder = new IsvDebugBootstrapExecutor(); - expect( - forceProjectConfigBuilder.parseOrgNamespaceQueryResultJson( - '{"status":0,"result":{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Organization","url":"/services/data/v42.0/sobjects/Organization/00D1F0000008gTUUAY"},"NamespacePrefix":null}]}}' - ) - ).to.equal(''); - expect( - forceProjectConfigBuilder.parseOrgNamespaceQueryResultJson( - '{"status":0,"result":{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Organization","url":"/services/data/v42.0/sobjects/Organization/00D1F0000008gTUUAY"},"NamespacePrefix":"abc"}]}}' - ) - ).to.equal('abc'); - }); - - it('Verify buildRetrieveOrgSourceCommand', async () => { - const builder = new IsvDebugBootstrapExecutor(); - const command = builder.buildRetrieveOrgSourceCommand({ - loginUrl: LOGIN_URL, - sessionId: SESSION_ID, - orgName: PROJECT_NAME, - projectName: PROJECT_NAME, - projectUri: PROJECT_DIR[0].fsPath, - projectTemplate: 'standard' - }); - expect(command.toCommand()).to.equal( - `sf project:retrieve:start --manifest ${builder.relativeApexPackageXmlPath} --target-org ${SESSION_ID}` - ); - expect(command.description).to.equal( - nls.localize('isv_debug_bootstrap_retrieve_org_source') - ); - }); - - it('Verify buildPackageInstalledListAsJsonCommand', async () => { - const builder = new IsvDebugBootstrapExecutor(); - const command = builder.buildPackageInstalledListAsJsonCommand({ - loginUrl: LOGIN_URL, - sessionId: SESSION_ID, - orgName: PROJECT_NAME, - projectName: PROJECT_NAME, - projectUri: PROJECT_DIR[0].fsPath, - projectTemplate: projectTemplateEnum.standard - }); - expect(command.toCommand()).to.equal( - `sf package:installed:list --target-org ${SESSION_ID} --json` - ); - expect(command.description).to.equal( - nls.localize('isv_debug_bootstrap_list_installed_packages') - ); - }); - - it('Verify buildRetrievePackageSourceCommand', async () => { - const packageName = 'mypackage_abc_mpackage_def'; - const builder = new IsvDebugBootstrapExecutor(); - const command = builder.buildRetrievePackageSourceCommand( - { - loginUrl: LOGIN_URL, - sessionId: SESSION_ID, - orgName: PROJECT_NAME, - projectName: PROJECT_NAME, - projectUri: PROJECT_DIR[0].fsPath, - projectTemplate: projectTemplateEnum.standard - }, - packageName - ); - expect(command.toCommand()).to.equal( - `sf project:retrieve:start --package-name ${packageName} --target-org ${SESSION_ID} --target-metadata-dir ${builder.relativeInstalledPackagesPath} --unzip --zip-file-name ${packageName}` - ); - expect(command.description).to.equal( - nls.localize('isv_debug_bootstrap_retrieve_package_source', packageName) - ); - }); - - it('Verify build does nothing', async () => { - const builder = new IsvDebugBootstrapExecutor(); - expect(builder.build.bind(builder, {})).to.throw('not in use'); - }); - }); - - describe('IsvDebugBootstrapExecutor execution', () => { - let executor: IsvDebugBootstrapExecutor; - let executeCommandSpy: sinon.SinonStub; - let vscodeCommandSpy: sinon.SinonStub; - const TEST_DATA_FOLDER = path.join( - __dirname, - '..', - '..', - '..', - '..', - '..', - 'test', - 'vscode-integration', - 'commands', - 'isvdebugger', - 'testdata' - ); - - beforeEach(() => { - executor = new IsvDebugBootstrapExecutor(); - executeCommandSpy = sinon.stub(executor, 'executeCommand'); - vscodeCommandSpy = sinon.stub(vscode.commands, 'executeCommand'); - }); - - afterEach(() => { - executeCommandSpy.restore(); - vscodeCommandSpy.restore(); - }); - - it('Should successfully pass through execution', async () => { - const projectPath = path.join(PROJECT_DIR[0].fsPath, PROJECT_NAME); - const projectMetadataTempPath = path.join( - projectPath, - executor.relativeMetadataTempPath - ); - const projectInstalledPackagesPath = path.join( - projectPath, - executor.relativeInstalledPackagesPath - ); - - // Setup old project data that should not be present upon completion - shell.mkdir('-p', path.join(projectInstalledPackagesPath, 'old-package')); - - // fake project setup - copy the original project into this clone - executeCommandSpy.onCall(0).callsFake(() => { - shell.cp( - '-R', - path.join(PROJECT_DIR[0].fsPath, ORIGINAL_PROJECT), - projectPath - ); - }); - - // fake namespace query - executeCommandSpy - .onCall(2) - .returns( - '{"status":0,"result":{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Organization","url":"/services/data/v42.0/sobjects/Organization/00D1F0000008gTUUAY"},"NamespacePrefix":null}]}}' - ); - - // fake package list retrieval - executeCommandSpy.onCall(4).returns( - JSON.stringify({ - status: 0, - result: [ - { - Id: '0A3xx000000000bCAA', - SubscriberPackageId: '033xx00000008cpAAA', - SubscriberPackageName: 'mypackage', - SubscriberPackageNamespace: 'developer', - SubscriberPackageVersionId: '04txx000000079pAAA', - SubscriberPackageVersionName: 'Third', - SubscriberPackageVersionNumber: '1.3.0.1' - } - ] - }) - ); - - // fake package metadata convert - executeCommandSpy.onCall(5).callsFake(() => { - shell.mkdir('-p', path.join(projectInstalledPackagesPath, 'mypackage')); - }); - - const input = { - type: 'CONTINUE', - data: { - loginUrl: LOGIN_URL, - sessionId: SESSION_ID, - projectName: PROJECT_NAME, - projectUri: PROJECT_DIR[0].fsPath - } - } as ContinueResponse; - await executor.execute(input); - expect(executeCommandSpy.callCount).to.equal(6); - expect(vscodeCommandSpy.callCount).to.equal(1); - - // there should be a launch config - expect( - fs.existsSync(path.join(projectPath, '.vscode', 'launch.json')), - 'there must be a launch.json file' - ).to.equal(true); - - // 'mypackage' should be an installed package - expect( - fs.existsSync(path.join(projectInstalledPackagesPath, 'mypackage')), - 'installed packages folder should be present' - ).to.equal(true); - - // there should be only one package in the installed-packages folder - const dirInfo = fs.readdirSync(projectInstalledPackagesPath); - expect( - dirInfo.length, - `There should only be one package installed at ${projectInstalledPackagesPath}` - ).to.equal(1); - - // any temp files should be gone - expect( - fs.existsSync(projectMetadataTempPath), - `folder ${projectMetadataTempPath} must be deleted` - ).to.equal(false); - - // Clean up project - shell.rm('-rf', projectPath); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/classes/DemoController.cls b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/classes/DemoController.cls deleted file mode 100644 index 81ea1c0b34..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/classes/DemoController.cls +++ /dev/null @@ -1,31 +0,0 @@ -public with sharing class DemoController { - /** - * An empty constructor for the testing - */ - public DemoController() {} - - /** - * Set the contact for the page using the lastName parameter, if there is one - */ - public DemoController(ApexPages.StandardController controller) { - // Get the last name from the url - String lastName = ApexPages.currentPage().getParameters().get('lastName'); - if (lastName != null) { - // Query the object - Contact theContact = [SELECT ID FROM Contact WHERE LastName = :lastName LIMIT 1]; - - developer.Logger log = new developer.Logger(); - log.log('Hello!'); - - // this will set the Id, so now you can use the standard controller and just reference fields on the page - ApexPages.currentPage().getParameters().put('id', theContact.Id); - } - } - - /** - * Get the version of the SFDX demo app - */ - public String getAppVersion() { - return '1.0.0'; - } -} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/classes/DemoController.cls-meta.xml b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/classes/DemoController.cls-meta.xml deleted file mode 100644 index 0d220c0d12..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/classes/DemoController.cls-meta.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - 43.0 - - 1 - 3 - developer - - Active - diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/package.xml b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/package.xml deleted file mode 100644 index 0eaf1cd8e8..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/org-source/package.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - * - ApexClass - - - * - ApexTrigger - - diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/Logger.cls b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/Logger.cls deleted file mode 100755 index a1f95aa308..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/Logger.cls +++ /dev/null @@ -1,15 +0,0 @@ -/* -This file is generated and isn't the actual source code for this -managed global class. -This read-only file shows the class's global constructors, -methods, variables, and properties. -To enable code to compile, all methods return null. -*/ -global class Logger { - global Logger() { - - } - global void log(String text) { - - } -} diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/Logger.cls-meta.xml b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/Logger.cls-meta.xml deleted file mode 100755 index 800e53cff0..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/Logger.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 43.0 - Active - diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/LoggerTest.cls b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/LoggerTest.cls deleted file mode 100755 index 9d1ae4484c..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/LoggerTest.cls +++ /dev/null @@ -1 +0,0 @@ -(hidden) \ No newline at end of file diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/LoggerTest.cls-meta.xml b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/LoggerTest.cls-meta.xml deleted file mode 100755 index 800e53cff0..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/classes/LoggerTest.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 43.0 - Active - diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/package.xml b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/package.xml deleted file mode 100755 index ea0de887cf..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/package.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - mypackage - Unrestricted - A sample test package. - developer - - Logger - LoggerTest - ApexClass - - - AccountLogger - ApexTrigger - - diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/triggers/AccountLogger.trigger b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/triggers/AccountLogger.trigger deleted file mode 100755 index 9d1ae4484c..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/triggers/AccountLogger.trigger +++ /dev/null @@ -1 +0,0 @@ -(hidden) \ No newline at end of file diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/triggers/AccountLogger.trigger-meta.xml b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/triggers/AccountLogger.trigger-meta.xml deleted file mode 100755 index 56f144ac65..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/isvdebugger/testdata/packages-source/mypackage/triggers/AccountLogger.trigger-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 43.0 - Active - diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/listMetadata.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/listMetadata.test.ts deleted file mode 100644 index ad0930426f..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/listMetadata.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { CommandOutput } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as sinon from 'sinon'; -import { listMetadata, ListMetadataExecutor } from '../../../src/commands'; - -describe('List Metadata', () => { - it('Should build list metadata command', async () => { - const metadataType = 'ApexClass'; - const targetOrg = 'test-username1@example.com'; - const listMetadataExec = new ListMetadataExecutor(metadataType, targetOrg); - const listMetadataCmd = listMetadataExec.build({}); - expect(listMetadataCmd.toCommand()).to.equal( - `sf org:list:metadata -m ${metadataType} -o ${targetOrg} --json` - ); - }); - - it('Should build list metadata command with folder arg', async () => { - const metadataType = 'Report'; - const targetOrg = 'test-username1@example.com'; - const folder = 'SampleFolder'; - const listMetadataExec = new ListMetadataExecutor( - metadataType, - targetOrg, - folder - ); - const describeMetadataCmd = listMetadataExec.build({}); - expect(describeMetadataCmd.toCommand()).to.equal( - `sf org:list:metadata -m ${metadataType} -o ${targetOrg} --json --folder ${folder}` - ); - }); - - it('Should write a file with metadata list output', async () => { - const outputFolder = '/test/folder/'; - const metadataType = 'ApexClass'; - const targetOrg = 'test-username1@example.com'; - const writeFileStub = sinon.stub(fs, 'writeFileSync'); - const resultData = '{status: 0}'; - const cmdOutputStub = sinon - .stub(CommandOutput.prototype, 'getCmdResult') - .returns(resultData); - const execStub = sinon.stub(ListMetadataExecutor.prototype, 'execute'); - const result = await listMetadata(metadataType, targetOrg, outputFolder); - expect(writeFileStub.calledOnce).to.equal(true); - expect(result).to.equal(resultData); - writeFileStub.restore(); - cmdOutputStub.restore(); - execStub.restore(); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/openDocumentation.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/openDocumentation.test.ts deleted file mode 100644 index 7d6f18a9df..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/openDocumentation.test.ts +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { openDocumentation } from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -const sb = createSandbox(); - -describe('openDocumentation', () => { - let activeTextEditorStub: SinonStub; - let openExternalStub: SinonStub; - - beforeEach(() => { - activeTextEditorStub = sb.stub(vscode.window, 'activeTextEditor'); - openExternalStub = sb.stub(vscode.env, 'openExternal'); - }); - - afterEach(() => { - sb.restore(); - }); - - it('should open the documentation for Aura', async () => { - const auraDocUrl = nls.localize('aura_doc_url'); - - activeTextEditorStub.get(() => ({ - document: { - fileName: - '/force-app/main/default/aura/exampleAuraComponent/exampleAuraComponent.cmp' - } - })); - - await openDocumentation(); - - expect(openExternalStub.getCall(0).args[0].toString()).to.equal(auraDocUrl); - }); - - it('should open the documentation for Apex class', async () => { - const apexDocUrl = nls.localize('apex_doc_url'); - - activeTextEditorStub.get(() => ({ - document: { - fileName: '/force-app/main/default/classes/exampleApexClass.cls' - } - })); - - await openDocumentation(); - - expect(openExternalStub.getCall(0).args[0].toString()).to.equal(apexDocUrl); - }); - - it('should open the documentation for Anonymous Apex', async () => { - const apexDocUrl = nls.localize('apex_doc_url'); - - activeTextEditorStub.get(() => ({ - document: { - fileName: '/scripts/apex/exampleApex.apex' - } - })); - - await openDocumentation(); - - expect(openExternalStub.getCall(0).args[0].toString()).to.equal(apexDocUrl); - }); - - it('should open the documentation for SOQL', async () => { - const soqlDocUrl = nls.localize('soql_doc_url'); - - activeTextEditorStub.get(() => ({ - document: { - fileName: '/scripts/soql/exampleSoql.soql' - } - })); - - await openDocumentation(); - - expect(openExternalStub.getCall(0).args[0].toString()).to.equal(soqlDocUrl); - }); - - it('should open the documentation for LWC', async () => { - const lwcDocUrl = nls.localize('lwc_doc_url'); - - activeTextEditorStub.get(() => ({ - document: { - fileName: - '/force-app/main/default/lwc/exampleLwcComponent/exampleLwcComponent.js' - } - })); - - await openDocumentation(); - - expect(openExternalStub.getCall(0).args[0].toString()).to.equal(lwcDocUrl); - }); - - it('should open the documentation for Functions', async () => { - const functionsDocUrl = nls.localize('functions_doc_url'); - - activeTextEditorStub.get(() => ({ - document: { - fileName: '/functions/example/index.js' - } - })); - - await openDocumentation(); - - expect(openExternalStub.getCall(0).args[0].toString()).to.equal( - functionsDocUrl - ); - }); - - it('should open the default documentation', async () => { - const defaultDocUrl = nls.localize('default_doc_url'); - - activeTextEditorStub.get(() => ({ - document: { - fileName: '/force-app/main/default/staticresources/example-image.png' - } - })); - - await openDocumentation(); - - expect(openExternalStub.getCall(0).args[0].toString()).to.equal( - defaultDocUrl - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgCreate.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgCreate.test.ts deleted file mode 100644 index b43ded6ea1..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgCreate.test.ts +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { AliasGatherer, OrgCreateExecutor } from '../../../src/commands'; -import { nls } from '../../../src/messages'; -import { workspaceUtils } from '../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Org Create', () => { - describe('Alias Gatherer', () => { - const EVENT_CANCEL = 'CANCEL'; - const EVENT_CONTINUE = 'CONTINUE'; - const TEST_ALIAS = 'testAlias'; - const TEST_WORKSPACE = 'sfsimple'; // FYI: This test uses the workspace created by the system tests to run - const TEST_ORG_EXPIRATION_DAYS = '7'; - const TEST_ORG_EXPIRATION_DAYS_PLUS_ONE_DAY = '8'; - const TEST_ORG_EXPIRATION_DAYS_INPUT_FLOAT = '8.2'; - const TEST_ORG_EXPIRATION_DAYS_INPUT_INVALID_RANGE = '31'; - let inputBoxSpy: sinon.SinonStub; - - beforeEach(() => { - inputBoxSpy = sinon.stub(vscode.window, 'showInputBox'); - }); - - afterEach(() => { - inputBoxSpy.restore(); - }); - - it('Should return cancel if alias is undefined', async () => { - inputBoxSpy.onCall(0).returns(undefined); - const gatherer = new AliasGatherer(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).to.equal(1); - expect(response.type).to.equal(EVENT_CANCEL); - }); - - it('Should return Continue with default alias if user input is empty string', async () => { - inputBoxSpy.onCall(0).returns(''); - inputBoxSpy.onCall(1).returns(TEST_ORG_EXPIRATION_DAYS); - const gatherer = new AliasGatherer(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).to.equal(2); - if (response.type === EVENT_CONTINUE) { - expect(response.data.alias).to.equal(TEST_WORKSPACE); - expect(response.data.expirationDays).to.equal(TEST_ORG_EXPIRATION_DAYS); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should consider an empty string as valid input for the alias', async () => { - inputBoxSpy.onCall(0).returns(''); - inputBoxSpy.onCall(1).returns(''); - await new AliasGatherer().gather(); - const opts = inputBoxSpy.getCall(0).args[0] as vscode.InputBoxOptions; - if (opts.validateInput) { - expect(opts.validateInput('')).to.be.null; - } else { - expect.fail('Alias input should have a validate function'); - } - }); - - it('Should consider an empty string as valid input for the expiration days', async () => { - inputBoxSpy.onCall(0).returns(''); - inputBoxSpy.onCall(1).returns(''); - await new AliasGatherer().gather(); - const opts = inputBoxSpy.getCall(1).args[0] as vscode.InputBoxOptions; - if (opts.validateInput) { - expect(opts.validateInput('')).to.be.null; - } else { - expect.fail('Expiration days input should have a validate function'); - } - }); - - it('Should return Continue with inputted alias if user input is not undefined or empty', async () => { - inputBoxSpy.onCall(0).returns(TEST_ALIAS); - inputBoxSpy.onCall(1).returns(TEST_ORG_EXPIRATION_DAYS_PLUS_ONE_DAY); - const gatherer = new AliasGatherer(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).to.equal(2); - expect(response.type).to.equal(EVENT_CONTINUE); - if (response.type === EVENT_CONTINUE) { - expect(response.data.alias).to.equal(TEST_ALIAS); - expect(response.data.expirationDays).to.equal( - TEST_ORG_EXPIRATION_DAYS_PLUS_ONE_DAY - ); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should return Continue with default scratch org expiration days if input is empty string', async () => { - inputBoxSpy.onCall(0).returns(TEST_ALIAS); - inputBoxSpy.onCall(1).returns(''); - const gatherer = new AliasGatherer(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).to.equal(2); - if (response.type === EVENT_CONTINUE) { - expect(response.data.expirationDays).to.equal(TEST_ORG_EXPIRATION_DAYS); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should return Cancel since the user canceled (pressed ESC) the process when defining the expiration for the scratch org', async () => { - inputBoxSpy.onCall(0).returns(TEST_ALIAS); - inputBoxSpy.onCall(1).returns(undefined); - const gatherer = new AliasGatherer(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).to.equal(2); - expect(response.type).to.equal(EVENT_CANCEL); - }); - }); - - describe('Org Create Builder', () => { - it('Should build the org create command', async () => { - const CONFIG_FILE = 'configFile.txt'; - const TEST_ALIAS = 'testAlias'; - const TEST_ORG_EXPIRATION_DAYS = '7'; - const forceOrgCreateBuilder = new OrgCreateExecutor(); - const createCommand = forceOrgCreateBuilder.build({ - file: path.join(workspaceUtils.getRootWorkspacePath(), CONFIG_FILE), - alias: TEST_ALIAS, - expirationDays: TEST_ORG_EXPIRATION_DAYS - }); - expect(createCommand.toCommand()).to.equal( - `sf org:create:scratch --definition-file ${CONFIG_FILE} --alias ${TEST_ALIAS} --duration-days ${TEST_ORG_EXPIRATION_DAYS} --set-default --json` - ); - expect(createCommand.description).to.equal( - nls.localize('org_create_default_scratch_org_text') - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgDelete.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgDelete.test.ts deleted file mode 100644 index 6e9a3e8532..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgDelete.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { OrgDeleteExecutor } from '../../../src/commands/orgDelete'; -import { nls } from '../../../src/messages'; - -describe('Org Delete', () => { - it('Should build the delete command with no flag', async () => { - const orgDelete = new OrgDeleteExecutor(); - const deleteCommand = orgDelete.build({}); - expect(deleteCommand.toCommand()).to.equal( - 'sf org:delete:scratch --no-prompt' - ); - expect(deleteCommand.description).to.equal( - nls.localize('org_delete_default_text') - ); - }); - - it('Should build the delete command with target-org flag', async () => { - const orgDelete = new OrgDeleteExecutor('--target-org'); - const deleteCommand = orgDelete.build({ username: 'test' }); - expect(deleteCommand.toCommand()).to.equal( - 'sf org:delete:scratch --no-prompt --target-org test' - ); - expect(deleteCommand.description).to.equal( - nls.localize('org_delete_username_text') - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgDisplay.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgDisplay.test.ts deleted file mode 100644 index bdbc13ddb4..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgDisplay.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { OrgDisplay } from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Status', () => { - it('Should build the source command no flag', async () => { - const orgDisplay = new OrgDisplay(); - const displayCommand = orgDisplay.build({}); - expect(displayCommand.toCommand()).to.equal('sf org:display'); - expect(displayCommand.description).to.equal( - nls.localize('org_display_default_text') - ); - }); - it('Should build the source command with target-org flag', async () => { - const orgDisplay = new OrgDisplay('--target-org'); - const displayCommand = orgDisplay.build({ username: 'test' }); - expect(displayCommand.toCommand()).to.equal( - 'sf org:display --target-org test' - ); - expect(displayCommand.description).to.equal( - nls.localize('org_display_username_text') - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgList.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgList.test.ts deleted file mode 100644 index 262f9f9ced..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgList.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { OrgListExecutor } from '../../../src/commands/orgList'; -import { nls } from '../../../src/messages'; - -describe('Org List', () => { - it('Should build the list command with --clean option', async () => { - const orgList = new OrgListExecutor(); - const listCommand = orgList.build({}); - expect(listCommand.toCommand()).to.equal('sf org:list --clean --no-prompt'); - expect(listCommand.description).to.equal( - nls.localize('org_list_clean_text') - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgOpen.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgOpen.test.ts deleted file mode 100644 index 25bed4a869..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgOpen.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { - getExecutor, - OrgOpenContainerExecutor, - OrgOpenExecutor -} from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Org Open', () => { - it('should build the org open command', () => { - const orgOpenContainer = new OrgOpenExecutor(); - const orgOpenCommand = orgOpenContainer.build({}); - - expect(orgOpenCommand.toCommand()).to.equal('sf org:open'); - expect(orgOpenCommand.description).to.equal( - nls.localize('org_open_default_scratch_org_text') - ); - }); - - it('should build the org open command for use in a container', () => { - const orgOpenContainer = new OrgOpenContainerExecutor(); - const orgOpenCommand = orgOpenContainer.build({}); - - expect(orgOpenCommand.toCommand()).to.equal( - 'sf org:open --url-only --json' - ); - expect(orgOpenCommand.description).to.equal( - nls.localize('org_open_default_scratch_org_text') - ); - }); - - describe('Executor is chosen based on environment', () => { - afterEach(() => { - delete process.env.SF_CONTAINER_MODE; - }); - it('should use OrgOpenExecutor if container mode is not defined', () => { - expect(getExecutor()).to.be.instanceOf(OrgOpenExecutor); - }); - it('should use OrgOpenExecutor if container mode is empty', () => { - process.env.SF_CONTAINER_MODE = ''; - expect(getExecutor()).to.be.instanceOf(OrgOpenExecutor); - }); - - it('should use OrgOpenContainerExecutor if container mode is defined', () => { - process.env.SF_CONTAINER_MODE = 'true'; - expect(getExecutor()).to.be.instanceOf(OrgOpenContainerExecutor); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/packageInstall.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/packageInstall.test.ts deleted file mode 100644 index 39a2043f11..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/packageInstall.test.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - PackageInstallExecutor, - SelectInstallationKey, - SelectPackageID -} from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Package Install', () => { - describe('SelectPackageID Gatherer', () => { - const EVENT_CANCEL = 'CANCEL'; - const EVENT_CONTINUE = 'CONTINUE'; - const TEST_PACKAGE_ID = 'testPackageID'; - let inputBoxSpy: sinon.SinonStub; - - beforeEach(() => { - inputBoxSpy = sinon.stub(vscode.window, 'showInputBox'); - }); - - afterEach(() => { - inputBoxSpy.restore(); - }); - - it('Should return cancel if package ID is undefined', async () => { - inputBoxSpy.onCall(0).returns(undefined); - const gatherer = new SelectPackageID(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).to.equal(1); - expect(response.type).to.equal(EVENT_CANCEL); - }); - - it('Should return cancel if packageId is empty string', async () => { - inputBoxSpy.onCall(0).returns(''); - const gatherer = new SelectPackageID(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).to.equal(1); - expect(response.type).to.equal(EVENT_CANCEL); - }); - - it('Should return Continue with packageId if user input is non-empty string', async () => { - inputBoxSpy.onCall(0).returns(TEST_PACKAGE_ID); - const gatherer = new SelectPackageID(); - const response = await gatherer.gather(); - if (response.type === EVENT_CONTINUE) { - expect(response.data.packageId).to.equal(TEST_PACKAGE_ID); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - }); - describe('SelectInstallationKey Gatherer', () => { - const EVENT_CANCEL = 'CANCEL'; - const EVENT_CONTINUE = 'CONTINUE'; - const TEST_INSTALLATION_KEY = 'testInstallationKey'; - let inputBoxSpy: sinon.SinonStub; - - beforeEach(() => { - inputBoxSpy = sinon.stub(vscode.window, 'showInputBox'); - }); - - afterEach(() => { - inputBoxSpy.restore(); - }); - - it('Should return Continue with installation key if user input is string', async () => { - inputBoxSpy.onCall(0).returns(TEST_INSTALLATION_KEY); - const gatherer = new SelectInstallationKey(); - const response = await gatherer.gather(); - if (response.type === EVENT_CONTINUE) { - expect(response.data.installationKey).to.equal(TEST_INSTALLATION_KEY); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should return cancel if installation key is undefined', async () => { - inputBoxSpy.onCall(0).returns(undefined); - const gatherer = new SelectInstallationKey(); - const response = await gatherer.gather(); - expect(inputBoxSpy.callCount).to.equal(1); - expect(response.type).to.equal(EVENT_CANCEL); - }); - - it('Should return Continue with installation key if user input is empty string', async () => { - inputBoxSpy.onCall(0).returns(''); - const gatherer = new SelectInstallationKey(); - const response = await gatherer.gather(); - if (response.type === EVENT_CONTINUE) { - expect(response.data.installationKey).to.equal(''); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - }); - describe('Package Install Builder', () => { - it('Should build the package install command', async () => { - const TEST_PACKAGE_ID = 'testPackageID'; - const TEST_INSTALLATION_KEY = 'testInstallationKey'; - const packageInstallExecutor = new PackageInstallExecutor(); - const createCommand = packageInstallExecutor.build({ - packageId: TEST_PACKAGE_ID, - installationKey: TEST_INSTALLATION_KEY - }); - expect(createCommand.toCommand()).to.equal( - `sf package:install --package ${TEST_PACKAGE_ID} --installation-key ${TEST_INSTALLATION_KEY}` - ); - expect(createCommand.description).to.equal( - nls.localize('package_install_text') - ); - }); - it('Should build the package install command without installation key', async () => { - const TEST_PACKAGE_ID = 'testPackageID'; - const TEST_INSTALLATION_KEY = ''; - const packageInstallExecutor = new PackageInstallExecutor(); - const createCommand = packageInstallExecutor.build({ - packageId: TEST_PACKAGE_ID, - installationKey: TEST_INSTALLATION_KEY - }); - expect(createCommand.toCommand()).to.equal( - `sf package:install --package ${TEST_PACKAGE_ID}` - ); - expect(createCommand.description).to.equal( - nls.localize('package_install_text') - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectDeployStartInteg.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectDeployStartInteg.test.ts deleted file mode 100644 index 2e864975a5..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectDeployStartInteg.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { ProjectDeployStartExecutor } from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -describe('Project Deploy Start', () => { - const commonParams = '--json'; - it('Should build the project deploy start command with no flag', async () => { - const projectDeployStartNoFlag = new ProjectDeployStartExecutor(); - const projectDeployStartCommand = projectDeployStartNoFlag.build({}); - expect(projectDeployStartCommand.toCommand()).to.equal( - `sf ${projectDeployStartNoFlag.params.command} ${commonParams}` - ); - expect(projectDeployStartCommand.description).to.equal( - nls.localize('project_deploy_start_default_org_text') - ); - }); - - it('Should build the project deploy start command with ignore conflicts flag', async () => { - const projectDeployStartIgnoreConflicts = new ProjectDeployStartExecutor( - '--ignore-conflicts' - ); - const projectDeployStartCommand = projectDeployStartIgnoreConflicts.build( - {} - ); - expect(projectDeployStartCommand.toCommand()).to.equal( - `sf ${projectDeployStartIgnoreConflicts.params.command} ${commonParams} --ignore-conflicts` - ); - expect(projectDeployStartCommand.description).to.equal( - nls.localize('project_deploy_start_ignore_conflicts_default_org_text') - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectDeployStartResultParser.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectDeployStartResultParser.test.ts deleted file mode 100644 index 235b816ec0..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectDeployStartResultParser.test.ts +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - CONFLICT_ERROR_NAME, - ProjectDeployStartResultParser, - ProjectDeployStartErrorResponse, - ProjectDeployStartSuccessResponse, - ProjectDeployStartResult -} from '@salesforce/salesforcedx-utils-vscode'; -import { Row, Table } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { stub } from 'sinon'; -import { channelService } from '../../../src/channels'; -import { ProjectDeployStartExecutor } from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -describe('Correctly output deploy results', () => { - let errorsStub: sinon.SinonStub; - let successesStub: sinon.SinonStub; - let channelServiceStub: sinon.SinonStub; - let output = ''; - const table = new Table(); - let deploySuccess: ProjectDeployStartSuccessResponse; - let deployError: ProjectDeployStartErrorResponse; - - beforeEach(() => { - output = ''; - errorsStub = stub(ProjectDeployStartResultParser.prototype, 'getErrors'); - successesStub = stub( - ProjectDeployStartResultParser.prototype, - 'getSuccesses' - ); - channelServiceStub = stub(channelService, 'appendLine'); - channelServiceStub.callsFake(line => (output += line + '\n')); - deploySuccess = { - status: 0, - result: { - files: [ - { - state: 'Add', - type: 'ApexClass', - fullName: 'MyClass', - filePath: 'src/classes/MyClass.cls' - } - ] - } - }; - deployError = { - status: 1, - name: 'Deploy Failed', - message: 'There was a failure', - warnings: ['A warning'], - files: [ - { - filePath: 'src/classes/MyClass2.cls', - error: 'Some Error' - } as ProjectDeployStartResult - ] - }; - }); - - afterEach(() => { - errorsStub.restore(); - successesStub.restore(); - channelServiceStub.restore(); - }); - - it('Should show correct heading for project:deploy:start operation', () => { - successesStub.returns(deploySuccess); - errorsStub.returns(undefined); - - const executor = new ProjectDeployStartExecutor(); - executor.outputResult(new ProjectDeployStartResultParser('{}')); - - const successTable = table.createTable( - deploySuccess.result.files as unknown as Row[], - [ - { key: 'state', label: nls.localize('table_header_state') }, - { key: 'fullName', label: nls.localize('table_header_full_name') }, - { key: 'type', label: nls.localize('table_header_type') }, - { key: 'filePath', label: nls.localize('table_header_project_path') } - ], - nls.localize('table_title_pushed_source') - ); - expect(output).to.be.equal(`${successTable}\n`); - }); - - it('Should show no results found for project:deploy:start operation with no new source', () => { - successesStub.returns({ status: 0, result: { files: [] } }); - errorsStub.returns(undefined); - - const executor = new ProjectDeployStartExecutor(); - executor.outputResult(new ProjectDeployStartResultParser('{}')); - - const successTable = table.createTable( - [], - [ - { key: 'state', label: nls.localize('table_header_state') }, - { key: 'fullName', label: nls.localize('table_header_full_name') }, - { key: 'type', label: nls.localize('table_header_type') }, - { key: 'filePath', label: nls.localize('table_header_project_path') } - ], - nls.localize('table_title_pushed_source') - ); - const expectedOutput = `${successTable}\n${nls.localize( - 'table_no_results_found' - )}\n\n`; - expect(output).to.be.equal(expectedOutput); - }); - - it('Should show error name and message if there are no results', () => { - successesStub.returns(undefined); - errorsStub.returns({ - status: 1, - name: 'Deploy Failed', - message: 'An error has occurred' - }); - - const executor = new ProjectDeployStartExecutor(); - executor.outputResult(new ProjectDeployStartResultParser('{}')); - expect(output).to.be.equal('Deploy Failed: An error has occurred\n\n'); - }); - - it('Should show deploy conflicts correctly', () => { - const hasConflictsStub = stub( - ProjectDeployStartResultParser.prototype, - 'hasConflicts' - ).returns(true); - deployError.name = CONFLICT_ERROR_NAME; - deployError.files = [ - { - state: 'Conflict', - fullName: 'SomeClass', - type: 'ApexClass', - filePath: 'some/class/path' - } - ]; - errorsStub.returns(deployError); - const conflictsTable = table.createTable( - deployError.files as unknown as Row[], - [ - { key: 'state', label: nls.localize('table_header_state') }, - { key: 'fullName', label: nls.localize('table_header_full_name') }, - { key: 'type', label: nls.localize('table_header_type') }, - { key: 'filePath', label: nls.localize('table_header_project_path') } - ] - ); - const expectedOutput = `${nls.localize( - 'push_conflicts_error' - )}\n\n${conflictsTable}\n`; - const executor = new ProjectDeployStartExecutor(); - executor.outputResult(new ProjectDeployStartResultParser('{}')); - - expect(output).to.be.equal(expectedOutput); - - hasConflictsStub.restore(); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectGenerate.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectGenerate.test.ts deleted file mode 100644 index 4b871bc8fc..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectGenerate.test.ts +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - CancelResponse, - ContinueResponse -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import { SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../src/channels'; -import { - PathExistsChecker, - ProjectNameAndPathAndTemplate, - ProjectTemplateItem, - SelectProjectFolder, - SelectProjectName, - SelectProjectTemplate, - projectGenerateWithManifest, - projectTemplateEnum, - sfProjectGenerate -} from '../../../src/commands'; -import { ProjectName } from '../../../src/commands/projectGenerate'; -import { nls } from '../../../src/messages'; -import { notificationService } from '../../../src/notifications'; -import { telemetryService } from '../../../src/telemetry'; -import { workspaceUtils } from '../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Project Generate', () => { - const PROJECT_NAME = 'sfdx-simple'; - const rootWorkspacePath = workspaceUtils.getRootWorkspacePath(); - const PROJECT_NAME_WITH_LEADING_TRAILING_SPACES = ` ${PROJECT_NAME} `; - const WORKSPACE_PATH = path.join(rootWorkspacePath, '..'); - const PROJECT_DIR: vscode.Uri[] = [vscode.Uri.parse(WORKSPACE_PATH)]; - - describe('SelectProjectTemplate Gatherer', () => { - let quickPickSpy: sinon.SinonStub; - - before(() => { - quickPickSpy = sinon.stub(vscode.window, 'showQuickPick'); - quickPickSpy.onCall(0).returns(undefined); - quickPickSpy.onCall(1).returns(''); - quickPickSpy - .onCall(2) - .returns( - new ProjectTemplateItem( - 'project_generate_analytics_template_display_text', - 'project_generate_analytics_template' - ) - ); - }); - - after(() => { - quickPickSpy.restore(); - }); - - it('Should return cancel if project template is undefined', async () => { - const gatherer = new SelectProjectTemplate(); - const response = await gatherer.gather(); - expect(quickPickSpy.calledOnce).to.be.true; - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return cancel if user input is empty string', async () => { - const gatherer = new SelectProjectTemplate(); - const response = await gatherer.gather(); - expect(quickPickSpy.calledTwice).to.be.true; - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Continue with inputted project template if project template set', async () => { - const gatherer = new SelectProjectTemplate(); - const response = await gatherer.gather(); - expect(quickPickSpy.calledThrice).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.projectTemplate).to.equal( - projectTemplateEnum.analytics - ); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - }); - - describe('SelectProjectName Gatherer', () => { - let gatherer: SelectProjectName; - let inputBoxStub: sinon.SinonStub; - const isContinueResponse = ( - response: CancelResponse | ContinueResponse - ): response is ContinueResponse => { - return (response as ContinueResponse).data !== undefined; - }; - - beforeEach(() => { - gatherer = new SelectProjectName(); - inputBoxStub = sinon.stub(vscode.window, 'showInputBox'); - }); - - afterEach(() => { - inputBoxStub.restore(); - }); - - it('Should make one call to showInputBox', async () => { - inputBoxStub.returns(undefined); - const response = await gatherer.gather(); - expect(inputBoxStub.calledOnce).to.be.true; - }); - - it('Should return cancel if project name is undefined', async () => { - inputBoxStub.returns(undefined); - const response = await gatherer.gather(); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return cancel if user input is empty string', async () => { - inputBoxStub.returns(''); - const response = await gatherer.gather(); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Continue with inputted project name if project name is not undefined or empty', async () => { - inputBoxStub.returns(PROJECT_NAME); - - const response = await gatherer.gather(); - - expect(isContinueResponse(response)).to.equal(true); - if (isContinueResponse(response)) { - expect(response.type).to.equal('CONTINUE'); - expect(response.data.projectName).to.equal(PROJECT_NAME); - } - }); - - it('Should return Continue with trimmed project name if project name input has leading and or trailing spaces', async () => { - inputBoxStub.returns(PROJECT_NAME_WITH_LEADING_TRAILING_SPACES); - - const response = await gatherer.gather(); - - expect(isContinueResponse(response)).to.equal(true); - if (isContinueResponse(response)) { - expect(response.type).to.equal('CONTINUE'); - expect(response.data.projectName).to.equal(PROJECT_NAME); - } - }); - }); - - describe('SelectProjectFolder Gatherer', () => { - let showOpenDialogSpy: sinon.SinonStub; - - before(() => { - // showOpenDialog only returns the path or undefined - showOpenDialogSpy = sinon.stub(vscode.window, 'showOpenDialog'); - showOpenDialogSpy.onCall(0).returns(undefined); - showOpenDialogSpy.onCall(1).returns(PROJECT_DIR); - }); - - after(() => { - showOpenDialogSpy.restore(); - }); - - it('Should return cancel if project uri is undefined', async () => { - const gatherer = new SelectProjectFolder(); - const response = await gatherer.gather(); - expect(showOpenDialogSpy.calledOnce).to.be.true; - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Continue with inputted project name if project name is not undefined or empty', async () => { - const gatherer = new SelectProjectFolder(); - const response = await gatherer.gather(); - expect(showOpenDialogSpy.calledTwice).to.be.true; - if (response.type === 'CONTINUE') { - expect(response.data.projectUri).to.equal(PROJECT_DIR[0].fsPath); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - }); - - describe('PathExistsChecker PostCondition', () => { - let showWarningBoxSpy: sinon.SinonStub; - - before(() => { - showWarningBoxSpy = sinon.stub(vscode.window, 'showWarningMessage'); - showWarningBoxSpy - .onCall(0) - .returns(nls.localize('warning_prompt_overwrite_cancel')); - showWarningBoxSpy - .onCall(1) - .returns(nls.localize('warning_prompt_overwrite')); - }); - - after(() => { - showWarningBoxSpy.restore(); - }); - - it('Should return cancel if project path is in use and user selects No', async () => { - const checker = new PathExistsChecker(); - const response = await checker.check({ - type: 'CONTINUE', - data: { - projectName: PROJECT_NAME, - projectUri: PROJECT_DIR[0].fsPath, - projectTemplate: projectTemplateEnum.standard - } - }); - expect(showWarningBoxSpy.calledOnce).to.be.true; - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return inputs if project path is in use and user selects No', async () => { - const checker = new PathExistsChecker(); - const inputs: ContinueResponse = { - type: 'CONTINUE', - data: { - projectName: PROJECT_NAME, - projectUri: PROJECT_DIR[0].fsPath, - projectTemplate: projectTemplateEnum.standard - } - }; - const response = await checker.check(inputs); - expect(showWarningBoxSpy.calledTwice).to.be.true; - expect(response.type).to.equal('CONTINUE'); - if (response.type === 'CONTINUE') { - expect(response.data).to.equal(inputs.data); - } - }); - - it('Should return inputs if project path is not in use', async () => { - const checker = new PathExistsChecker(); - const inputs: ContinueResponse = { - type: 'CONTINUE', - data: { - projectName: 'someOtherProject', - projectUri: PROJECT_DIR[0].fsPath, - projectTemplate: projectTemplateEnum.standard - } - }; - const response = await checker.check(inputs); - expect(showWarningBoxSpy.calledThrice).to.be.false; - expect(response.type).to.equal('CONTINUE'); - if (response.type === 'CONTINUE') { - expect(response.data).to.equal(inputs.data); - } - }); - }); - - describe('Project Generate', () => { - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let openDialogStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let executeCommandStub: SinonStub; - let sendCommandEventStub: SinonStub; - let showWarningStub: SinonStub; - - beforeEach(() => { - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - openDialogStub = stub(vscode.window, 'showOpenDialog'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub( - notificationService, - 'showFailedExecution' - ); - executeCommandStub = stub(vscode.commands, 'executeCommand'); - sendCommandEventStub = stub(telemetryService, 'sendCommandEvent'); - showWarningStub = stub(vscode.window, 'showWarningMessage'); - }); - - afterEach(() => { - showInputBoxStub.restore(); - quickPickStub.restore(); - openDialogStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - executeCommandStub.restore(); - sendCommandEventStub.restore(); - showWarningStub.restore(); - }); - - it('Should Generate Project', async () => { - // arrange - const projectPath = path.join(rootWorkspacePath, 'TestProject'); - shell.rm('-rf', projectPath); - assert.noFile(projectPath); - - quickPickStub.returns({ - label: nls.localize('project_generate_standard_template_display_text') - }); - showInputBoxStub.returns('TestProject'); - openDialogStub.returns([vscode.Uri.file(path.join(rootWorkspacePath))]); - - // act - await sfProjectGenerate(); - - const standardfolderarray = [ - 'aura', - 'applications', - 'classes', - 'contentassets', - 'flexipages', - 'layouts', - 'objects', - 'permissionsets', - 'staticresources', - 'tabs', - 'triggers' - ]; - const filestocopy = [ - '.forceignore', - '.gitignore', - '.prettierignore', - '.prettierrc', - 'package.json' - ]; - const vscodearray = ['extensions', 'launch', 'settings']; - assert.file([ - path.join( - rootWorkspacePath, - 'TestProject', - 'config', - 'project-scratch-def.json' - ) - ]); - assert.file([ - path.join( - rootWorkspacePath, - 'TestProject', - 'scripts', - 'soql', - 'account.soql' - ) - ]); - assert.file([ - path.join( - rootWorkspacePath, - 'TestProject', - 'scripts', - 'apex', - 'hello.apex' - ) - ]); - assert.file([path.join(rootWorkspacePath, 'TestProject', 'README.md')]); - assert.file([ - path.join(rootWorkspacePath, 'TestProject', 'sfdx-project.json') - ]); - assert.fileContent( - path.join(rootWorkspacePath, 'TestProject', 'sfdx-project.json'), - '"namespace": "",' - ); - assert.fileContent( - path.join(rootWorkspacePath, 'TestProject', 'sfdx-project.json'), - '"path": "force-app",' - ); - assert.fileContent( - path.join(rootWorkspacePath, 'TestProject', 'sfdx-project.json'), - 'sourceApiVersion' - ); - assert.fileContent( - path.join(rootWorkspacePath, 'TestProject', 'sfdx-project.json'), - '"sfdcLoginUrl": "https://login.salesforce.com"' - ); - - for (const file of vscodearray) { - assert.file([ - path.join(rootWorkspacePath, 'TestProject', '.vscode', `${file}.json`) - ]); - } - assert.file([ - path.join( - rootWorkspacePath, - 'TestProject', - 'force-app', - 'main', - 'default', - 'lwc', - '.eslintrc.json' - ) - ]); - assert.file([ - path.join( - rootWorkspacePath, - 'TestProject', - 'force-app', - 'main', - 'default', - 'aura', - '.eslintrc.json' - ) - ]); - for (const file of filestocopy) { - assert.file([path.join(rootWorkspacePath, 'TestProject', file)]); - } - for (const folder of standardfolderarray) { - assert.file( - path.join( - rootWorkspacePath, - 'TestProject', - 'force-app', - 'main', - 'default', - folder - ) - ); - } - - // clean up - shell.rm('-rf', projectPath); - }); - - it('Should Generate Project with manifest', async () => { - // arrange - const projectPath = path.join(rootWorkspacePath, 'TestProject'); - shell.rm('-rf', projectPath); - assert.noFile(projectPath); - - quickPickStub.returns({ - label: nls.localize('project_generate_standard_template_display_text') - }); - showInputBoxStub.returns('TestProject'); - openDialogStub.returns([vscode.Uri.file(path.join(rootWorkspacePath))]); - - // act - await projectGenerateWithManifest(); - - assert.file([ - path.join(rootWorkspacePath, 'TestProject', 'manifest', 'package.xml') - ]); - - // clean up - shell.rm('-rf', projectPath); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectGenerateManifest.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectGenerateManifest.test.ts deleted file mode 100644 index ca373f7db9..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectGenerateManifest.test.ts +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; -import { fail } from 'assert'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as sinon from 'sinon'; -import { createSandbox } from 'sinon'; -import * as util from 'util'; -import * as vscode from 'vscode'; -import { GenerateManifestExecutor } from '../../../src/commands/projectGenerateManifest'; -import { nls } from '../../../src/messages'; - -const classPath = '/force-app/main/default/classes/'; -const CLASS_1 = 'Apex1'; -const CLASS_2 = 'Apex2'; -const URI_1 = vscode.Uri.parse(classPath + CLASS_1); -const URI_2 = vscode.Uri.parse(classPath + CLASS_2); -const EMPTY_MANIFEST = ` - - %s - 53.0 -`; -const APEX_MANIFEST = util.format( - EMPTY_MANIFEST, - ` - - %s - ApexClass -` -); - -const env = createSandbox(); -let openTextDocumentSpy: sinon.SinonSpy; - -describe('Project Generate Manifest', () => { - describe('Happy Path Unit Tests', () => { - beforeEach(() => { - openTextDocumentSpy = env.spy(vscode.workspace, 'openTextDocument'); - }); - - afterEach(() => { - env.restore(); - }); - - it('Should create first manifest from single sourceUri', async () => { - const packageXML = util.format( - APEX_MANIFEST, - `${CLASS_1}` - ); - env.stub(ComponentSet, 'fromSource').returns({ - getPackageXml: () => { - return packageXML; - } - }); - env.stub(fs, 'existsSync').returns(false); - env.stub(fs, 'mkdirSync').returns(undefined); - env.stub(fs, 'writeFileSync').returns(undefined); - const packageName = 'package' + generateRandomSuffix() + '.xml'; - const executor = new GenerateManifestExecutor( - [URI_1.fsPath], - packageName - ); - await executor.run({ - type: 'CONTINUE', - data: '' - }); - - expect(openTextDocumentSpy.calledOnce).to.equal(true); - }); - - it('Should create manifest from list of uris', async () => { - const packageXML = util.format( - APEX_MANIFEST, - `${CLASS_1}\n${CLASS_2}\n` - ); - env.stub(ComponentSet, 'fromSource').returns({ - getPackageXml: () => { - return packageXML; - } - }); - env - .stub(fs, 'existsSync') - .onFirstCall() - .returns(true) - .onSecondCall() - .returns(false); - env.stub(fs, 'writeFileSync').returns(undefined); - const packageName = 'package' + generateRandomSuffix() + '.xml'; - const executor = new GenerateManifestExecutor( - [URI_1.fsPath, URI_2.fsPath], - packageName - ); - await executor.run({ - type: 'CONTINUE', - data: '' - }); - - expect(openTextDocumentSpy.calledOnce).to.equal(true); - }); - - it('Should create but not save manifest if cancelled', async () => { - const writeFileSpy = env.spy(fs, 'writeFileSync'); - const packageXML = util.format( - APEX_MANIFEST, - `${CLASS_1}\n${CLASS_2}\n` - ); - env.stub(ComponentSet, 'fromSource').returns({ - getPackageXml: () => { - return packageXML; - } - }); - env - .stub(fs, 'existsSync') - .onFirstCall() - .returns(true) - .onSecondCall() - .returns(false); - const executor = new GenerateManifestExecutor( - [URI_1.fsPath, URI_2.fsPath], - undefined - ); - await executor.run({ - type: 'CONTINUE', - data: '' - }); - - expect(openTextDocumentSpy.calledOnce).to.equal(true); - expect(writeFileSpy.called).to.equal(false); - }); - - it('Should use default manifest name if none is supplied', async () => { - const packageXML = util.format( - APEX_MANIFEST, - `${CLASS_1}\n${CLASS_2}\n` - ); - env.stub(ComponentSet, 'fromSource').returns({ - getPackageXml: () => { - return packageXML; - } - }); - env - .stub(fs, 'existsSync') - .onFirstCall() - .returns(true) - .onSecondCall() - .returns(false); - env.stub(fs, 'writeFileSync').returns(undefined); - const executor = new GenerateManifestExecutor( - [URI_1.fsPath, URI_2.fsPath], - '' - ); - await executor.run({ - type: 'CONTINUE', - data: '' - }); - - expect(openTextDocumentSpy.calledOnce).to.equal(true); - const pathArg = openTextDocumentSpy.getCalls()[0].args[0]; - expect(pathArg).to.contain('package.xml'); - }); - - it('Should append correct extension', async () => { - const packageXML = util.format( - APEX_MANIFEST, - `${CLASS_1}\n${CLASS_2}\n` - ); - env.stub(ComponentSet, 'fromSource').returns({ - getPackageXml: () => { - return packageXML; - } - }); - env - .stub(fs, 'existsSync') - .onFirstCall() - .returns(true) - .onSecondCall() - .returns(false); - env.stub(fs, 'writeFileSync').returns(undefined); - const randomSuffix = generateRandomSuffix(); - const packageName = 'package' + randomSuffix + '.txt'; - const executor = new GenerateManifestExecutor( - [URI_1.fsPath, URI_2.fsPath], - packageName - ); - await executor.run({ - type: 'CONTINUE', - data: '' - }); - - expect(openTextDocumentSpy.calledOnce).to.equal(true); - const pathArg = openTextDocumentSpy.getCalls()[0].args[0]; - expect(pathArg).to.contain('package' + randomSuffix + '.xml'); - }); - - it('Should not throw an exception for an empty xml', async () => { - const packageXML = util.format(EMPTY_MANIFEST, ''); - env.stub(ComponentSet, 'fromSource').returns({ - getPackageXml: () => { - return packageXML; - } - }); - env - .stub(fs, 'existsSync') - .onFirstCall() - .returns(true) - .onSecondCall() - .returns(false); - const executor = new GenerateManifestExecutor( - [URI_1.fsPath, URI_2.fsPath], - undefined - ); - await executor.run({ - type: 'CONTINUE', - data: '' - }); - - expect(openTextDocumentSpy.calledOnce).to.equal(true); - }); - }); - - describe('Exception Handling Unit Tests', () => { - beforeEach(() => { - openTextDocumentSpy = env.spy(vscode.workspace, 'openTextDocument'); - }); - - afterEach(() => { - env.restore(); - }); - - it('Should handle exception while creating component set', async () => { - env - .stub(ComponentSet, 'fromSource') - .throws(new Error(nls.localize('error_creating_packagexml'))); - let exceptionThrown = false; - try { - const executor = new GenerateManifestExecutor( - [URI_1.fsPath, URI_2.fsPath], - '' - ); - await executor.run({ - type: 'CONTINUE', - data: '' - }); - - fail('Should have thrown exception'); - } catch (e) { - expect(e.message).to.contain('package.xml'); - exceptionThrown = true; - } - expect(exceptionThrown).to.equal(true); - expect(openTextDocumentSpy.called).to.equal(false); - }); - - it('Should enforce unique manifest names', async () => { - const packageXML = util.format( - APEX_MANIFEST, - `${CLASS_1}` - ); - env.stub(ComponentSet, 'fromSource').returns({ - getPackageXml: () => { - return packageXML; - } - }); - env.stub(fs, 'existsSync').returns(true); - const fileName = 'duplicatePackageName'; - - let exceptionThrown = false; - try { - const executor = new GenerateManifestExecutor([URI_1.fsPath], fileName); - await executor.run({ - type: 'CONTINUE', - data: '' - }); - } catch (e) { - exceptionThrown = true; - expect(e.message).to.contain(fileName); - } - expect(exceptionThrown).to.equal(true); - expect(openTextDocumentSpy.called).to.equal(false); - }); - }); -}); - -function generateRandomSuffix() { - return (Date.now() + Math.round(Math.random() * 1000)).toString(); -} diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectRetrieveStartInteg.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectRetrieveStartInteg.test.ts deleted file mode 100644 index bd0ad9d473..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/projectRetrieveStartInteg.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { ProjectRetrieveStartExecutor } from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -describe('Project Retrieve Start', () => { - it('Should build the source pull command with the --json flag', async () => { - const projectRetrieveStartNoFlag = new ProjectRetrieveStartExecutor(); - const projectRetrieveStartCommand = projectRetrieveStartNoFlag.build({}); - expect(projectRetrieveStartCommand.toCommand()).to.equal( - 'sf project:retrieve:start --json' - ); - expect(projectRetrieveStartCommand.description).to.equal( - nls.localize('project_retrieve_start_default_org_text') - ); - }); - - it('Should build the source pull command with ignore conflicts flag', async () => { - const sourcePullOverwrite = new ProjectRetrieveStartExecutor( - '--ignore-conflicts' - ); - const projectRetrieveStartCommand = sourcePullOverwrite.build({}); - expect(projectRetrieveStartCommand.toCommand()).to.equal( - 'sf project:retrieve:start --json --ignore-conflicts' - ); - expect(projectRetrieveStartCommand.description).to.equal( - nls.localize('project_retrieve_start_ignore_conflicts_default_org_text') - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/refreshSObjects.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/refreshSObjects.test.ts deleted file mode 100644 index 899d9c8fea..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/refreshSObjects.test.ts +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -/* tslint:disable:no-unused-expression */ -import { - SOBJECTS_DIR, - SObjectTransformer, - SObjectTransformerFactory, - STANDARDOBJECTS_DIR -} from '@salesforce/salesforcedx-sobjects-faux-generator/out/src'; -import { - SObjectCategory, - SObjectRefreshSource -} from '@salesforce/salesforcedx-sobjects-faux-generator/out/src/types'; -import { - ContinueResponse, - notificationService, - ProgressNotification, - projectPaths, - SfCommandlet -} from '@salesforce/salesforcedx-utils-vscode'; -import { fail } from 'assert'; -import { expect } from 'chai'; -import { EventEmitter } from 'events'; -import * as fs from 'fs'; -import * as path from 'path'; -import { createSandbox, SinonSandbox, SinonStub } from 'sinon'; -import { ProgressLocation, window } from 'vscode'; -import { - checkSObjectsAndRefresh, - RefreshSObjectsExecutor, - RefreshSelection, - SObjectRefreshGatherer, - verifyUsernameAndInitSObjectDefinitions -} from '../../../src/commands/refreshSObjects'; -import { WorkspaceContext } from '../../../src/context'; -import { nls } from '../../../src/messages'; -import { telemetryService } from '../../../src/telemetry'; - -describe('GenerateFauxClasses', () => { - const sobjectsPath = path.join(projectPaths.toolsFolder(), SOBJECTS_DIR); - describe('initSObjectDefinitions', () => { - let sandboxStub: SinonSandbox; - let existsSyncStub: SinonStub; - let getUsernameStub: SinonStub; - let commandletSpy: SinonStub; - let notificationStub: SinonStub; - - const projectPath = path.join('sample', 'path'); - - beforeEach(() => { - sandboxStub = createSandbox(); - existsSyncStub = sandboxStub.stub(fs, 'existsSync'); - getUsernameStub = sandboxStub.stub(); - sandboxStub - .stub(WorkspaceContext.prototype, 'getConnection') - .resolves({ getUsername: getUsernameStub }); - commandletSpy = sandboxStub.stub(SfCommandlet.prototype, 'run'); - notificationStub = sandboxStub.stub( - notificationService, - 'showInformationMessage' - ); - }); - - afterEach(() => { - sandboxStub.restore(); - }); - - it('Should execute sobject refresh if no sobjects folder is present', async () => { - existsSyncStub.returns(false); - getUsernameStub.returns(new Map([['target-org', 'Sample']])); - - await verifyUsernameAndInitSObjectDefinitions(projectPath); - - expect(existsSyncStub.calledWith(sobjectsPath)).to.be.true; - expect(commandletSpy.calledOnce).to.be.true; - - // validates the commandlet ran with the correct source - expect(commandletSpy.thisValues[0].gatherer).to.eqls({ - source: SObjectRefreshSource.Startup - }); - }); - - it('Should not execute sobject refresh if sobjects folder is present', async () => { - existsSyncStub.returns(true); - getUsernameStub.returns('Sample'); - - await verifyUsernameAndInitSObjectDefinitions(projectPath); - - expect(existsSyncStub.calledWith(sobjectsPath)).to.be.true; - expect(commandletSpy.notCalled).to.be.true; - }); - - it('Should not execute sobject refresh if no target org set', async () => { - existsSyncStub.returns(false); - getUsernameStub.returns(undefined); - - await verifyUsernameAndInitSObjectDefinitions(projectPath); - - expect(commandletSpy.notCalled).to.be.true; - }); - }); - - describe('checkSObjectsAndRefresh', () => { - let sandboxStub: SinonSandbox; - let existsSyncStub: SinonStub; - let telemetryEventStub: SinonStub; - - const projectPath = path.join('sample', 'path'); - const standardSobjectsPath = path.join(sobjectsPath, STANDARDOBJECTS_DIR); - - beforeEach(() => { - sandboxStub = createSandbox(); - existsSyncStub = sandboxStub.stub(fs, 'existsSync'); - telemetryEventStub = sandboxStub.stub(telemetryService, 'sendEventData'); - }); - - afterEach(() => { - sandboxStub.restore(); - }); - - it('Should call refreshSObjects service when sobjects do not exist', async () => { - existsSyncStub.returns(false); - - await checkSObjectsAndRefresh(projectPath); - - expect(existsSyncStub.calledWith(standardSobjectsPath)).to.be.true; - expect(telemetryEventStub.callCount).to.equal(1); - const telemetryCallArgs = telemetryEventStub.getCall(0).args; - expect(telemetryCallArgs[0]).to.equal('sObjectRefreshNotification'); - expect(telemetryCallArgs[1]).to.deep.equal({ - type: SObjectRefreshSource.StartupMin - }); - expect(telemetryCallArgs[2]).to.equal(undefined); - }); - - it('Should not call refreshSObjects service when sobjects already exist', async () => { - existsSyncStub.returns(true); - - await checkSObjectsAndRefresh(projectPath); - - expect(existsSyncStub.calledWith(standardSobjectsPath)).to.be.true; - expect(telemetryEventStub.notCalled).to.be.true; - }); - }); - - describe('GenerateFauxClassesExecutor', () => { - let sandboxStub: SinonSandbox; - let progressStub: SinonStub; - let factoryStub: SinonStub; - let transformerStub: SinonStub; - let logStub: SinonStub; - let errorStub: SinonStub; - let transformer: SObjectTransformer; - let notificationStub: SinonStub; - - const expectedData = { - cancelled: false, - standardObjects: 1, - customObjects: 2 - }; - - beforeEach(() => { - sandboxStub = createSandbox(); - progressStub = sandboxStub.stub(ProgressNotification, 'show'); - transformer = new SObjectTransformer(new EventEmitter(), [], []); - transformerStub = sandboxStub - .stub(transformer, 'transform') - .callsFake(() => { - return Promise.resolve({ data: expectedData }); - }); - factoryStub = sandboxStub - .stub(SObjectTransformerFactory, 'create') - .callsFake(() => { - return Promise.resolve(transformer); - }); - logStub = sandboxStub.stub( - RefreshSObjectsExecutor.prototype, - 'logMetric' - ); - errorStub = sandboxStub.stub(telemetryService, 'sendException'); - notificationStub = sandboxStub.stub( - notificationService, - 'reportCommandExecutionStatus' - ); - }); - - afterEach(() => { - sandboxStub.restore(); - notificationStub.restore(); - }); - - it('Should pass response data to transformer', async () => { - await doExecute(SObjectRefreshSource.Startup, SObjectCategory.CUSTOM); - expect(factoryStub.firstCall.args.slice(2)).to.eql([ - SObjectCategory.CUSTOM, - SObjectRefreshSource.Startup - ]); - }); - - it('Should pass minimal response data to transformer', async () => { - await doExecute(SObjectRefreshSource.StartupMin, SObjectCategory.CUSTOM); - expect(factoryStub.firstCall.args.slice(2)).to.eql([ - SObjectCategory.STANDARD, - SObjectRefreshSource.StartupMin - ]); - }); - - it('Should show progress on the status bar for non-manual refresh source', async () => { - await doExecute(SObjectRefreshSource.Startup); - expect(progressStub.getCall(0).args[2]).to.eq(ProgressLocation.Window); - }); - - it('Should show progress as notification for manual refresh source', async () => { - await doExecute(SObjectRefreshSource.Manual); - expect(progressStub.getCall(0).args[2]).to.eq( - ProgressLocation.Notification - ); - }); - - it('Should report command execution status for Startup Refresh', async () => { - await doExecute(SObjectRefreshSource.Startup, SObjectCategory.STANDARD); - expect(notificationStub.calledOnce).to.be.true; - }); - - it('Should report command execution status for Manual Refresh', async () => { - await doExecute(SObjectRefreshSource.Manual, SObjectCategory.STANDARD); - expect(notificationStub.calledOnce).to.be.true; - }); - - it('Should not report command execution status for Startup Min Refresh', async () => { - await doExecute( - SObjectRefreshSource.StartupMin, - SObjectCategory.STANDARD - ); - expect(notificationStub.notCalled).to.be.true; - }); - - it('Should log correct information to telemetry on success.', async () => { - // Success - transformerStub.returns({ data: expectedData }); - await doExecute(SObjectRefreshSource.Startup); - expect(logStub.getCall(0).args[2]).to.deep.contain({ - cancelled: 'false' - }); - expect(logStub.getCall(0).args[3]).to.deep.contain({ - standardObjects: expectedData.standardObjects, - customObjects: expectedData.customObjects - }); - }); - - it('Should log correct information to telemetry on error.', async () => { - // Error - const error = new Error('sample error'); - error.name = 'aFakeError'; - transformerStub.throws({ data: expectedData, error }); - try { - await doExecute(SObjectRefreshSource.Startup); - fail('should have thown an error.'); - } catch (e) { - expect(errorStub.calledWith(error.name, error.message)); - expect(e.error).to.equal(error); - } - }); - - async function doExecute( - source: SObjectRefreshSource, - category?: SObjectCategory - ) { - const executor = new RefreshSObjectsExecutor(); - await executor.execute({ - type: 'CONTINUE', - data: { category: category || SObjectCategory.ALL, source } - }); - } - }); - - describe('SObjectRefreshGatherer', () => { - let gatherer: SObjectRefreshGatherer; - let sandboxStub: SinonSandbox; - let quickPickStub: SinonStub; - - beforeEach(() => { - sandboxStub = createSandbox(); - gatherer = new SObjectRefreshGatherer(); - quickPickStub = sandboxStub.stub(window, 'showQuickPick'); - quickPickStub.returns(nls.localize('sobject_refresh_all')); - }); - - afterEach(() => sandboxStub.restore()); - - it('Should return All sObjects', async () => { - quickPickStub.returns(nls.localize('sobject_refresh_all')); - const response = - (await gatherer.gather()) as ContinueResponse; - expect(response.data.category).to.equal(SObjectCategory.ALL); - }); - - it('Should return Custom sObjects', async () => { - quickPickStub.returns(nls.localize('sobject_refresh_custom')); - const response = - (await gatherer.gather()) as ContinueResponse; - expect(response.data.category).to.equal(SObjectCategory.CUSTOM); - }); - - it('Should return Standard sObjects', async () => { - quickPickStub.returns(nls.localize('sobject_refresh_standard')); - const response = - (await gatherer.gather()) as ContinueResponse; - expect(response.data.category).to.equal(SObjectCategory.STANDARD); - }); - - it('Should return given source', async () => { - gatherer = new SObjectRefreshGatherer(SObjectRefreshSource.Startup); - const response = - (await gatherer.gather()) as ContinueResponse; - expect(response.data.source).to.equal(SObjectRefreshSource.Startup); - }); - - it('Should return Manual source if none given', async () => { - const response = - (await gatherer.gather()) as ContinueResponse; - expect(response.data.source).to.equal(SObjectRefreshSource.Manual); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/renameLightningComponent.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/renameLightningComponent.test.ts deleted file mode 100644 index 8875de88dd..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/renameLightningComponent.test.ts +++ /dev/null @@ -1,574 +0,0 @@ -/* - * Copyright (c) 2023, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { notificationService } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - getLightningComponentDirectory, - inputGuard, - isNameMatch, - RenameLwcComponentExecutor -} from '../../../src/commands/renameLightningComponent'; -import { nls } from '../../../src/messages'; - -const RENAME_INPUT_DUP_ERROR = 'rename_component_input_dup_error'; -const RENAME_INPUT_DUP_FILE_NAME_ERROR = - 'rename_component_input_dup_file_name_error'; -const lwcPath = vscode.Uri.parse('/force-app/main/default/lwc'); -const auraPath = vscode.Uri.parse('/force-app/main/default/aura/'); -const lwcComponent = 'hero'; -const auraComponent = 'page'; -const itemsInHero = [ - 'hero.css', - 'hero.html', - 'hero.js', - 'hero.js-meta.xml', - 'templateOne.html' -]; -const itemsInPage = [ - 'page.auradoc', - 'page.cmp', - 'page.cmp-meta.xml', - 'page.css', - 'page.design', - 'page.svg', - 'pageController.js', - 'pageHelper.js', - 'pageRenderer.js', - 'page.evt', - 'page.evt-meta.xml', - 'templateOne.css' -]; -const testFolder = '__tests__'; -const testFiles = ['hero.test.js', 'example.test.js']; - -const env = sinon.createSandbox(); -let renameStub: sinon.SinonStub; -let statStub: sinon.SinonStub; -let readdirStub: sinon.SinonStub; - -describe('Rename Lightning Component', () => { - describe('Happy Path Unit Test', () => { - beforeEach(() => { - renameStub = env.stub(fs.promises, 'rename').resolves(undefined); - statStub = env.stub(fs.promises, 'stat').resolves({ - isFile: () => { - return false; - } - }); - readdirStub = env.stub(fs.promises, 'readdir'); - }); - - afterEach(() => { - env.restore(); - }); - - it('should rename the files and folder with new name under the same path', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onFirstCall() - .resolves([]) - .onSecondCall() - .resolves([]) - .onThirdCall() - .resolves([itemsInHero[0]]); - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: 'hero1' } - }); - const oldFilePath = path.join(sourceUri.fsPath, 'hero.css'); - const newFilePath = path.join(sourceUri.fsPath, 'hero1.css'); - const newFolderPath = path.join(lwcPath.fsPath, 'hero1'); - expect(renameStub.callCount).to.equal(2); - expect(renameStub.calledWith(oldFilePath, newFilePath)).to.equal(true); - expect(renameStub.calledWith(sourceUri.fsPath, newFolderPath)).to.equal( - true - ); - }); - - it('should only rename the files and folder that have same name with LWC component', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onFirstCall() - .resolves([]) - .onSecondCall() - .resolves([]) - .onThirdCall() - .resolves(itemsInHero); - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: 'hero1' } - }); - expect(renameStub.callCount).to.equal(5); - }); - - it('should only rename the files and folder that have same name with Aura component', async () => { - const sourceUri = vscode.Uri.joinPath(auraPath, auraComponent); - readdirStub - .onFirstCall() - .resolves([]) - .onSecondCall() - .resolves([]) - .onThirdCall() - .resolves(itemsInPage); - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: 'page1' } - }); - expect(renameStub.callCount).to.equal(12); - }); - - it('should rename the test file that has the same name as component', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onCall(0) - .resolves([]) - .onCall(1) - .resolves([]) - .onCall(2) - .resolves([testFolder]) - .onCall(3) - .resolves([]) - .onCall(4) - .resolves(testFiles); - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: 'hero1' } - }); - const testFolderPath = path.join(sourceUri.fsPath, testFolder); - const oldFilePath = path.join(testFolderPath, 'hero.test.js'); - const newFilePath = path.join(testFolderPath, 'hero1.test.js'); - const newFolderPath = path.join(lwcPath.fsPath, 'hero1'); - expect(renameStub.callCount).to.equal(2); - expect(renameStub.calledWith(oldFilePath, newFilePath)).to.equal(true); - expect(renameStub.calledWith(sourceUri.fsPath, newFolderPath)).to.equal( - true - ); - }); - - it('should show the warning message once rename is done', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onFirstCall() - .resolves([]) - .onSecondCall() - .resolves([]) - .onThirdCall() - .resolves([itemsInHero[1]]); - const showWarningMessageSpy = env.spy( - notificationService, - 'showWarningMessage' - ); - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: 'hero1' } - }); - expect(showWarningMessageSpy.callCount).to.equal(1); - }); - }); - - describe('Exception and corner cases handling', () => { - beforeEach(() => { - renameStub = env.stub(fs.promises, 'rename').resolves(undefined); - statStub = env.stub(fs.promises, 'stat').resolves({ - isFile: () => { - return false; - } - }); - readdirStub = env.stub(fs.promises, 'readdir'); - }); - - afterEach(() => { - env.restore(); - }); - - it('should get trimmed component name if new component input has leading or trailing spaces', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onFirstCall() - .resolves([]) - .onSecondCall() - .resolves([]) - .onThirdCall() - .resolves([itemsInHero[0]]); - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: ' hero1 ' } - }); - const oldFilePath = path.join(sourceUri.fsPath, 'hero.css'); - const newFilePath = path.join(sourceUri.fsPath, 'hero1.css'); - expect(renameStub.callCount).to.equal(2); - expect(renameStub.calledWith(oldFilePath, newFilePath)).to.equal(true); - }); - - it('should not rename when input text only contains white spaces', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onFirstCall() - .resolves([]) - .onSecondCall() - .resolves([]) - .onThirdCall() - .resolves([itemsInHero[0]]); - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: ' ' } - }); - expect(renameStub.callCount).to.equal(0); - }); - - it('should not rename when input text is empty', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onFirstCall() - .resolves([]) - .onSecondCall() - .resolves([]) - .onThirdCall() - .resolves([itemsInHero[0]]); - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: {} - }); - expect(renameStub.callCount).to.equal(0); - }); - - it('should not show warning message when input text is empty', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onFirstCall() - .resolves([]) - .onSecondCall() - .resolves([]) - .onThirdCall() - .resolves([itemsInHero[0]]); - const showWarningMessageSpy = env.spy( - notificationService, - 'showWarningMessage' - ); - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: {} - }); - expect(showWarningMessageSpy.callCount).to.equal(0); - }); - - it('should enforce unique component name under LWC and Aura and show error message for duplicate name', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onFirstCall() - .resolves([lwcComponent]) - .onSecondCall() - .resolves([]); - let exceptionThrown: any; - const errorMessage = nls.localize(RENAME_INPUT_DUP_ERROR); - try { - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: 'hero' } - }); - } catch (e) { - exceptionThrown = e; - } - expect(exceptionThrown.message).to.equal(errorMessage); - expect(renameStub.callCount).to.equal(0); - }); - - it('should prevent new component name from duplicating any existing file name under current component directory', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onCall(0) - .resolves([]) - .onCall(1) - .resolves([]) - .onCall(2) - .resolves(itemsInHero.concat([testFolder])) - .onCall(3) - .resolves(testFiles); - let exceptionThrown: any; - const errorMessage = nls.localize(RENAME_INPUT_DUP_FILE_NAME_ERROR); - try { - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: 'templateOne' } - }); - } catch (e) { - exceptionThrown = e; - } - expect(exceptionThrown.message).to.equal(errorMessage); - expect(renameStub.callCount).to.equal(0); - }); - - it('should prevent new component name from duplicating any exiting test file name', async () => { - const sourceUri = vscode.Uri.joinPath(lwcPath, lwcComponent); - readdirStub - .onCall(0) - .resolves([]) - .onCall(1) - .resolves([]) - .onCall(2) - .resolves(itemsInHero.concat([testFolder])) - .onCall(3) - .resolves(testFiles); - let exceptionThrown: any; - const errorMessage = nls.localize(RENAME_INPUT_DUP_FILE_NAME_ERROR); - try { - const executor = new RenameLwcComponentExecutor(sourceUri.fsPath); - await executor.run({ - type: 'CONTINUE', - data: { name: 'example' } - }); - } catch (e) { - exceptionThrown = e; - } - expect(exceptionThrown.message).to.equal(errorMessage); - expect(renameStub.callCount).to.equal(0); - }); - }); - - describe('#isNameMatch', () => { - it('should return true if file name and component name match for essential LWC files', () => { - const componentName = 'hero'; - const componentPath = path.join(lwcPath.fsPath, lwcComponent); - expect( - isNameMatch(itemsInHero[0], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInHero[1], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInHero[2], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInHero[3], componentName, componentPath) - ).to.equal(true); - }); - - it('should return true of file name and component name match for essential Aura files', () => { - const componentName = 'page'; - const componentPath = path.join(auraPath.fsPath, auraComponent); - expect( - isNameMatch(itemsInPage[0], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[1], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[2], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[3], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[4], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[5], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[6], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[7], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[8], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[9], componentName, componentPath) - ).to.equal(true); - expect( - isNameMatch(itemsInPage[10], componentName, componentPath) - ).to.equal(true); - }); - - it('should return false if file type is not in LWC or Aura or file name and component name do not match', () => { - const lwcComponentPath = path.join(lwcPath.fsPath, lwcComponent); - const auraComponentPath = path.join(auraPath.fsPath, auraComponent); - expect(isNameMatch('hero.jpg', 'hero', lwcComponentPath)).to.equal(false); - expect(isNameMatch('hero1.css', 'hero', lwcComponentPath)).to.equal( - false - ); - expect(isNameMatch('page.jpg', 'page', auraComponentPath)).to.equal( - false - ); - expect(isNameMatch('page1.css', 'hero', auraComponentPath)).to.equal( - false - ); - expect(isNameMatch('pageEvt.js', 'page', auraComponentPath)).to.equal( - false - ); - }); - }); - - describe('Guard new component name', () => { - beforeEach(() => { - statStub = env.stub(fs.promises, 'stat').resolves({ - isFile: () => { - return false; - } - }); - }); - - afterEach(() => { - env.restore(); - }); - - it('should not show the error message when new component name starts with a letter', async () => { - let exceptionThrownLwc = false; - let exceptionThrownAura = false; - const sourceUriLWC = vscode.Uri.joinPath(lwcPath, lwcComponent); - const sourceUriAura = vscode.Uri.joinPath(auraPath, auraComponent); - try { - await inputGuard(sourceUriLWC.fsPath, 'Hello'); - } catch (e) { - exceptionThrownLwc = true; - } - try { - await inputGuard(sourceUriAura.fsPath, 'Hello'); - } catch (e) { - exceptionThrownAura = true; - } - expect(exceptionThrownLwc).to.equal(false); - expect(exceptionThrownAura).to.equal(false); - }); - - it('should change the first letter to lower case if the new LWC component name is a upper-case letter', async () => { - let returnedName: any; - let exceptionThrownLwc = false; - const sourceUriLWC = vscode.Uri.joinPath(lwcPath, lwcComponent); - try { - returnedName = await inputGuard(sourceUriLWC.fsPath, 'Hello'); - } catch (e) { - exceptionThrownLwc = true; - } - expect(returnedName).to.equal('hello'); - expect(exceptionThrownLwc).to.equal(false); - }); - - it('should show the error message when component name contains special characters other than underscore or alphanumeric for LWC and Aura', async () => { - let exceptionThrownLwc = false; - let exceptionThrownAura = false; - const sourceUriLWC = vscode.Uri.joinPath(lwcPath, lwcComponent); - const sourceUriAura = vscode.Uri.joinPath(auraPath, auraComponent); - try { - await inputGuard(sourceUriLWC.fsPath, 'hello%$world'); - } catch (e) { - exceptionThrownLwc = true; - } - try { - await inputGuard(sourceUriAura.fsPath, 'hello%$world'); - } catch (e) { - exceptionThrownAura = true; - } - expect(exceptionThrownLwc).to.equal(true); - expect(exceptionThrownAura).to.equal(true); - }); - - it('should show the error message when component name contains two consecutive underscores for LWC and Aura', async () => { - let exceptionThrownLwc = false; - let exceptionThrownAura = false; - const sourceUriLWC = vscode.Uri.joinPath(lwcPath, lwcComponent); - const sourceUriAura = vscode.Uri.joinPath(auraPath, auraComponent); - try { - await inputGuard(sourceUriLWC.fsPath, 'hello__world'); - } catch (e) { - exceptionThrownLwc = true; - } - try { - await inputGuard(sourceUriAura.fsPath, 'hello__world'); - } catch (e) { - exceptionThrownAura = true; - } - expect(exceptionThrownLwc).to.equal(true); - expect(exceptionThrownAura).to.equal(true); - }); - - it('should show the error message when component name ends with an underscore for LWC and Aura', async () => { - let exceptionThrownLwc = false; - let exceptionThrownAura = false; - const sourceUriLWC = vscode.Uri.joinPath(lwcPath, lwcComponent); - const sourceUriAura = vscode.Uri.joinPath(auraPath, auraComponent); - try { - await inputGuard(sourceUriLWC.fsPath, 'hello_'); - } catch (e) { - exceptionThrownLwc = true; - } - try { - await inputGuard(sourceUriAura.fsPath, 'hello_'); - } catch (e) { - exceptionThrownAura = true; - } - expect(exceptionThrownLwc).to.equal(true); - expect(exceptionThrownAura).to.equal(true); - }); - }); - - describe('getLightningComponentDirectory function', () => { - it('works with simple component folder', () => { - const folders = ['src', 'main', 'default', 'lwc', 'cmp']; - const folderPath = folders.join(path.sep); - const parentDirectory = getLightningComponentDirectory(folderPath); - expect(parentDirectory).to.equal(folderPath); - }); - - it('works with __tests__ folder in the path', () => { - const folders = ['src', 'main', 'default', 'lwc', 'cmp', '__tests__']; - const folderPath = folders.join(path.sep); - - const parentFolder = folders.slice(0, -1); - const parentFolderPath = parentFolder.join(path.sep); - - const parentDirectory = getLightningComponentDirectory(folderPath); - expect(parentDirectory).to.equal(parentFolderPath); - }); - - it('works with child folder of __tests__ folder', () => { - const folders = ['lwc', 'cmp', '__tests__', 'data']; - const folderPath = folders.join(path.sep); - - const parentFolder = folders.slice(0, -2); - const parentFolderPath = parentFolder.join(path.sep); - - const parentDirectory = getLightningComponentDirectory(folderPath); - expect(parentDirectory).to.equal(parentFolderPath); - }); - - it('works with templates folder of component', () => { - const folders = ['lwc', 'cmp', 'templates']; - const folderPath = folders.join(path.sep); - - const parentFolder = folders.slice(0, -1); - const parentFolderPath = parentFolder.join(path.sep); - - const parentDirectory = getLightningComponentDirectory(folderPath); - expect(parentDirectory).to.equal(parentFolderPath); - }); - - it('works with nested lwc folder of component', () => { - const folders = ['src', 'main', 'default', 'lwc', 'other', 'lwc', 'cmp']; - const folderPath = folders.join(path.sep); - - const parentDirectory = getLightningComponentDirectory(folderPath); - expect(parentDirectory).to.equal(folderPath); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveManifest.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveManifest.test.ts deleted file mode 100644 index d992280649..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveManifest.test.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { Connection } from '@salesforce/core'; -import { - instantiateContext, - MockTestOrgData, - restoreContext, - stubContext -} from '@salesforce/core/lib/testSetup'; -import { SourceTrackingService } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; -import { expect } from 'chai'; -import * as path from 'path'; -import { SinonStub } from 'sinon'; -import { LibraryRetrieveManifestExecutor } from '../../../src/commands/retrieveManifest'; -import { WorkspaceContext } from '../../../src/context'; -import { SalesforcePackageDirectories } from '../../../src/salesforceProject'; -import { workspaceUtils } from '../../../src/util'; - -const $$ = instantiateContext(); -const env = $$.SANDBOX; - -describe('Retrieve with Manifest Option', () => { - beforeEach(() => { - env.stub(SourceTrackingService, 'getSourceTracking'); - env.stub(SourceTrackingService, 'updateSourceTrackingAfterRetrieve'); - }); - afterEach(() => { - restoreContext($$); - }); - - describe('Library Executor', () => { - const manifestPath = 'package.xml'; - const packageDirs = ['p1', 'p2']; - const packageDirFullPaths = packageDirs.map(p => - path.join(workspaceUtils.getRootWorkspacePath(), p) - ); - const defaultPackagePath = packageDirFullPaths[0]; - const mockComponents = new ComponentSet([ - { fullName: 'Test', type: 'apexclass' }, - { fullName: 'Test2', type: 'layout' } - ]); - - let mockConnection: Connection; - let retrieveStub: SinonStub; - let pollStatusStub: SinonStub; - - const executor = new LibraryRetrieveManifestExecutor(); - - beforeEach(async () => { - const testData = new MockTestOrgData(); - stubContext($$); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await testData.getConnection(); - - env - .stub(SalesforcePackageDirectories, 'getPackageDirectoryPaths') - .resolves(packageDirs); - env - .stub(SalesforcePackageDirectories, 'getDefaultPackageDir') - .resolves(packageDirs[0]); - env - .stub(WorkspaceContext.prototype, 'getConnection') - .resolves(mockConnection); - env - .stub(ComponentSet, 'fromManifest') - .withArgs({ - manifestPath, - resolveSourcePaths: packageDirFullPaths, - forceAddWildcards: true - }) - .returns(mockComponents); - pollStatusStub = env.stub(); - retrieveStub = env.stub(mockComponents, 'retrieve').returns({ - pollStatus: pollStatusStub - }); - }); - - it('should retrieve components in a manifest', async () => { - await executor.run({ data: manifestPath, type: 'CONTINUE' }); - - expect(retrieveStub.calledOnce).to.equal(true); - expect(retrieveStub.firstCall.args[0]).to.deep.equal({ - usernameOrConnection: mockConnection, - output: defaultPackagePath, - merge: true, - suppressEvents: false - }); - expect(pollStatusStub.calledOnce).to.equal(true); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveMetadata/describers.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveMetadata/describers.test.ts deleted file mode 100644 index 10ad4b27eb..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveMetadata/describers.test.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { LocalComponent } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { normalize } from 'path'; -import { createSandbox, SinonSandbox, SinonStub } from 'sinon'; -import { RetrieveDescriberFactory } from '../../../../src/commands/retrieveMetadata'; -import { BrowserNode, NodeType, orgBrowser } from '../../../../src/orgBrowser'; -import { SalesforcePackageDirectories } from '../../../../src/salesforceProject'; - -describe('Retrieve Metadata Describers', () => { - let packageStub: SinonStub; - let refreshStub: SinonStub; - let env: SinonSandbox; - - const node = new BrowserNode('Test', NodeType.MetadataType, 'TestType', { - suffix: '.t', - directoryName: 'tests', - inFolder: false, - metaFile: false, - xmlName: 'TestType', - label: 'TestType' - }); - node.setComponents(['Test1', 'Test2', 'Test3'], NodeType.MetadataComponent); - - beforeEach(() => { - env = createSandbox(); - packageStub = env - .stub(SalesforcePackageDirectories, 'getPackageDirectoryPaths') - .returns(['p1', 'p2']); - refreshStub = env.stub(orgBrowser, 'refreshAndExpand').callsFake(() => ''); - }); - - afterEach(() => env.restore()); - - describe('TypeNodeDescriber', () => { - const describer = RetrieveDescriberFactory.createTypeNodeDescriber(node); - - it('Should correctly build metadata argument for all child nodes', () => { - expect(describer.buildMetadataArg()).to.equal('TestType'); - }); - - it('Should correctly build metadata argument for subset of child nodes', () => { - expect(describer.buildMetadataArg(generateComponents(2))).to.equal( - 'TestType:Test1,TestType:Test2' - ); - }); - - it('Should gather LocalComponents for each child node', async () => { - expect(await describer.gatherOutputLocations()).to.eql( - generateComponents(3) - ); - }); - - it('Should refresh the available components before gathering', async () => { - refreshStub.callsFake(() => { - node.setComponents(['Test1'], NodeType.MetadataComponent); - }); - expect(await describer.gatherOutputLocations()).to.eql( - generateComponents(1) - ); - }); - }); - - describe('ComponentNodeDescriber', () => { - const describer = RetrieveDescriberFactory.createComponentNodeDescriber( - node.children![0] - ); - it('Should correctly build metadata argument', () => { - expect(describer.buildMetadataArg()).to.equal('TestType:Test1'); - }); - - it('Should correctly gather a LocalComponent', async () => { - expect(await describer.gatherOutputLocations()).to.eql( - generateComponents(1) - ); - }); - }); - - function generateComponents(count: number): LocalComponent[] { - const components = []; - for (let i = 1; i <= count; i++) { - for (let j = 1; j <= 2; j++) { - components.push({ - fileName: `Test${i}`, - outputdir: normalize(`p${j}/main/default/tests`), - type: 'TestType', - suffix: '.t' - }); - } - } - return components; - } -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveMetadata/retrieveComponent.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveMetadata/retrieveComponent.test.ts deleted file mode 100644 index 75956d3709..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveMetadata/retrieveComponent.test.ts +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { Connection } from '@salesforce/core'; -import { - instantiateContext, - MockTestOrgData, - restoreContext, - stubContext -} from '@salesforce/core/lib/testSetup'; -import { - ContinueResponse, - LocalComponent, - SourceTrackingService -} from '@salesforce/salesforcedx-utils-vscode'; -import { - ComponentSet, - MetadataResolver, - registry, - RetrieveResult, - SourceComponent -} from '@salesforce/source-deploy-retrieve'; -import { - MetadataApiRetrieveStatus, - RequestStatus -} from '@salesforce/source-deploy-retrieve/lib/src/client/types'; -import { expect } from 'chai'; -import * as path from 'path'; -import { SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { RetrieveDescriber } from '../../../../src/commands/retrieveMetadata'; -import { LibraryRetrieveSourcePathExecutor } from '../../../../src/commands/retrieveMetadata/libraryRetrieveSourcePathExecutor'; -import { WorkspaceContext } from '../../../../src/context'; -import { SalesforcePackageDirectories } from '../../../../src/salesforceProject'; -import { workspaceUtils } from '../../../../src/util'; - -const $$ = instantiateContext(); -const sb = $$.SANDBOX; - -class TestDescriber implements RetrieveDescriber { - public buildMetadataArg(data?: LocalComponent[]): string { - return data ? `${data[0].type}:${data[0].fileName}` : 'TestType:Test1'; - } - - public gatherOutputLocations(): Promise { - throw new Error('Method not implemented.'); - } -} - -describe('Retrieve Component(s)', () => { - describe('Library Executor', () => { - const testData = new MockTestOrgData(); - const defaultPackageDir = 'test-app'; - - let mockConnection: Connection; - - let openTextDocumentStub: SinonStub; - let showTextDocumentStub: SinonStub; - let pollStatusStub: SinonStub; - let retrieveStub: SinonStub; - - beforeEach(async () => { - stubContext($$); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await testData.getConnection(); - sb.stub(WorkspaceContext.prototype, 'getConnection').returns( - mockConnection - ); - - sb.stub(SalesforcePackageDirectories, 'getDefaultPackageDir').returns( - defaultPackageDir - ); - sb.stub( - SalesforcePackageDirectories, - 'getPackageDirectoryFullPaths' - ).resolves([ - path.join(workspaceUtils.getRootWorkspacePath(), defaultPackageDir) - ]); - sb.stub( - SalesforcePackageDirectories, - 'getPackageDirectoryPaths' - ).resolves([defaultPackageDir]); - - sb.stub(MetadataResolver.prototype, 'getComponentsFromPath').returns([]); - openTextDocumentStub = sb.stub(vscode.workspace, 'openTextDocument'); - showTextDocumentStub = sb.stub(vscode.window, 'showTextDocument'); - pollStatusStub = sb.stub(); - retrieveStub = sb.stub(ComponentSet.prototype, 'retrieve').returns({ - pollStatus: pollStatusStub - }); - sb.stub(SourceTrackingService, 'getSourceTracking'); - sb.stub(SourceTrackingService, 'updateSourceTrackingAfterRetrieve'); - }); - - afterEach(() => { - restoreContext($$); - }); - - it('should retrieve with given components', async () => { - const executor = new LibraryRetrieveSourcePathExecutor(); - const testComponents = [ - { fullName: 'MyClassA', type: 'ApexClass' }, - { fullName: 'MyClassB', type: 'ApexClass' } - ]; - const componentSet = new ComponentSet(testComponents); - const response: ContinueResponse = { - type: 'CONTINUE', - data: testComponents.map(c => ({ - fileName: c.fullName, - type: c.type, - outputdir: 'out' - })) - }; - - sb.stub(ComponentSet, 'fromSource').returns(componentSet); - - await executor.run(response); - - expect(retrieveStub.calledOnce).to.equal(true); - expect(retrieveStub.firstCall.args[0]).to.deep.equal({ - usernameOrConnection: mockConnection, - output: path.join(workspaceUtils.getRootWorkspacePath(), 'test-app'), - merge: true, - suppressEvents: false - }); - - const retrievedSet = retrieveStub.firstCall.thisValue as ComponentSet; - - expect(retrievedSet).to.not.equal(undefined); - expect(retrievedSet.has(testComponents[0])).to.equal(true); - expect(retrievedSet.has(testComponents[1])).to.equal(true); - - expect(openTextDocumentStub.called).to.equal(false); - expect(showTextDocumentStub.called).to.equal(false); - }); - - it('should retrieve components and merge with local versions if present', async () => { - const type = registry.types.apexclass; - const executor = new LibraryRetrieveSourcePathExecutor(); - const testComponents = [ - { fullName: 'MyClassA', type: 'ApexClass' }, - { fullName: 'MyClassB', type: 'ApexClass' } - ]; - const response: ContinueResponse = { - type: 'CONTINUE', - data: testComponents.map(c => ({ - fileName: c.fullName, - type: c.type, - outputdir: 'out' - })) - }; - - sb.stub(ComponentSet, 'fromSource').returns( - new ComponentSet([ - new SourceComponent({ - name: 'MyClassB', - type, - content: path.join(String(type.directoryName), 'MyClassB.cls'), - xml: path.join(String(type.directoryName), 'MyClassB.cls-meta.xml') - }) - ]) - ); - - await executor.run(response); - - const retrievedSet = retrieveStub.firstCall.thisValue as ComponentSet; - - // verify there are two components retrieved, but only one is source backed - expect(retrievedSet.size).to.equal(2); - expect(retrievedSet.getSourceComponents().toArray().length).to.equal(1); - }); - - it('should retrieve with given components and open them', async () => { - const executor = new LibraryRetrieveSourcePathExecutor(true); - const type = registry.types.apexclass; - const className = 'MyClass'; - const className2 = 'MyClass'; - const apexClassPathOne = path.join( - String(type.directoryName), - `${className}.cls` - ); - const apexClassPathTwo = path.join( - String(type.directoryName), - `${className2}.cls` - ); - const apexClassXmlPathOne = path.join( - String(type.directoryName), - `${apexClassPathOne}-meta.xml` - ); - const apexClassXmlPathTwo = path.join( - String(type.directoryName), - `${className2}.cls-meta.xml` - ); - const virtualTree = [ - { - dirPath: 'classes', - children: [ - `${className}.cls`, - `${className}.cls-meta.xml`, - `${className2}.cls`, - `${className2}.cls-meta.xml` - ] - } - ]; - - const testComponents = [ - SourceComponent.createVirtualComponent( - { - name: className, - type: registry.types.apexclass, - xml: apexClassXmlPathOne, - content: apexClassPathOne - }, - virtualTree - ), - SourceComponent.createVirtualComponent( - { - name: className, - type: registry.types.apexclass, - xml: apexClassXmlPathTwo, - content: apexClassPathTwo - }, - virtualTree - ) - ]; - const componentSet = new ComponentSet(testComponents); - sb.stub(ComponentSet, 'fromSource').returns(componentSet); - - const retrieveResponse: Partial = { - fileProperties: [], - status: RequestStatus.Succeeded - }; - pollStatusStub.resolves( - new RetrieveResult( - retrieveResponse as MetadataApiRetrieveStatus, - componentSet - ) - ); - - const response: ContinueResponse = { - type: 'CONTINUE', - data: testComponents.map(c => ({ - fileName: c.fullName, - type: c.type.name, - outputdir: 'out' - })) - }; - - await executor.run(response); - - expect(showTextDocumentStub.callCount).to.equal(2); - expect(openTextDocumentStub.callCount).to.equal(2); - - const openArg1 = openTextDocumentStub.firstCall.args[0]; - expect(openArg1).to.equal(apexClassXmlPathOne); - - const openArg2 = openTextDocumentStub.secondCall.args[0]; - expect(openArg2).to.equal(apexClassPathOne); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveSourcePath.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveSourcePath.test.ts deleted file mode 100644 index 32fcaa866a..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/retrieveSourcePath.test.ts +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { Connection } from '@salesforce/core'; -import { - instantiateContext, - MockTestOrgData, - restoreContext, - stubContext -} from '@salesforce/core/lib/testSetup'; -import { - CancelResponse, - ContinueResponse, - fileUtils, - SourceTrackingService -} from '@salesforce/salesforcedx-utils-vscode'; -import { - ComponentSet, - registry, - SourceComponent -} from '@salesforce/source-deploy-retrieve'; -import { expect } from 'chai'; -import * as path from 'path'; -import { SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { channelService } from '../../../src/channels'; -import { - LibraryRetrieveSourcePathExecutor, - SourcePathChecker -} from '../../../src/commands'; -import * as retrieveSourcePath from '../../../src/commands/retrieveSourcePath'; -import { WorkspaceContext } from '../../../src/context'; -import { nls } from '../../../src/messages'; -import { notificationService } from '../../../src/notifications'; -import { - SalesforcePackageDirectories, - SalesforceProjectConfig -} from '../../../src/salesforceProject'; -import { workspaceUtils } from '../../../src/util'; - -const $$ = instantiateContext(); -const sb = $$.SANDBOX; - -describe('Retrieve with Sourcepath Option', () => { - beforeEach(() => { - stubContext($$); - }); - - afterEach(() => { - restoreContext($$); - }); - - describe('Library Executor', () => { - let mockConnection: Connection; - let retrieveStub: SinonStub; - let pollStatusStub: SinonStub; - - const defaultPackage = 'test-app'; - - beforeEach(async () => { - const testData = new MockTestOrgData(); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - - mockConnection = await testData.getConnection(); - - sb.stub(WorkspaceContext.prototype, 'getConnection').resolves( - mockConnection - ); - sb.stub(WorkspaceContext.prototype, 'username').get( - () => testData.username - ); - - sb.stub(SalesforcePackageDirectories, 'getDefaultPackageDir').resolves( - defaultPackage - ); - sb.stub(SalesforceProjectConfig, 'getValue').resolves('11.0'); - sb.stub(SourceTrackingService, 'getSourceTracking'); - sb.stub(SourceTrackingService, 'updateSourceTrackingAfterRetrieve'); - pollStatusStub = sb.stub(); - }); - - it('should retrieve with a file path', async () => { - const executor = new LibraryRetrieveSourcePathExecutor(); - const fsPath = path.join('layouts', 'MyLayout.layout-meta.xml'); - - const toRetrieve = new ComponentSet([ - new SourceComponent({ - name: 'MyLayout', - type: registry.types.layout, - xml: fsPath - }) - ]); - - sb.stub(ComponentSet, 'fromSource') - .withArgs([fsPath]) - .returns(toRetrieve); - retrieveStub = sb - .stub(toRetrieve, 'retrieve') - .returns({ pollStatus: pollStatusStub }); - - await executor.run({ - type: 'CONTINUE', - data: [fsPath] - }); - - expect(retrieveStub.calledOnce).to.equal(true); - expect(retrieveStub.firstCall.args[0]).to.deep.equal({ - usernameOrConnection: mockConnection, - output: path.join( - workspaceUtils.getRootWorkspacePath(), - defaultPackage - ), - merge: true, - suppressEvents: false - }); - expect(pollStatusStub.calledOnce).to.equal(true); - }); - - it('should retrieve multiple files', async () => { - const filePath1 = path.join('classes', 'MyClass1.cls'); - const filePath2 = path.join('classes', 'MyClass2.cls'); - const filePath3 = path.join('lwc', 'myBundle', 'myBundle'); - const uris = [ - vscode.Uri.file(filePath1), - vscode.Uri.file(filePath2), - vscode.Uri.file(filePath3) - ]; - const filePaths = uris.map(uri => { - return uri.fsPath; - }); - const sourcePathCheckerCheckStub = sb - .stub(SourcePathChecker.prototype, 'check') - .returns({ - type: 'CONTINUE', - data: filePaths - }); - const flushFilePathsStub = sb - .stub(fileUtils, 'flushFilePaths') - .returns([ - path.sep + filePath1, - path.sep + filePath2, - path.sep + filePath3 - ]); - - await retrieveSourcePath.retrieveSourcePaths(uris[0], uris); - - expect(sourcePathCheckerCheckStub.called).to.equal(true); - const continueResponse = sourcePathCheckerCheckStub - .args[0][0] as ContinueResponse; - expect(JSON.stringify(continueResponse.data)).to.equal( - JSON.stringify(filePaths) - ); - - flushFilePathsStub.restore(); - sourcePathCheckerCheckStub.restore(); - }); - - it('should retrieve a single file', async () => { - const filePath1 = path.join('classes', 'MyClass1.cls'); - const uris = [vscode.Uri.file(filePath1)]; - const filePaths = uris.map(uri => { - return uri.fsPath; - }); - const sourcePathCheckerCheckStub = sb - .stub(SourcePathChecker.prototype, 'check') - .returns({ - type: 'CONTINUE', - data: filePaths - }); - const flushFilePathsStub = sb - .stub(fileUtils, 'flushFilePaths') - .returns([path.sep + filePath1]); - - await retrieveSourcePath.retrieveSourcePaths(uris[0], uris); - - expect(sourcePathCheckerCheckStub.called).to.equal(true); - const continueResponse = sourcePathCheckerCheckStub - .args[0][0] as ContinueResponse; - expect(JSON.stringify(continueResponse.data)).to.equal( - JSON.stringify(filePaths) - ); - - flushFilePathsStub.restore(); - sourcePathCheckerCheckStub.restore(); - }); - - it('should retrieve when editing a single file and "Retrieve This Source from Org" is executed', async () => { - const filePath1 = path.join('classes', 'MyClass1.cls'); - const uris = [vscode.Uri.file(filePath1)]; - const filePaths = uris.map(uri => { - return uri.fsPath; - }); - const sourcePathCheckerCheckStub = sb - .stub(SourcePathChecker.prototype, 'check') - .returns({ - type: 'CONTINUE', - data: filePaths - }); - const flushFilePathsStub = sb - .stub(fileUtils, 'flushFilePaths') - .returns([path.sep + filePath1]); - - await retrieveSourcePath.retrieveSourcePaths(uris[0], undefined); - - expect(sourcePathCheckerCheckStub.called).to.equal(true); - const continueResponse = sourcePathCheckerCheckStub - .args[0][0] as ContinueResponse; - expect(JSON.stringify(continueResponse.data)).to.equal( - JSON.stringify(filePaths) - ); - - flushFilePathsStub.restore(); - sourcePathCheckerCheckStub.restore(); - }); - - it('should retrieve when using the command palette', async () => { - const filePath1 = path.join('classes', 'MyClass1.cls'); - - // When retrieving via the command palette, - // sourceUri is undefined, and uris is undefined as well, - // and the path is obtained from the active editor - // (and calling getUriFromActiveEditor()) - const sourceUri = undefined; - const uris = undefined; - - const filePaths = [filePath1]; - const sourcePathCheckerCheckStub = sb - .stub(SourcePathChecker.prototype, 'check') - .returns({ - type: 'CONTINUE', - data: filePaths - }); - const getUriFromActiveEditorStub = sb - .stub(retrieveSourcePath, 'getUriFromActiveEditor') - .returns(filePath1); - const flushFilePathsStub = sb - .stub(fileUtils, 'flushFilePaths') - .returns([undefined]); - - await retrieveSourcePath.retrieveSourcePaths(sourceUri, uris); - - expect(getUriFromActiveEditorStub.called).to.equal(true); - - flushFilePathsStub.restore(); - getUriFromActiveEditorStub.restore(); - sourcePathCheckerCheckStub.restore(); - }); - }); -}); - -describe('SourcePathChecker', () => { - let workspacePath: string; - let appendLineSpy: SinonStub; - let showErrorMessageSpy: SinonStub; - beforeEach(() => { - stubContext($$); - workspacePath = workspaceUtils.getRootWorkspacePath(); - appendLineSpy = sb.stub(channelService, 'appendLine'); - showErrorMessageSpy = sb.stub(notificationService, 'showErrorMessage'); - }); - - afterEach(() => { - restoreContext($$); - }); - - it('Should continue when source path is in a package directory', async () => { - const isInPackageDirectoryStub = sb - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .returns(true); - const pathChecker = new SourcePathChecker(); - const sourcePath = path.join(workspacePath, 'package'); - const continueResponse = (await pathChecker.check({ - type: 'CONTINUE', - data: [sourcePath] - })) as ContinueResponse; - - expect(isInPackageDirectoryStub.getCall(0).args[0]).to.equal(sourcePath); - expect(continueResponse.type).to.equal('CONTINUE'); - expect(continueResponse.data[0]).to.equal(sourcePath); - - isInPackageDirectoryStub.restore(); - }); - - it('Should notify user and cancel when source path is not inside of a package directory', async () => { - const isInPackageDirectoryStub = sb - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .returns(false); - const pathChecker = new SourcePathChecker(); - const cancelResponse = (await pathChecker.check({ - type: 'CONTINUE', - data: [path.join('not', 'in', 'package', 'directory')] - })) as CancelResponse; - - const errorMessage = nls.localize( - 'error_source_path_not_in_package_directory_text' - ); - expect(appendLineSpy.getCall(0).args[0]).to.equal(errorMessage); - expect(showErrorMessageSpy.getCall(0).args[0]).to.equal(errorMessage); - expect(cancelResponse.type).to.equal('CANCEL'); - isInPackageDirectoryStub.restore(); - }); - - it('Should cancel and notify user if an error occurs when fetching the package directories', async () => { - const isInPackageDirectoryStub = sb - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .throws(new Error()); - const pathChecker = new SourcePathChecker(); - const cancelResponse = (await pathChecker.check({ - type: 'CONTINUE', - data: ['test/path'] - })) as CancelResponse; - - const errorMessage = nls.localize( - 'error_source_path_not_in_package_directory_text' - ); - expect(appendLineSpy.getCall(0).args[0]).to.equal(errorMessage); - expect(showErrorMessageSpy.getCall(0).args[0]).to.equal(errorMessage); - expect(cancelResponse.type).to.equal('CANCEL'); - isInPackageDirectoryStub.restore(); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/sourceDiff.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/sourceDiff.test.ts deleted file mode 100644 index c8fdd96a2e..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/sourceDiff.test.ts +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - MetadataType, - SourceComponent -} from '@salesforce/source-deploy-retrieve'; -import { expect } from 'chai'; -import * as path from 'path'; -import { assert, createSandbox, match, SinonSpy, SinonStub, stub } from 'sinon'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { commands, Uri } from 'vscode'; -import { channelService } from '../../../src/channels'; -import { sourceDiff } from '../../../src/commands'; -import * as conflictCommands from '../../../src/commands'; -import { - FilePathGatherer, - SfWorkspaceChecker -} from '../../../src/commands/util'; -import * as differ from '../../../src/conflict/directoryDiffer'; -import { - MetadataCacheResult, - MetadataCacheService, - MetadataContext, - PathType -} from '../../../src/conflict/metadataCacheService'; -import { WorkspaceContext } from '../../../src/context'; -import { nls } from '../../../src/messages'; -import { notificationService } from '../../../src/notifications'; -import { telemetryService } from '../../../src/telemetry'; - -const sandbox = createSandbox(); - -describe('Diff', () => { - describe('File Diff', () => { - const mockAlias = 'vscodeOrg'; - const mockUsername = 'admin@ut-sandbox.org'; - const mockFilePath = path.join( - '/projects/trailheadapps/lwc-recipes/force-app/main/default/classes/mockFile.cls' - ); - let vscodeExecuteCommandStub: SinonStub; - let workspaceContextAliasStub: SinonStub; - let workspaceContextUsernameStub: SinonStub; - let workspaceCheckerStub: SinonStub; - let filePathGathererStub: SinonStub; - let componentStub: sinon.SinonStub; - let operationStub: sinon.SinonStub; - let processStub: sinon.SinonStub; - let notificationStub: SinonStub; - let channelAppendLineStub: SinonStub; - let channelShowChannelOutputStub: SinonStub; - let mockComponentWalkContentStub: SinonStub; - let telemetryServiceSendExceptionStub: SinonStub; - - beforeEach(() => { - workspaceContextUsernameStub = sandbox - .stub(WorkspaceContext.prototype, 'username') - .get(() => { - return mockUsername; - }); - workspaceContextAliasStub = sandbox - .stub(WorkspaceContext.prototype, 'alias') - .get(() => { - return mockAlias; - }); - workspaceCheckerStub = sandbox.stub( - SfWorkspaceChecker.prototype, - 'check' - ); - workspaceCheckerStub.returns(true); - filePathGathererStub = sandbox.stub(FilePathGatherer.prototype, 'gather'); - filePathGathererStub.returns({ type: 'CONTINUE', data: mockFilePath }); - operationStub = sandbox.stub( - MetadataCacheService.prototype, - 'createRetrieveOperation' - ); - componentStub = sandbox.stub( - MetadataCacheService.prototype, - 'getSourceComponents' - ); - processStub = sandbox.stub( - MetadataCacheService.prototype, - 'processResults' - ); - mockComponentWalkContentStub = sandbox.stub( - SourceComponent.prototype, - 'walkContent' - ); - notificationStub = sandbox.stub(notificationService, 'showErrorMessage'); - channelAppendLineStub = sandbox.stub(channelService, 'appendLine'); - channelShowChannelOutputStub = sandbox.stub( - channelService, - 'showChannelOutput' - ); - telemetryServiceSendExceptionStub = sandbox.stub( - telemetryService, - 'sendException' - ); - vscodeExecuteCommandStub = sandbox.stub(commands, 'executeCommand'); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('Should execute VS Code diff command', async () => { - const mockSourceComponent = new SourceComponent({ - name: 'mockFile', - type: { - id: 'ApexClass', - name: 'ApexClass' - } as any - }); - const mockResult: MetadataCacheResult = { - selectedType: PathType.Individual, - selectedPath: mockFilePath, - cache: { - baseDirectory: path.join(`/tmp/.sfdx/diff/${mockUsername}/`), - commonRoot: path.join('metadataPackage_100/main/default/classes'), - components: [mockSourceComponent] - }, - project: { - baseDirectory: path.join('/projects/trailheadapps/lwc-recipes'), - commonRoot: path.join('force-app/main/default/classes'), - components: [] - }, - properties: [] - }; - const remoteFsPath = path.join( - mockResult.cache.baseDirectory, - mockResult.cache.commonRoot, - 'mockFile.cls' - ); - const localFsPath = mockFilePath; - mockComponentWalkContentStub.returns([remoteFsPath]); - processStub.returns(mockResult); - - await sourceDiff(Uri.file(mockFilePath)); - - assert.calledOnce(vscodeExecuteCommandStub); - assert.calledWith( - vscodeExecuteCommandStub, - 'vscode.diff', - match.has('fsPath', remoteFsPath), - match.has('fsPath', localFsPath), - nls.localize( - 'source_diff_title', - mockUsername, - 'mockFile.cls', - 'mockFile.cls' - ) - ); - }); - - it('Should show message when diffing on unsupported file type', async () => { - const mockActiveTextEditor = { - document: { - uri: Uri.file(mockFilePath), - languageId: 'forcesourcemanifest' - } - }; - sandbox.stub(vscode.window, 'activeTextEditor').get(() => { - return mockActiveTextEditor; - }); - - await sourceDiff(); - - assert.calledOnce(telemetryServiceSendExceptionStub); - assert.calledWith( - telemetryServiceSendExceptionStub, - 'unsupported_type_on_diff', - nls.localize('source_diff_unsupported_type') - ); - assert.calledOnce(notificationStub); - assert.calledWith( - notificationStub, - nls.localize('source_diff_unsupported_type') - ); - assert.calledOnce(channelAppendLineStub); - assert.calledWith( - channelAppendLineStub, - nls.localize('source_diff_unsupported_type') - ); - assert.calledOnce(channelShowChannelOutputStub); - }); - }); - - describe('Folder Diff', () => { - let notificationStub: SinonStub; - let diffOneFileStub: SinonSpy; - let diffFolderStub: SinonSpy; - - beforeEach(() => { - notificationStub = stub(notificationService, 'showErrorMessage'); - diffOneFileStub = stub(differ, 'diffOneFile'); - diffFolderStub = stub(differ, 'diffFolder'); - }); - - afterEach(() => { - notificationStub.restore(); - diffOneFileStub.restore(); - diffFolderStub.restore(); - }); - - it('Should throw error for empty cache', async () => { - let expectedError = null; - try { - await conflictCommands.handleCacheResults('username', undefined); - } catch (error) { - expectedError = error; - } - expect(expectedError.message).to.equal( - nls.localize('source_diff_components_not_in_org') - ); - assert.calledOnce(notificationStub); - assert.calledWith( - notificationStub, - nls.localize('source_diff_components_not_in_org') - ); - }); - - it('Should diff one file', async () => { - const metadataCache: MetadataContext = { - baseDirectory: '.', - commonRoot: '.', - components: [] - }; - const cacheResult: MetadataCacheResult = { - selectedType: PathType.Individual, - selectedPath: '.', - cache: metadataCache, - project: metadataCache, - properties: [] - }; - await conflictCommands.handleCacheResults('username', cacheResult); - assert.calledOnce(diffOneFileStub); - }); - - it('Should diff folder', async () => { - const metadataCache: MetadataContext = { - baseDirectory: '.', - commonRoot: '.', - components: [] - }; - const cacheResult: MetadataCacheResult = { - selectedType: PathType.Folder, - selectedPath: '.', - cache: metadataCache, - project: metadataCache, - properties: [] - }; - await conflictCommands.handleCacheResults('username', cacheResult); - assert.calledOnce(diffFolderStub); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/startApexDebugLogging.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/startApexDebugLogging.test.ts deleted file mode 100644 index c6e593592e..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/startApexDebugLogging.test.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import { - CreateDebugLevel, - CreateTraceFlag, - developerLogTraceFlag, - QueryTraceFlag, - QueryUser, - StartApexDebugLoggingExecutor, - UpdateDebugLevelsExecutor, - UpdateTraceFlagsExecutor -} from '../../../src/commands'; -import { - APEX_CODE_DEBUG_LEVEL, - VISUALFORCE_DEBUG_LEVEL -} from '../../../src/constants'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Start Apex Debug Logging', () => { - let getTraceFlagIdStub: sinon.SinonStub; - let getDebugLevelIdStub: sinon.SinonStub; - let startDateStub: sinon.SinonStub; - let expDateStub: sinon.SinonStub; - const fakeTraceFlagId = 'fakeTraceFlagId'; - const fakeDebugLevelId = 'fakeDebugLevelId'; - const startDate = new Date(); - const endDate = new Date(startDate.getTime() + 1000); - - before(() => { - getTraceFlagIdStub = sinon - .stub(developerLogTraceFlag, 'getTraceFlagId') - .returns(fakeTraceFlagId); - getDebugLevelIdStub = sinon - .stub(developerLogTraceFlag, 'getDebugLevelId') - .returns(fakeDebugLevelId); - startDateStub = sinon - .stub(developerLogTraceFlag, 'getStartDate') - .returns(startDate); - expDateStub = sinon - .stub(developerLogTraceFlag, 'getExpirationDate') - .returns(endDate); - }); - - after(() => { - getTraceFlagIdStub.restore(); - getDebugLevelIdStub.restore(); - startDateStub.restore(); - expDateStub.restore(); - }); - - it('Should build the start logging command and only have description set', async () => { - const startLoggingExecutor = new StartApexDebugLoggingExecutor(); - const startLoggingCmd = startLoggingExecutor.build(); - expect(startLoggingCmd.toCommand().trim()).to.equal( - nls.localize('start_apex_debug_logging') - ); - }); - - it('Should build the traceflag query command for logging', async () => { - const queryTraceFlagsExecutor = new QueryTraceFlag(); - const updateTraceFlagCmd = queryTraceFlagsExecutor.build('005x00000000123'); - expect(updateTraceFlagCmd.toCommand()).to.equal( - "sf data:query --query SELECT id, logtype, startdate, expirationdate, debuglevelid, debuglevel.apexcode, debuglevel.visualforce FROM TraceFlag WHERE logtype='DEVELOPER_LOG' AND TracedEntityId='005x00000000123' --use-tooling-api --json" - ); - }); - - it('Should build the traceflag update command for logging', async () => { - const updateTraceFlagsExecutor = new UpdateTraceFlagsExecutor(); - const updateTraceFlagCmd = updateTraceFlagsExecutor.build(); - expect(updateTraceFlagCmd.toCommand()).to.equal( - `sf data:update:record --sobject TraceFlag --record-id ${fakeTraceFlagId} --values StartDate='' ExpirationDate='${endDate.toUTCString()}' --use-tooling-api --json` - ); - }); - - it('Should build the debuglevel update command for logging', async () => { - const updateDebugLevelsExecutor = new UpdateDebugLevelsExecutor(); - const updateDebugLevelCmd = updateDebugLevelsExecutor.build(); - expect(updateDebugLevelCmd.toCommand()).to.equal( - `sf data:update:record --sobject DebugLevel --record-id ${fakeDebugLevelId} --values ApexCode=${APEX_CODE_DEBUG_LEVEL} Visualforce=${VISUALFORCE_DEBUG_LEVEL} --use-tooling-api --json` - ); - }); - - it('Should build the traceflag create command for logging', async () => { - const createTraceFlagExecutor = new CreateTraceFlag('testUserId'); - const createTraceFlagCmd = createTraceFlagExecutor.build(); - expect(createTraceFlagCmd.toCommand()).to.equal( - `sf data:create:record --sobject TraceFlag --values tracedentityid='testUserId' logtype=developer_log debuglevelid=${fakeDebugLevelId} StartDate='' ExpirationDate='${endDate.toUTCString()} --use-tooling-api --json` - ); - }); - - it('Should build the debuglevel create command for logging', async () => { - const createDebugLevelExecutor = new CreateDebugLevel(); - const createDebugLevelCmd = createDebugLevelExecutor.build(); - expect(createDebugLevelCmd.toCommand()).to.equal( - `sf data:create:record --sobject DebugLevel --values developername=${createDebugLevelExecutor.developerName} MasterLabel=${createDebugLevelExecutor.developerName} apexcode=${APEX_CODE_DEBUG_LEVEL} visualforce=${VISUALFORCE_DEBUG_LEVEL} --use-tooling-api --json` - ); - }); - - it('Should build the user id query command', async () => { - const testUser = 'user@test.org'; - const forceQueryUserExecutor = new QueryUser(testUser); - const forceQueryUserCmd = forceQueryUserExecutor.build(); - expect(forceQueryUserCmd.toCommand()).to.equal( - `sf data:query --query SELECT id FROM User WHERE username='${testUser}' --json` - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/stopApexDebugLogging.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/stopApexDebugLogging.test.ts deleted file mode 100644 index 4e4bbbe881..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/stopApexDebugLogging.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import { - developerLogTraceFlag, - StopApexDebugLoggingExecutor -} from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Source Status', () => { - let getDebugLevelIdStub: sinon.SinonStub; - const fakeTraceFlagId = 'fakeDebugLevelId'; - - before(() => { - getDebugLevelIdStub = sinon - .stub(developerLogTraceFlag, 'getTraceFlagId') - .returns(fakeTraceFlagId); - }); - - after(() => { - getDebugLevelIdStub.restore(); - }); - - it('Should build the source command no flag', async () => { - const forceStopLogging = new StopApexDebugLoggingExecutor(); - const forceStopLoggingCmd = forceStopLogging.build(); - expect(forceStopLoggingCmd.toCommand()).to.equal( - `sf data:delete:record --sobject TraceFlag --record-id ${fakeTraceFlagId} --use-tooling-api` - ); - expect(forceStopLoggingCmd.description).to.equal( - nls.localize('stop_apex_debug_logging') - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/analyticsGenerateTemplate.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/analyticsGenerateTemplate.test.ts deleted file mode 100644 index 8209f3a98c..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/analyticsGenerateTemplate.test.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as path from 'path'; -import * as shell from 'shelljs'; -import { SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { analyticsGenerateTemplate } from '../../../../src/commands/templates/analyticsGenerateTemplate'; -import { notificationService } from '../../../../src/notifications'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Analytics Generate Template', () => { - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - - beforeEach(() => { - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub(notificationService, 'showFailedExecution'); - }); - - afterEach(() => { - showInputBoxStub.restore(); - quickPickStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - }); - - it('Should generate Analytics Template', async () => { - // arrange - const outputPath = 'force-app/main/default/waveTemplates'; - const templateInfoJsonPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestWave', - 'template-info.json' - ); - const templateFolderJsonPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestWave', - 'folder.json' - ); - const templateDashboardPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestWave/dashboards', - 'TestWaveDashboard.json' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, 'TestWave') - ); - assert.noFile([ - templateInfoJsonPath, - templateFolderJsonPath, - templateDashboardPath - ]); - showInputBoxStub.returns('TestWave'); - quickPickStub.returns(outputPath); - - // act - await analyticsGenerateTemplate(); - - // assert - assert.file([ - templateInfoJsonPath, - templateFolderJsonPath, - templateDashboardPath - ]); - assert.fileContent(templateInfoJsonPath, '"label": "TestWave"'); - assert.fileContent(templateFolderJsonPath, '"name": "TestWave"'); - assert.fileContent(templateDashboardPath, '"name": "TestWaveDashboard_tp"'); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/apexGenerateClass.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/apexGenerateClass.test.ts deleted file mode 100644 index 8df46715be..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/apexGenerateClass.test.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ConfigUtil } from '@salesforce/salesforcedx-utils-vscode'; -import { TemplateService } from '@salesforce/templates'; -import { nls as templatesNls } from '@salesforce/templates/lib/i18n'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { apexGenerateClass } from '../../../../src/commands/templates/apexGenerateClass'; -import { nls } from '../../../../src/messages'; -import { notificationService } from '../../../../src/notifications'; -import { telemetryService } from '../../../../src/telemetry'; -import { workspaceUtils } from '../../../../src/util'; - -const sandbox = createSandbox(); - -// tslint:disable:no-unused-expression -describe('Apex Generate Class', () => { - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let openTextDocumentStub: SinonStub; - let sendCommandEventStub: SinonStub; - let sendExceptionStub: SinonStub; - let getTemplatesDirectoryStub: SinonStub; - - beforeEach(() => { - showInputBoxStub = sandbox.stub(vscode.window, 'showInputBox'); - quickPickStub = sandbox.stub(vscode.window, 'showQuickPick'); - appendLineStub = sandbox.stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = sandbox - .stub(notificationService, 'showSuccessfulExecution') - .resolves(); - showFailedExecutionStub = sandbox.stub( - notificationService, - 'showFailedExecution' - ); - openTextDocumentStub = sandbox.stub(vscode.workspace, 'openTextDocument'); - sendCommandEventStub = sandbox.stub(telemetryService, 'sendCommandEvent'); - sendExceptionStub = sandbox.stub(telemetryService, 'sendException'); - getTemplatesDirectoryStub = sandbox - .stub(ConfigUtil, 'getTemplatesDirectory') - .returns(undefined); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('Should generate Apex Class', async () => { - // arrange - const outputPath = 'force-app/main/default/classes'; - const apexClassPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexClass.cls' - ); - const apexClassMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexClass.cls-meta.xml' - ); - shell.rm('-f', apexClassPath); - shell.rm('-f', apexClassMetaPath); - assert.noFile([apexClassPath, apexClassMetaPath]); - showInputBoxStub.returns('TestApexClass'); - quickPickStub.returns(outputPath); - - // act - await apexGenerateClass(); - - // assert - const defaultApiVersion = TemplateService.getDefaultApiVersion(); - assert.file([apexClassPath, apexClassMetaPath]); - assert.fileContent( - apexClassPath, - 'public with sharing class TestApexClass' - ); - assert.fileContent( - apexClassMetaPath, - ` - - ${defaultApiVersion} - Active -` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, apexClassPath); - - sinon.assert.calledOnce(sendCommandEventStub); - sinon.assert.calledWith( - sendCommandEventStub, - 'apex_generate_class', - sinon.match.array, - { - dirType: 'defaultDir', - commandExecutor: 'library', - isUsingCustomOrgMetadataTemplates: 'false' - } - ); - - // clean up - shell.rm('-f', apexClassPath); - shell.rm('-f', apexClassMetaPath); - }); - - it('Should handle error and log telemetry for exceptions', async () => { - // arrange - const outputPath = 'force-app/main/default/classes'; - showInputBoxStub.returns('?invalid'); - quickPickStub.returns(outputPath); - - // act - await apexGenerateClass(); - - // assert - const errorMessage = templatesNls.localize('AlphaNumericNameError'); - sinon.assert.calledOnce(appendLineStub); - sinon.assert.calledWith(appendLineStub, errorMessage); - sinon.assert.calledOnce(showFailedExecutionStub); - sinon.assert.calledWith( - showFailedExecutionStub, - nls.localize('apex_generate_class_text') - ); - sinon.assert.calledOnce(sendExceptionStub); - sinon.assert.calledWith( - sendExceptionStub, - 'template_create_library', - errorMessage - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/apexGenerateTrigger.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/apexGenerateTrigger.test.ts deleted file mode 100644 index 43b7fdbc13..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/apexGenerateTrigger.test.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { TemplateService } from '@salesforce/templates'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import { SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { apexGenerateTrigger } from '../../../../src/commands/templates/apexGenerateTrigger'; -import { notificationService } from '../../../../src/notifications'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Apex Generate Trigger', () => { - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - - beforeEach(() => { - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub(notificationService, 'showFailedExecution'); - }); - - afterEach(() => { - showInputBoxStub.restore(); - quickPickStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - }); - - it('Should generate Apex Trigger', async () => { - // arrange - const outputPath = 'force-app/main/default/triggers'; - const apexTriggerPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexTrigger.trigger' - ); - const apexTriggerMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexTrigger.trigger-meta.xml' - ); - shell.rm('-f', apexTriggerPath); - shell.rm('-f', apexTriggerMetaPath); - assert.noFile([apexTriggerPath, apexTriggerMetaPath]); - showInputBoxStub.returns('TestApexTrigger'); - quickPickStub.returns(outputPath); - - // act - await apexGenerateTrigger(); - - // assert - const defaultApiVersion = TemplateService.getDefaultApiVersion(); - assert.file([apexTriggerPath, apexTriggerMetaPath]); - assert.fileContent( - apexTriggerPath, - `trigger TestApexTrigger on SOBJECT (before insert) { - -}` - ); - assert.fileContent( - apexTriggerMetaPath, - ` - - ${defaultApiVersion} - Active -` - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/customTemplates.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/customTemplates.test.ts deleted file mode 100644 index 80a034132a..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/customTemplates.test.ts +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ConfigUtil } from '@salesforce/salesforcedx-utils-vscode'; -import { TemplateService } from '@salesforce/templates'; -import { nls as templatesNls } from '@salesforce/templates/lib/i18n'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { - apexGenerateClass, - lightningGenerateLwc -} from '../../../../src/commands/templates'; -import { nls } from '../../../../src/messages'; -import { notificationService } from '../../../../src/notifications'; -import { telemetryService } from '../../../../src/telemetry'; -import { workspaceUtils } from '../../../../src/util'; - -const TEST_CUSTOM_TEMPLATES_REPO = - 'https://github.com/forcedotcom/salesforcedx-templates/tree/main/test/custom-templates'; -const NON_EXISTENT_LOCAL_PATH = 'this-folder-does-not-exist'; -const NON_EXISTENT_REPO = - 'https://github.com/forcedotcom/this-repo-does-not-exist'; - -const sandbox = createSandbox(); - -describe('Custom Templates Create', () => { - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let openTextDocumentStub: SinonStub; - let sendCommandEventStub: SinonStub; - let sendExceptionStub: SinonStub; - let getTemplatesDirectoryStub: SinonStub; - - beforeEach(() => { - showInputBoxStub = sandbox.stub(vscode.window, 'showInputBox'); - quickPickStub = sandbox.stub(vscode.window, 'showQuickPick'); - appendLineStub = sandbox.stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = sandbox.stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = sandbox.stub( - notificationService, - 'showFailedExecution' - ); - openTextDocumentStub = sandbox.stub(vscode.workspace, 'openTextDocument'); - sendCommandEventStub = sandbox.stub(telemetryService, 'sendCommandEvent'); - sendExceptionStub = sandbox.stub(telemetryService, 'sendException'); - getTemplatesDirectoryStub = sandbox.stub( - ConfigUtil, - 'getTemplatesDirectory' - ); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('Should create Apex Class with custom templates', async () => { - // arrange - getTemplatesDirectoryStub.returns(TEST_CUSTOM_TEMPLATES_REPO); - const outputPath = 'force-app/main/default/classes'; - const apexClassPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexClass.cls' - ); - const apexClassMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexClass.cls-meta.xml' - ); - shell.rm('-f', apexClassPath); - shell.rm('-f', apexClassMetaPath); - assert.noFile([apexClassPath, apexClassMetaPath]); - showInputBoxStub.returns('TestApexClass'); - quickPickStub.returns(outputPath); - - // act - await apexGenerateClass(); - - // assert - const defaultApiVersion = TemplateService.getDefaultApiVersion(); - assert.file([apexClassPath, apexClassMetaPath]); - assert.fileContent( - apexClassPath, - 'public with sharing class CustomTestApexClass' - ); - assert.fileContent( - apexClassMetaPath, - ` - - ${defaultApiVersion} - Inactive -` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, apexClassPath); - - sinon.assert.calledOnce(sendCommandEventStub); - sinon.assert.calledWith( - sendCommandEventStub, - 'apex_generate_class', - sinon.match.array, - { - dirType: 'defaultDir', - commandExecutor: 'library', - isUsingCustomOrgMetadataTemplates: 'true' - } - ); - - // clean up - shell.rm('-f', apexClassPath); - shell.rm('-f', apexClassMetaPath); - }).timeout(20000); - - it('Should handle error and log telemetry if local template does not exist', async () => { - // arrange - getTemplatesDirectoryStub.returns(NON_EXISTENT_LOCAL_PATH); - const outputPath = 'force-app/main/default/classes'; - const apexClassPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexClass.cls' - ); - const apexClassMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexClass.cls-meta.xml' - ); - shell.rm('-f', apexClassPath); - shell.rm('-f', apexClassMetaPath); - assert.noFile([apexClassPath, apexClassMetaPath]); - showInputBoxStub.returns('TestApexClass'); - quickPickStub.returns(outputPath); - - // act - await apexGenerateClass(); - - // assert - const errorMessage = templatesNls.localize( - 'localCustomTemplateDoNotExist', - NON_EXISTENT_LOCAL_PATH - ); - sinon.assert.calledOnce(appendLineStub); - sinon.assert.calledWith(appendLineStub, errorMessage); - sinon.assert.calledOnce(showFailedExecutionStub); - sinon.assert.calledWith( - showFailedExecutionStub, - nls.localize('apex_generate_class_text') - ); - sinon.assert.calledOnce(sendExceptionStub); - sinon.assert.calledWith( - sendExceptionStub, - 'template_create_library', - errorMessage - ); - }); - - it('Should handle error and log telemetry if cannot retrieve default branch', async () => { - // arrange - getTemplatesDirectoryStub.returns(NON_EXISTENT_REPO); - const outputPath = 'force-app/main/default/classes'; - const apexClassPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexClass.cls' - ); - const apexClassMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'TestApexClass.cls-meta.xml' - ); - shell.rm('-f', apexClassPath); - shell.rm('-f', apexClassMetaPath); - assert.noFile([apexClassPath, apexClassMetaPath]); - showInputBoxStub.returns('TestApexClass'); - quickPickStub.returns(outputPath); - - // act - await apexGenerateClass(); - - // assert - const errorMessage = templatesNls.localize( - 'customTemplatesCannotRetrieveDefaultBranch', - NON_EXISTENT_REPO - ); - sinon.assert.calledOnce(appendLineStub); - sinon.assert.calledWith(appendLineStub, errorMessage); - sinon.assert.calledOnce(showFailedExecutionStub); - sinon.assert.calledWith( - showFailedExecutionStub, - nls.localize('apex_generate_class_text') - ); - sinon.assert.calledOnce(sendExceptionStub); - sinon.assert.calledWith( - sendExceptionStub, - 'template_create_library', - errorMessage - ); - }); - - it('Should create from default template if git repo templates do not have the template type', async () => { - // arrange - getTemplatesDirectoryStub.returns(TEST_CUSTOM_TEMPLATES_REPO); - const fileName = 'testLwc'; - const outputPath = 'force-app/main/default/lwc'; - const lwcHtmlPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testLwc.html' - ); - const lwcJsPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testLwc.js' - ); - const lwcJsMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testLwc.js-meta.xml' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - assert.noFile([lwcHtmlPath, lwcJsPath, lwcJsMetaPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - await lightningGenerateLwc(); - - // assert - const defaultApiVersion = TemplateService.getDefaultApiVersion(); - assert.file([lwcHtmlPath, lwcJsPath, lwcJsMetaPath]); - assert.fileContent(lwcHtmlPath, ''); - assert.fileContent( - lwcJsPath, - `import { LightningElement } from 'lwc'; - -export default class TestLwc extends LightningElement {}` - ); - assert.fileContent( - lwcJsMetaPath, - ` - - ${defaultApiVersion} - false -` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, lwcJsPath); - - sinon.assert.calledOnce(sendCommandEventStub); - sinon.assert.calledWith( - sendCommandEventStub, - 'lightning_generate_lwc', - sinon.match.array, - { - dirType: 'defaultDir', - commandExecutor: 'library', - isUsingCustomOrgMetadataTemplates: 'true' - } - ); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - }).timeout(20000); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/forceLightningLwcTestCreate.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/forceLightningLwcTestCreate.test.ts deleted file mode 100644 index 9d4dd6455f..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/forceLightningLwcTestCreate.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import { ForceLightningLwcTestCreateExecutor } from '../../../../src/commands/templates'; -import { nls } from '../../../../src/messages'; -import { workspaceUtils } from '../../../../src/util'; - -describe('Force Lightning Web Component Test Create', () => { - it('Should build the Lightning Web Component Test create command', async () => { - const lightningLWCTestCreate = new ForceLightningLwcTestCreateExecutor(); - const outputDirPath = path.join('force-app', 'main', 'default', 'lwc'); - const fileName = 'testing'; - const lwcCreateTestCommand = lightningLWCTestCreate.build({ - fileName, - outputdir: path.join(outputDirPath, 'testing') - }); - const fullFilepath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputDirPath, - 'testing', - fileName + '.js' - ); - - if (fullFilepath) { - expect(lwcCreateTestCommand.toCommand()).to.equal( - `sf force:lightning:lwc:test:create --filepath ${fullFilepath}` - ); - expect(lwcCreateTestCommand.description).to.equal( - nls.localize('force_lightning_lwc_test_create_text') - ); - expect(lightningLWCTestCreate.getDefaultDirectory()).to.equal('lwc'); - expect(lightningLWCTestCreate.getFileExtension()).to.equal('.js'); - expect( - lightningLWCTestCreate - .getSourcePathStrategy() - .getPathToSource(path.join(outputDirPath, 'testing'), fileName, '.js') - ).to.equal( - path.join(outputDirPath, fileName, '__tests__', `${fileName}.test.js`) - ); - } - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/internalCommandUtils.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/internalCommandUtils.test.ts deleted file mode 100644 index ce12a7d42a..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/internalCommandUtils.test.ts +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ContinueResponse } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import { SinonStub, stub } from 'sinon'; -import { Uri } from 'vscode'; -import { - FileInternalPathGatherer, - InternalDevWorkspaceChecker -} from '../../../../src/commands/templates'; -import { SalesforceCoreSettings } from '../../../../src/settings/salesforceCoreSettings'; - -describe('Internal Command Utilities', () => { - describe('Internal Workspace Checker', () => { - let settings: SinonStub; - - beforeEach(() => { - settings = stub(SalesforceCoreSettings.prototype, 'getInternalDev'); - }); - - afterEach(() => { - settings.restore(); - }); - - it('Should always return false', async () => { - settings.returns(false); - const internalDevWSChecker = new InternalDevWorkspaceChecker(); - expect(internalDevWSChecker.check()).to.be.eql(false); - }); - - it('Should always return true', async () => { - settings.returns(true); - const internalDevWSChecker = new InternalDevWorkspaceChecker(); - expect(internalDevWSChecker.check()).to.be.eql(true); - }); - }); - - describe('File Internal Path Gatherer', () => { - let existsSyncStub: sinon.SinonStub; - let lstatSyncStub: sinon.SinonStub; - - beforeEach(() => { - existsSyncStub = stub(fs, 'existsSync'); - lstatSyncStub = stub(fs, 'lstatSync'); - }); - - afterEach(() => { - existsSyncStub.restore(); - lstatSyncStub.restore(); - }); - - it('Should return Continue', async () => { - existsSyncStub.returns(true); - const testDir = path.join('path', 'to', 'outside', 'dir'); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - }); - - const folderPathGatherer = new FileInternalPathGatherer( - Uri.parse(testDir) - ); - const response = (await folderPathGatherer.gather()) as ContinueResponse<{ - outputdir: string; - }>; - expect(response.type).to.equal('CONTINUE'); - expect(response.data.outputdir).contains(testDir); - }); - - it('Should return Cancel if path is not a directory', async () => { - existsSyncStub.returns(true); - const testDir = Uri.parse('file:///path/to/outside/dir'); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - }); - - const folderPathGatherer = new FileInternalPathGatherer(testDir); - const response = await folderPathGatherer.gather(); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return Cancel if path does not exist', async () => { - existsSyncStub.returns(false); - const testDir = Uri.parse('file:///path/to/outside/dir'); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - }); - - const folderPathGatherer = new FileInternalPathGatherer(testDir); - const response = await folderPathGatherer.gather(); - expect(response.type).to.equal('CANCEL'); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateApp.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateApp.test.ts deleted file mode 100644 index ea96fc4769..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateApp.test.ts +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as path from 'path'; -import * as shell from 'shelljs'; -import { SinonStub, stub } from 'sinon'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { - internalLightningGenerateApp, - lightningGenerateApp -} from '../../../../src/commands/templates/lightningGenerateApp'; -import { notificationService } from '../../../../src/notifications'; -import { SalesforceCoreSettings } from '../../../../src/settings/salesforceCoreSettings'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Lightning Generate App', () => { - let getInternalDevStub: SinonStub; - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let openTextDocumentStub: SinonStub; - - beforeEach(() => { - getInternalDevStub = stub( - SalesforceCoreSettings.prototype, - 'getInternalDev' - ); - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub(notificationService, 'showFailedExecution'); - openTextDocumentStub = stub(vscode.workspace, 'openTextDocument'); - }); - - afterEach(() => { - getInternalDevStub.restore(); - showInputBoxStub.restore(); - quickPickStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - openTextDocumentStub.restore(); - }); - - it('Should generate Aura App', async () => { - // arrange - getInternalDevStub.returns(false); - const outputPath = 'force-app/main/default/aura'; - const auraAppPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testApp', - 'testApp.app' - ); - const auraAppMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testApp', - 'testApp.app-meta.xml' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, 'testApp') - ); - assert.noFile([auraAppPath, auraAppMetaPath]); - showInputBoxStub.returns('testApp'); - quickPickStub.returns(outputPath); - - // act - await lightningGenerateApp(); - - // assert - const suffixarray = [ - '.app', - '.app-meta.xml', - '.auradoc', - '.css', - 'Controller.js', - 'Helper.js', - 'Renderer.js', - '.svg' - ]; - for (const suffix of suffixarray) { - assert.file( - path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testApp', - `testApp${suffix}` - ) - ); - } - assert.fileContent( - auraAppPath, - '\n\n' - ); - assert.fileContent( - auraAppMetaPath, - '' - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, auraAppPath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, 'testApp') - ); - }); - - it('Should generate internal Aura App', async () => { - // arrange - getInternalDevStub.returns(true); - const outputPath = 'force-app/main/default/aura'; - const auraAppPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testApp', - 'testApp.app' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, 'testApp') - ); - assert.noFile([auraAppPath]); - showInputBoxStub.returns('testApp'); - - // act - shell.mkdir( - '-p', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ); - await internalLightningGenerateApp( - vscode.Uri.file( - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ) - ); - - // assert - const suffixarray = [ - '.app', - '.auradoc', - '.css', - 'Controller.js', - 'Helper.js', - 'Renderer.js', - '.svg' - ]; - for (const suffix of suffixarray) { - assert.file( - path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testApp', - `testApp${suffix}` - ) - ); - } - assert.fileContent( - auraAppPath, - '\n\n' - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, auraAppPath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, 'testApp') - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateAuraComponent.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateAuraComponent.test.ts deleted file mode 100644 index 623d7454b8..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateAuraComponent.test.ts +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as path from 'path'; -import * as shell from 'shelljs'; -import { SinonStub, stub } from 'sinon'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { - internalLightningGenerateAuraComponent, - lightningGenerateAuraComponent -} from '../../../../src/commands/templates/lightningGenerateAuraComponent'; -import { notificationService } from '../../../../src/notifications'; -import { SalesforceCoreSettings } from '../../../../src/settings/salesforceCoreSettings'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Lightning Generate Component', () => { - let getInternalDevStub: SinonStub; - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let openTextDocumentStub: SinonStub; - - beforeEach(() => { - getInternalDevStub = stub( - SalesforceCoreSettings.prototype, - 'getInternalDev' - ); - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub(notificationService, 'showFailedExecution'); - openTextDocumentStub = stub(vscode.workspace, 'openTextDocument'); - }); - - afterEach(() => { - getInternalDevStub.restore(); - showInputBoxStub.restore(); - quickPickStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - openTextDocumentStub.restore(); - }); - - it('Should generate Aura Component', async () => { - // arrange - getInternalDevStub.returns(false); - const fileName = 'testComponent'; - const outputPath = 'force-app/main/default/aura'; - const auraComponentPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testComponent', - 'testComponent.cmp' - ); - const auraComponentMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testComponent', - 'testComponent.cmp-meta.xml' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - assert.noFile([auraComponentPath, auraComponentMetaPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - await lightningGenerateAuraComponent(); - - // assert - const suffixarray = [ - '.cmp', - '.cmp-meta.xml', - '.auradoc', - '.css', - 'Controller.js', - 'Helper.js', - 'Renderer.js', - '.svg', - '.design' - ]; - for (const suffix of suffixarray) { - assert.file( - path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - `${fileName}${suffix}` - ) - ); - } - assert.fileContent( - auraComponentPath, - '\n\n' - ); - assert.fileContent( - auraComponentMetaPath, - '' - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, auraComponentPath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - }); - - it('Should generate internal Aura Component', async () => { - // arrange - getInternalDevStub.returns(true); - const fileName = 'testComponent'; - const outputPath = 'force-app/main/default/aura'; - const auraComponentPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testComponent', - 'testComponent.cmp' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - assert.noFile([auraComponentPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - shell.mkdir( - '-p', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ); - await internalLightningGenerateAuraComponent( - vscode.Uri.file( - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ) - ); - - // assert - const suffixarray = [ - '.cmp', - '.auradoc', - '.css', - 'Controller.js', - 'Helper.js', - 'Renderer.js', - '.svg', - '.design' - ]; - for (const suffix of suffixarray) { - assert.file( - path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - `${fileName}${suffix}` - ) - ); - } - assert.fileContent( - auraComponentPath, - '\n\n' - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, auraComponentPath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateEvent.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateEvent.test.ts deleted file mode 100644 index d1da00706b..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateEvent.test.ts +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { TemplateService } from '@salesforce/templates'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import { SinonStub, stub } from 'sinon'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { - internalLightningGenerateEvent, - lightningGenerateEvent -} from '../../../../src/commands/templates/lightningGenerateEvent'; -import { notificationService } from '../../../../src/notifications'; -import { SalesforceCoreSettings } from '../../../../src/settings/salesforceCoreSettings'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Lightning Generate Event', () => { - let getInternalDevStub: SinonStub; - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let openTextDocumentStub: SinonStub; - - beforeEach(() => { - getInternalDevStub = stub( - SalesforceCoreSettings.prototype, - 'getInternalDev' - ); - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub(notificationService, 'showFailedExecution'); - openTextDocumentStub = stub(vscode.workspace, 'openTextDocument'); - }); - - afterEach(() => { - getInternalDevStub.restore(); - showInputBoxStub.restore(); - quickPickStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - openTextDocumentStub.restore(); - }); - - it('Should generate Aura Event', async () => { - // arrange - getInternalDevStub.returns(false); - const fileName = 'testEvent'; - const outputPath = 'force-app/main/default/aura'; - const auraEventPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testEvent.evt' - ); - const auraEventMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testEvent.evt-meta.xml' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - assert.noFile([auraEventPath, auraEventMetaPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - await lightningGenerateEvent(); - - // assert - const defaultApiVersion = TemplateService.getDefaultApiVersion(); - assert.file([auraEventPath, auraEventMetaPath]); - assert.fileContent( - auraEventPath, - '' - ); - assert.fileContent( - auraEventMetaPath, - ` - - ${defaultApiVersion} - A Lightning Event Bundle -` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, auraEventPath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - }); - - it('Should generate internal Aura Event', async () => { - // arrange - getInternalDevStub.returns(true); - const fileName = 'testEvent'; - const outputPath = 'force-app/main/default/aura'; - const auraEventPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testEvent.evt' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - assert.noFile([auraEventPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - shell.mkdir( - '-p', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ); - await internalLightningGenerateEvent( - vscode.Uri.file( - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ) - ); - - // assert - assert.file([auraEventPath]); - assert.fileContent( - auraEventPath, - '' - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, auraEventPath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateInterface.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateInterface.test.ts deleted file mode 100644 index f4538af05c..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateInterface.test.ts +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { TemplateService } from '@salesforce/templates'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import { SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { - internalLightningGenerateInterface, - lightningGenerateInterface -} from '../../../../src/commands/templates/lightningGenerateInterface'; -import { notificationService } from '../../../../src/notifications'; -import { SalesforceCoreSettings } from '../../../../src/settings/salesforceCoreSettings'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Lightning Generate Interface', () => { - let getInternalDevStub: SinonStub; - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let openTextDocumentStub: SinonStub; - - beforeEach(() => { - getInternalDevStub = stub( - SalesforceCoreSettings.prototype, - 'getInternalDev' - ); - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub(notificationService, 'showFailedExecution'); - openTextDocumentStub = stub(vscode.workspace, 'openTextDocument'); - }); - - afterEach(() => { - getInternalDevStub.restore(); - showInputBoxStub.restore(); - quickPickStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - openTextDocumentStub.restore(); - }); - - it('Should generate Aura Interface', async () => { - // arrange - getInternalDevStub.returns(false); - const fileName = 'testInterface'; - const outputPath = 'force-app/main/default/aura'; - const auraInterfacePath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testInterface.intf' - ); - const auraInterfaceMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testInterface.intf-meta.xml' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - assert.noFile([auraInterfacePath, auraInterfaceMetaPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - await lightningGenerateInterface(); - - // assert - const defaultApiVersion = TemplateService.getDefaultApiVersion(); - assert.file([auraInterfacePath, auraInterfaceMetaPath]); - assert.fileContent( - auraInterfacePath, - ` - -` - ); - assert.fileContent( - auraInterfaceMetaPath, - ` - - ${defaultApiVersion} - A Lightning Interface Bundle -` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, auraInterfacePath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - }); - - it('Should generate internal Aura Interface', async () => { - // arrange - getInternalDevStub.returns(true); - const fileName = 'testInterface'; - const outputPath = 'force-app/main/default/aura'; - const auraInterfacePath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testInterface.intf' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - assert.noFile([auraInterfacePath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - shell.mkdir( - '-p', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ); - await internalLightningGenerateInterface( - vscode.Uri.file( - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ) - ); - - // assert - assert.file([auraInterfacePath]); - assert.fileContent( - auraInterfacePath, - ` - -` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, auraInterfacePath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateLwc.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateLwc.test.ts deleted file mode 100644 index f280ce89e0..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/lightningGenerateLwc.test.ts +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { TemplateService } from '@salesforce/templates'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import { SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { - internalLightningGenerateLwc, - lightningGenerateLwc -} from '../../../../src/commands/templates'; -import { notificationService } from '../../../../src/notifications'; -import { SalesforceCoreSettings } from '../../../../src/settings/salesforceCoreSettings'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Generate Lightning Web Component', () => { - let getInternalDevStub: SinonStub; - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let openTextDocumentStub: SinonStub; - - beforeEach(() => { - getInternalDevStub = stub( - SalesforceCoreSettings.prototype, - 'getInternalDev' - ); - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub(notificationService, 'showFailedExecution'); - openTextDocumentStub = stub(vscode.workspace, 'openTextDocument'); - }); - - afterEach(() => { - getInternalDevStub.restore(); - showInputBoxStub.restore(); - quickPickStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - openTextDocumentStub.restore(); - }); - - it('Should generate LWC', async () => { - // arrange - getInternalDevStub.returns(false); - const fileName = 'testLwc'; - const outputPath = 'force-app/main/default/lwc'; - const lwcHtmlPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testLwc.html' - ); - const lwcJsPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testLwc.js' - ); - const lwcJsMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testLwc.js-meta.xml' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - assert.noFile([lwcHtmlPath, lwcJsPath, lwcJsMetaPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - await lightningGenerateLwc(); - - // assert - const defaultApiVersion = TemplateService.getDefaultApiVersion(); - assert.file([lwcHtmlPath, lwcJsPath, lwcJsMetaPath]); - assert.fileContent(lwcHtmlPath, ''); - assert.fileContent( - lwcJsPath, - `import { LightningElement } from 'lwc'; - -export default class TestLwc extends LightningElement {}` - ); - assert.fileContent( - lwcJsMetaPath, - ` - - ${defaultApiVersion} - false -` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, lwcJsPath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - }); - - it('Should generate internal LWC', async () => { - // arrange - getInternalDevStub.returns(true); - const fileName = 'testLwc'; - const outputPath = 'force-app/main/default/lwc'; - const lwcHtmlPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testLwc.html' - ); - const lwcJsPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - fileName, - 'testLwc.js' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - assert.noFile([lwcHtmlPath, lwcJsPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - shell.mkdir( - '-p', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ); - await internalLightningGenerateLwc( - vscode.Uri.file( - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ) - ); - - // assert - assert.file([lwcHtmlPath, lwcJsPath]); - assert.fileContent(lwcHtmlPath, ''); - assert.fileContent( - lwcJsPath, - `import { LightningElement } from 'lwc'; - -export default class TestLwc extends LightningElement {}` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, lwcJsPath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath, fileName) - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/visualforceGenerateComponent.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/visualforceGenerateComponent.test.ts deleted file mode 100644 index 309f1b7d34..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/visualforceGenerateComponent.test.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { TemplateService } from '@salesforce/templates'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import { SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { visualforceGenerateComponent } from '../../../../src/commands/templates'; -import { notificationService } from '../../../../src/notifications'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Visualforce Generate Component', () => { - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let openTextDocumentStub: SinonStub; - - beforeEach(() => { - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub(notificationService, 'showFailedExecution'); - openTextDocumentStub = stub(vscode.workspace, 'openTextDocument'); - }); - - afterEach(() => { - showInputBoxStub.restore(); - quickPickStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - openTextDocumentStub.restore(); - }); - - it('Should generate Visualforce Component', async () => { - // arrange - const fileName = 'testVFCmp'; - const outputPath = 'force-app/main/default/components'; - const vfCmpPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testVFCmp.component' - ); - const vfCmpMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testVFCmp.component-meta.xml' - ); - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ); - assert.noFile([vfCmpPath, vfCmpMetaPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - await visualforceGenerateComponent(); - - // assert - const defaultApiVersion = TemplateService.getDefaultApiVersion(); - assert.file([vfCmpPath, vfCmpMetaPath]); - assert.fileContent( - vfCmpPath, - ` - -

Congratulations

-This is your new Component - -
` - ); - assert.fileContent( - vfCmpMetaPath, - ` - - ${defaultApiVersion} - -` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, vfCmpPath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/visualforceGeneratePage.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/visualforceGeneratePage.test.ts deleted file mode 100644 index a6597e5c8b..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/templates/visualforceGeneratePage.test.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { TemplateService } from '@salesforce/templates'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import { SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import * as assert from 'yeoman-assert'; -import { channelService } from '../../../../src/channels'; -import { visualforceGeneratePage } from '../../../../src/commands/templates'; -import { notificationService } from '../../../../src/notifications'; -import { workspaceUtils } from '../../../../src/util'; - -// tslint:disable:no-unused-expression -describe('Visualforce Generate Page', () => { - let showInputBoxStub: SinonStub; - let quickPickStub: SinonStub; - let appendLineStub: SinonStub; - let showSuccessfulExecutionStub: SinonStub; - let showFailedExecutionStub: SinonStub; - let openTextDocumentStub: SinonStub; - - beforeEach(() => { - showInputBoxStub = stub(vscode.window, 'showInputBox'); - quickPickStub = stub(vscode.window, 'showQuickPick'); - appendLineStub = stub(channelService, 'appendLine'); - showSuccessfulExecutionStub = stub( - notificationService, - 'showSuccessfulExecution' - ); - showSuccessfulExecutionStub.returns(Promise.resolve()); - showFailedExecutionStub = stub(notificationService, 'showFailedExecution'); - openTextDocumentStub = stub(vscode.workspace, 'openTextDocument'); - }); - - afterEach(() => { - showInputBoxStub.restore(); - quickPickStub.restore(); - showSuccessfulExecutionStub.restore(); - showFailedExecutionStub.restore(); - appendLineStub.restore(); - openTextDocumentStub.restore(); - }); - - it('Should generate Visualforce Component', async () => { - // arrange - const fileName = 'testVFPage'; - const outputPath = 'force-app/main/default/components'; - const vfPagePath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testVFPage.page' - ); - const vfPageMetaPath = path.join( - workspaceUtils.getRootWorkspacePath(), - outputPath, - 'testVFPage.page-meta.xml' - ); - shell.rm('-f', path.join(vfPagePath)); - shell.rm('-f', path.join(vfPageMetaPath)); - assert.noFile([vfPagePath, vfPageMetaPath]); - showInputBoxStub.returns(fileName); - quickPickStub.returns(outputPath); - - // act - await visualforceGeneratePage(); - - // assert - const defaultApiVersion = TemplateService.getDefaultApiVersion(); - assert.file([vfPagePath, vfPageMetaPath]); - assert.fileContent( - vfPagePath, - ` - -

Congratulations

-This is your new Page - -
` - ); - assert.fileContent( - vfPageMetaPath, - ` - \n ${defaultApiVersion} - -` - ); - sinon.assert.calledOnce(openTextDocumentStub); - sinon.assert.calledWith(openTextDocumentStub, vfPagePath); - - // clean up - shell.rm( - '-rf', - path.join(workspaceUtils.getRootWorkspacePath(), outputPath) - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/betaDeployRetrieve.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/betaDeployRetrieve.test.ts deleted file mode 100644 index 726c3b3386..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/betaDeployRetrieve.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ComponentSet, registry } from '@salesforce/source-deploy-retrieve'; -import { SourceComponent } from '@salesforce/source-deploy-retrieve'; -import { expect } from 'chai'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { createComponentCount } from '../../../../src/commands/util'; -import { SalesforceCoreSettings } from '../../../../src/settings/salesforceCoreSettings'; - -const env = createSandbox(); - -describe('Deploy/Retrieve Performance Beta Utils', () => { - const testComponents = [ - SourceComponent.createVirtualComponent( - { - name: 'foo', - type: registry.types.apexclass - }, - [] - ), - SourceComponent.createVirtualComponent( - { - name: 'bar', - type: registry.types.channellayout - }, - [] - ) - ]; - - describe('createComponentCount', () => { - it('should correctly generate rows for telemetry', () => { - const { name: apexClassName } = registry.types.apexclass; - const { name: channelLayoutName } = registry.types.channellayout; - const rows = createComponentCount(testComponents); - expect(rows).to.deep.equal([ - { type: apexClassName, quantity: 1 }, - { type: channelLayoutName, quantity: 1 } - ]); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/parameterGatherers.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/parameterGatherers.test.ts deleted file mode 100644 index 6c29637e5a..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/parameterGatherers.test.ts +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { - CancelResponse, - ContinueResponse, - ParametersGatherer -} from '@salesforce/salesforcedx-utils-vscode'; -import { - ComponentSet, - registry, - SourceComponent -} from '@salesforce/source-deploy-retrieve'; -import { expect } from 'chai'; -import * as path from 'path'; -import { join } from 'path'; -import * as sinon from 'sinon'; -import { window } from 'vscode'; -import * as vscode from 'vscode'; -import { - CommandletExecutor, - CompositeParametersGatherer, - DemoModePromptGatherer, - EmptyParametersGatherer, - FileSelection, - FileSelector, - SelectOutputDir, - SfCommandlet, - SimpleGatherer -} from '../../../../src/commands/util'; -import { - PromptConfirmGatherer, - SelectLwcComponentDir -} from '../../../../src/commands/util/parameterGatherers'; -import { nls } from '../../../../src/messages'; -import { SalesforcePackageDirectories } from '../../../../src/salesforceProject'; -import { workspaceUtils } from '../../../../src/util'; - -const SFDX_SIMPLE_NUM_OF_DIRS = 16; - -// tslint:disable:no-unused-expression -describe('Parameter Gatherers', () => { - describe('EmptyParametersGatherer', () => { - it('Should always return continue with empty object as data', async () => { - const gatherer = new EmptyParametersGatherer(); - const response = await gatherer.gather(); - expect(response.type).to.be.eql('CONTINUE'); - - const continueResponse = response as ContinueResponse<{}>; - expect(continueResponse.data).to.be.eql({}); - }); - }); - - describe('CompositeParametersGatherer', () => { - it('Should proceed to next gatherer if previous gatherer in composite gatherer is CONTINUE', async () => { - const compositeParameterGatherer = new CompositeParametersGatherer( - new (class implements ParametersGatherer<{}> { - public async gather(): Promise< - CancelResponse | ContinueResponse<{}> - > { - return { type: 'CONTINUE', data: {} }; - } - })(), - new (class implements ParametersGatherer<{}> { - public async gather(): Promise< - CancelResponse | ContinueResponse<{}> - > { - return { type: 'CONTINUE', data: {} }; - } - })() - ); - - const response = await compositeParameterGatherer.gather(); - expect(response.type).to.equal('CONTINUE'); - }); - - it('Should not proceed to next gatherer if previous gatherer in composite gatherer is CANCEL', async () => { - const compositeParameterGatherer = new CompositeParametersGatherer( - new (class implements ParametersGatherer<{}> { - public async gather(): Promise< - CancelResponse | ContinueResponse<{}> - > { - return { type: 'CANCEL' }; - } - })(), - new (class implements ParametersGatherer<{}> { - public async gather(): Promise< - CancelResponse | ContinueResponse<{}> - > { - throw new Error('This should not be called'); - } - })() - ); - - await compositeParameterGatherer.gather(); - }); - - it('Should call executor if composite gatherer is CONTINUE', async () => { - let executed = false; - const commandlet = new SfCommandlet( - new (class { - public check(): boolean { - return true; - } - })(), - new CompositeParametersGatherer( - new (class implements ParametersGatherer<{}> { - public async gather(): Promise< - CancelResponse | ContinueResponse<{}> - > { - return { type: 'CONTINUE', data: {} }; - } - })() - ), - new (class implements CommandletExecutor<{}> { - public execute(response: ContinueResponse<{}>): void { - executed = true; - } - })() - ); - - await commandlet.run(); - - expect(executed).to.be.true; - }); - - it('Should not call executor if composite gatherer is CANCEL', async () => { - const commandlet = new SfCommandlet( - new (class { - public check(): boolean { - return true; - } - })(), - new CompositeParametersGatherer( - new (class implements ParametersGatherer<{}> { - public async gather(): Promise< - CancelResponse | ContinueResponse<{}> - > { - return { type: 'CANCEL' }; - } - })() - ), - new (class implements CommandletExecutor<{}> { - public execute(response: ContinueResponse<{}>): void { - throw new Error('This should not be called'); - } - })() - ); - - await commandlet.run(); - }); - }); - - describe('FileSelectionGatherer', () => { - const displayMessage = 'My sample info'; - const errorMessage = 'You hit an error!'; - const gatherer = new FileSelector( - displayMessage, - errorMessage, - 'config/**/*-scratch-def.json' - ); - let showQuickPickStub: sinon.SinonStub; - let notificationStub: sinon.SinonStub; - let fileFinderStub: sinon.SinonStub; - - beforeEach(() => { - showQuickPickStub = sinon.stub(vscode.window, 'showQuickPick'); - notificationStub = sinon.stub(vscode.window, 'showErrorMessage'); - fileFinderStub = sinon.stub(vscode.workspace, 'findFiles'); - }); - - afterEach(() => { - showQuickPickStub.restore(); - notificationStub.restore(); - fileFinderStub.restore(); - }); - - it('Should return continue if file has been selected', async () => { - fileFinderStub.returns([ - vscode.Uri.file('/somepath/project-scratch-def.json') - ]); - showQuickPickStub.returns({ - label: 'project-scratch-def.json', - description: '/somepath/project-scratch-def.json' - }); - - const response = - (await gatherer.gather()) as ContinueResponse; - - expect(showQuickPickStub.callCount).to.equal(1); - expect(response.type).to.equal('CONTINUE'); - expect(response.data.file, 'project-scratch-def.json'); - }); - - it('Should return cancel if no file was selected', async () => { - fileFinderStub.returns([ - vscode.Uri.file('/somepath/project-scratch-def.json') - ]); - showQuickPickStub.returns(undefined); - - const response = await gatherer.gather(); - - expect(showQuickPickStub.callCount).to.equal(1); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should display error when no files are available for selection', async () => { - fileFinderStub.returns([]); - - const response = await gatherer.gather(); - - expect(response.type).to.equal('CANCEL'); - expect(notificationStub.calledOnce).to.be.true; - expect(notificationStub.getCall(0).args[0]).to.equal(errorMessage); - }); - }); - - // Due to the way the prompt is phrased - // CONTINUE means that we will execute the forceLogoutAll command - // CANCEL means that we will not execute the forceLogoutAll command - describe('DemoModePrompGatherer', () => { - let showInformationMessageStub: sinon.SinonStub; - - before(() => { - showInformationMessageStub = sinon.stub(window, 'showInformationMessage'); - }); - - after(() => { - showInformationMessageStub.restore(); - }); - - it('Should return CONTINUE if message is Cancel', async () => { - showInformationMessageStub.onFirstCall().returns('Cancel'); - const gatherer = new DemoModePromptGatherer(); - const result = await gatherer.gather(); - expect(result.type).to.equal('CONTINUE'); - expect((result as ContinueResponse<{}>).data).to.eql({}); - }); - - it('Should return CANCEL if message is Authorize Org', async () => { - showInformationMessageStub.onFirstCall().returns('Cancel'); - const gatherer = new DemoModePromptGatherer(); - const result = await gatherer.gather(); - expect(result.type).to.equal('CANCEL'); - }); - }); - - describe('SelectOutputDir', () => { - const packageDirs = ['force-app']; - - it('Should correctly build default menu options', async () => { - const selector = new SelectOutputDir('test'); - const options = selector.getDefaultOptions(['testapp', 'testapp2']); - - expect(options).to.eql([ - join('testapp', SelectOutputDir.defaultOutput, 'test'), - join('testapp2', SelectOutputDir.defaultOutput, 'test'), - SelectOutputDir.customDirOption - ]); - }); - - it('Should generate correct number of custom options for a workspace', async () => { - const selector = new SelectOutputDir('test'); - const options = selector.getCustomOptions( - packageDirs, - workspaceUtils.getRootWorkspacePath() - ); - expect(options.length).to.be.equal(SFDX_SIMPLE_NUM_OF_DIRS); - }); - - it('Should correctly append type folder to paths for type that requires specific parent folder', () => { - const selector = new SelectOutputDir('aura', true); - const options = selector.getCustomOptions( - packageDirs, - workspaceUtils.getRootWorkspacePath() - ); - - expect( - options.every(outputDir => { - // don't append the type name if the output dir already has that as its name - return outputDir.endsWith('aura') && !outputDir.endsWith('aura/aura'); - }) - ).to.be.true; - }); - - it('Should gather paths from correct sources and prompt custom dir if chosen', async () => { - const selector = new SelectOutputDir('test'); - const defaultOptions = selector.getDefaultOptions(packageDirs); - const customOptions = selector.getCustomOptions( - packageDirs, - workspaceUtils.getRootWorkspacePath() - ); - const getPackageDirPathsStub = sinon.stub( - SalesforcePackageDirectories, - 'getPackageDirectoryPaths' - ); - const showMenuStub = sinon.stub(selector, 'showMenu'); - const choice = customOptions[5]; - getPackageDirPathsStub.returns(packageDirs); - showMenuStub.onFirstCall().returns(SelectOutputDir.customDirOption); - showMenuStub.onSecondCall().returns(choice); - - const response = await selector.gather(); - - try { - expect(showMenuStub.getCall(0).calledWith(defaultOptions)).to.be.true; - expect(showMenuStub.getCall(1).calledWith(customOptions)).to.be.true; - expect(response).to.eql({ - type: 'CONTINUE', - data: { outputdir: choice } - }); - } finally { - getPackageDirPathsStub.restore(); - showMenuStub.restore(); - } - }); - }); - describe('SelectLwcComponentDir', async () => { - it('Should gather filepath and Lightning web component options', async () => { - const selector = new SelectLwcComponentDir(); - const packageDirs = ['force-app']; - const filePath = path.join('force-app', 'main', 'default', 'lwc', 'test'); - const component = SourceComponent.createVirtualComponent( - { - name: 'test', - type: registry.types.lightningcomponentbundle, - xml: path.join(filePath, 'test.js-meta.xml') - }, - [] - ); - const mockComponents = new ComponentSet([component]); - const getPackageDirPathsStub = sinon.stub( - SalesforcePackageDirectories, - 'getPackageDirectoryPaths' - ); - const getLwcsStub = sinon.stub(ComponentSet, 'fromSource'); - getLwcsStub - .withArgs( - path.join(workspaceUtils.getRootWorkspacePath(), packageDirs[0]) - ) - .returns(mockComponents); - const showMenuStub = sinon.stub(selector, 'showMenu'); - getPackageDirPathsStub.returns(packageDirs); - const dirChoice = packageDirs[0]; - const componentChoice = component.fullName; - showMenuStub.onFirstCall().returns(dirChoice); - showMenuStub.onSecondCall().returns(componentChoice); - - const response = await selector.gather(); - try { - expect(showMenuStub.getCall(0).calledWith(packageDirs)).to.be.true; - expect(response).to.eql({ - type: 'CONTINUE', - data: { outputdir: filePath, fileName: componentChoice } - }); - } finally { - getPackageDirPathsStub.restore(); - showMenuStub.restore(); - getLwcsStub.restore(); - } - }); - - it('Should gracefully cancel if LWC is not selected', async () => { - const selector = new SelectLwcComponentDir(); - const packageDirs = ['force-app']; - const filePath = path.join('force-app', 'main', 'default', 'lwc', 'test'); - const component = SourceComponent.createVirtualComponent( - { - name: 'test', - type: registry.types.lightningcomponentbundle, - xml: path.join(filePath, 'test.js-meta.xml') - }, - [] - ); - const mockComponents = new ComponentSet([component]); - const getPackageDirPathsStub = sinon.stub( - SalesforcePackageDirectories, - 'getPackageDirectoryPaths' - ); - const getLwcsStub = sinon.stub(ComponentSet, 'fromSource'); - getLwcsStub - .withArgs( - path.join(workspaceUtils.getRootWorkspacePath(), packageDirs[0]) - ) - .returns(mockComponents); - const showMenuStub = sinon.stub(selector, 'showMenu'); - getPackageDirPathsStub.returns(packageDirs); - const dirChoice = packageDirs[0]; - showMenuStub.onFirstCall().returns(dirChoice); - showMenuStub.onSecondCall().returns(''); - - const response = await selector.gather(); - try { - expect(response).to.eql({ - type: 'CANCEL' - }); - } finally { - getPackageDirPathsStub.restore(); - showMenuStub.restore(); - getLwcsStub.restore(); - } - }); - }); - - describe('SimpleGatherer', () => { - it('Should gather input that was given into a ContinueResponse', async () => { - const input = { a: 'a', b: true, c: 2 }; - const response = await new SimpleGatherer(input).gather(); - expect(response).to.eql({ - type: 'CONTINUE', - data: input - }); - }); - }); - - describe('PromptConfirmGatherer', () => { - it('Should return CONTINUE if confirmation to proceed is positive', async () => { - const promptConfirm = new PromptConfirmGatherer('question'); - const showMenuStub = sinon.stub(promptConfirm, 'showMenu'); - const choice = nls.localize('parameter_gatherer_prompt_confirm_option'); - showMenuStub.onFirstCall().returns(choice); - const response = await promptConfirm.gather(); - expect(response).to.eql({ - type: 'CONTINUE', - data: { - choice - } - }); - }); - - it('Should return CANCEL if confirmation to proceed is negative', async () => { - const promptConfirm = new PromptConfirmGatherer('question'); - const showMenuStub = sinon.stub(promptConfirm, 'showMenu'); - const choice = nls.localize('parameter_gatherer_prompt_cancel_option'); - showMenuStub.onFirstCall().returns(choice); - const response = await promptConfirm.gather(); - expect(response).to.eql({ - type: 'CANCEL' - }); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/postconditionCheckers.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/postconditionCheckers.test.ts deleted file mode 100644 index b762327680..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/postconditionCheckers.test.ts +++ /dev/null @@ -1,642 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { - CancelResponse, - ContinueResponse, - LocalComponent, - PostconditionChecker -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import { join } from 'path'; -import { createSandbox, SinonSandbox, SinonStub } from 'sinon'; -import { channelService } from '../../../../src/channels'; -import { - CommandletExecutor, - ConflictDetectionMessages, - EmptyPostChecker, - OverwriteComponentPrompt, - PathStrategyFactory, - SfCommandlet -} from '../../../../src/commands/util'; -import { CompositePostconditionChecker } from '../../../../src/commands/util/compositePostconditionChecker'; -import { TimestampConflictChecker } from '../../../../src/commands/util/timestampConflictChecker'; -import { conflictView, DirectoryDiffResults } from '../../../../src/conflict'; -import { TimestampFileProperties } from '../../../../src/conflict/directoryDiffer'; -import { WorkspaceContext } from '../../../../src/context'; -import * as workspaceUtil from '../../../../src/context/workspaceOrgType'; -import { nls } from '../../../../src/messages'; -import { notificationService } from '../../../../src/notifications'; -import { salesforceCoreSettings } from '../../../../src/settings'; -import { MetadataDictionary, workspaceUtils } from '../../../../src/util'; -import { OrgType } from './../../../../src/context/workspaceOrgType'; - -describe('Postcondition Checkers', () => { - let env: SinonSandbox; - describe('EmptyPostconditionChecker', () => { - it('Should return CancelResponse if input passed in is CancelResponse', async () => { - const postChecker = new EmptyPostChecker(); - const response = await postChecker.check({ type: 'CANCEL' }); - expect(response.type).to.equal('CANCEL'); - }); - it('Should return ContinueResponse unchanged if input passed in is ContinueResponse', async () => { - const postChecker = new EmptyPostChecker(); - const input: ContinueResponse = { - type: 'CONTINUE', - data: 'test' - }; - const response = await postChecker.check(input); - expect(response.type).to.equal('CONTINUE'); - if (response.type === 'CONTINUE') { - expect(response.data).to.equal('test'); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - }); - - describe('CompositePostconditionChecker', () => { - it('Should return CancelResponse if input passed in is CancelResponse', async () => { - const postChecker = new CompositePostconditionChecker( - new (class implements PostconditionChecker<{}> { - public async check(): Promise> { - throw new Error('This should not be called'); - } - })() - ); - const response = await postChecker.check({ type: 'CANCEL' }); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should proceed to next checker if previous checker in composite checker is ContinueResponse', async () => { - const compositePostconditionChecker = new CompositePostconditionChecker( - new (class implements PostconditionChecker { - public async check(): Promise< - CancelResponse | ContinueResponse - > { - return { type: 'CONTINUE', data: 'package.xml' }; - } - })(), - new (class implements PostconditionChecker { - public async check(): Promise< - CancelResponse | ContinueResponse - > { - return { type: 'CONTINUE', data: 'package.xml' }; - } - })() - ); - - const response = await compositePostconditionChecker.check({ - type: 'CONTINUE', - data: 'package.xml' - }); - expect(response.type).to.equal('CONTINUE'); - }); - - it('Should not proceed to next checker if previous checker in composite checker is CancelResponse', async () => { - const compositePostconditionChecker = new CompositePostconditionChecker( - new (class implements PostconditionChecker { - public async check(): Promise< - CancelResponse | ContinueResponse - > { - return { type: 'CANCEL' }; - } - })(), - new (class implements PostconditionChecker { - public async check(): Promise< - CancelResponse | ContinueResponse - > { - throw new Error('This should not be called'); - } - })() - ); - - await compositePostconditionChecker.check({ - type: 'CONTINUE', - data: 'package.xml' - }); - }); - - // tslint:disable:no-unused-expression - it('Should call executor if composite checker is ContinueResponse', async () => { - let executed = false; - const commandlet = new SfCommandlet( - new (class { - public check(): boolean { - return true; - } - })(), - new (class { - public async gather(): Promise< - CancelResponse | ContinueResponse - > { - return { type: 'CONTINUE', data: 'package.xml' }; - } - })(), - new (class implements CommandletExecutor { - public execute(response: ContinueResponse): void { - executed = true; - } - })(), - new CompositePostconditionChecker( - new (class implements PostconditionChecker { - public async check(): Promise< - CancelResponse | ContinueResponse - > { - return { type: 'CONTINUE', data: 'package.xml' }; - } - })() - ) - ); - - await commandlet.run(); - - expect(executed).to.be.true; - }); - - it('Should not call executor if composite checker is CancelResponse', async () => { - const commandlet = new SfCommandlet( - new (class { - public check(): boolean { - return true; - } - })(), - new (class { - public async gather(): Promise< - CancelResponse | ContinueResponse<{}> - > { - return { type: 'CONTINUE', data: 'package.xml' }; - } - })(), - new (class implements CommandletExecutor<{}> { - public execute(response: ContinueResponse<{}>): void { - throw new Error('This should not be called'); - } - })(), - new CompositePostconditionChecker<{}>( - new (class implements PostconditionChecker<{}> { - public async check(): Promise< - CancelResponse | ContinueResponse<{}> - > { - return { type: 'CANCEL' }; - } - })() - ) - ); - - await commandlet.run(); - }); - }); - - describe('OverwriteComponentPrompt', () => { - let existsStub: SinonStub; - let modalStub: SinonStub; - let promptStub: SinonStub; - const checker = new OverwriteComponentPrompt(); - - beforeEach(() => { - env = createSandbox(); - existsStub = env.stub(fs, 'existsSync'); - modalStub = env.stub(notificationService, 'showWarningModal'); - }); - - afterEach(() => env.restore()); - - describe('Check Components Exist', () => { - beforeEach(() => { - promptStub = env.stub(checker, 'promptOverwrite'); - }); - - it('Should not prompt overwrite if components do not exist', async () => { - existsStub.returns(true); - const data = generateComponents(2); - pathExists(false, data[0], '.t-meta.xml'); - pathExists(false, data[1], '.t-meta.xml'); - - await checker.check({ type: 'CONTINUE', data }); - - expect(promptStub.notCalled).to.equal(true); - }); - - it('Should prompt overwrite for components that exist', async () => { - existsStub.returns(false); - const data = generateComponents(2); - pathExists(true, data[0], '.t-meta.xml'); - - await checker.check({ type: 'CONTINUE', data }); - - expect(promptStub.firstCall.args[0]).to.eql([data[0]]); - }); - - it('Should prompt overwrite for EPT components that exist', async () => { - existsStub.returns(false); - const data = { - fileName: 'Test1', - outputdir: 'package/tests', - type: 'ExperiencePropertyTypeBundle', - suffix: 'json' - }; - pathExists(true, data, '/schema.json'); - - await checker.check({ type: 'CONTINUE', data }); - - expect(promptStub.firstCall.args[0]).to.eql([data]); - }); - - it('Should prompt overwrite for EPT components that does not exist', async () => { - existsStub.returns(false); - const data = { - fileName: 'Test1', - outputdir: 'package/tests', - type: 'ExperiencePropertyTypeBundle', - suffix: 'json' - }; - - await checker.check({ type: 'CONTINUE', data }); - - expect(promptStub.firstCall).to.null; - }); - - it('Should determine a component exists if at least one of its file extensions do', async () => { - const dictionaryStub = env.stub(MetadataDictionary, 'getInfo'); - dictionaryStub.returns({ - pathStrategy: PathStrategyFactory.createDefaultStrategy(), - extensions: ['.a', '.b', '.c'] - }); - existsStub.returns(false); - const data = generateComponents(1); - pathExists(true, data[0], '.c'); - - await checker.check({ type: 'CONTINUE', data }); - - expect(existsStub.firstCall.returnValue).to.equal(false); - expect(existsStub.secondCall.returnValue).to.equal(false); - expect(promptStub.firstCall.args[0]).to.eql([data[0]]); - }); - }); - - describe('Overwrite Dialog Message', () => { - it('Should show every action when there are multiple components to overwrite', async () => { - await checker.promptOverwrite(generateComponents(2)); - - expect(modalStub.firstCall.args.slice(1)).to.eql([ - nls.localize('warning_prompt_overwrite'), - nls.localize('warning_prompt_skip'), - nls.localize('warning_prompt_overwrite_all') + ' (2)', - nls.localize('warning_prompt_skip_all') + ' (2)' - ]); - }); - - it('Should only show overwrite and cancel for one component', async () => { - await doPrompt(generateComponents(1), [undefined]); - - expect(modalStub.firstCall.args.slice(1)).to.eql([ - nls.localize('warning_prompt_overwrite') - ]); - }); - - it('Should show correct message for one component', async () => { - const components = generateComponents(1); - - await doPrompt(components, [undefined]); - - expect(modalStub.firstCall.args[0]).to.equal( - nls.localize( - 'warning_prompt_overwrite_message', - components[0].type, - components[0].fileName, - '', - '' - ) - ); - }); - - it('Should show correct message for 1 < components <= 10 ', async () => { - const components = generateComponents(2); - const expectedBody = `${components[1].type}:${components[1].fileName}\n`; - - await doPrompt(components, [undefined]); - - expect(modalStub.firstCall.args[0]).to.equal( - nls.localize( - 'warning_prompt_overwrite_message', - components[0].type, - components[0].fileName, - nls.localize('warning_prompt_other_existing', 1), - expectedBody - ) - ); - }); - - it('Should show correct message for components > 10', async () => { - const components = generateComponents(12); - let expectedBody = ''; - for (const component of components.slice(1, 11)) { - expectedBody += `${component.type}:${component.fileName}\n`; - } - expectedBody += `${nls.localize('warning_prompt_other_not_shown', 1)}`; - - await doPrompt(components, [undefined]); - - expect(modalStub.firstCall.args[0]).to.equal( - nls.localize( - 'warning_prompt_overwrite_message', - components[0].type, - components[0].fileName, - nls.localize('warning_prompt_other_existing', 11), - expectedBody - ) - ); - }); - }); - - describe('Overwrite Dialog Actions', () => { - it('Should skip all', async () => { - const components = generateComponents(2); - const actions = [`${nls.localize('warning_prompt_skip_all')} (2)`]; - - const response = await doPrompt(components, actions); - - expect(response.type).to.equal('CANCEL'); - }); - - it('Should overwrite all', async () => { - const components = generateComponents(2); - const actions = [`${nls.localize('warning_prompt_overwrite_all')} (2)`]; - - const response = (await doPrompt( - components, - actions - )) as ContinueResponse; - - expect(response.data).to.eql(components); - }); - - it('Should skip one and overwrite remaining', async () => { - const components = generateComponents(3); - const actions = [ - nls.localize('warning_prompt_skip'), - nls.localize('warning_prompt_overwrite_all') + ' (2)' - ]; - - const response = (await doPrompt( - components, - actions - )) as ContinueResponse; - - expect(response.data).to.eql(components.slice(1)); - }); - - it('Should overwrite one and skip remaining', async () => { - const components = generateComponents(3); - const actions = [ - nls.localize('warning_prompt_overwrite'), - nls.localize('warning_prompt_skip_all') + ' (2)' - ]; - - const response = (await doPrompt( - components, - actions - )) as ContinueResponse; - - expect(response.data).to.eql(components.slice(0, 1)); - }); - - it('Should cancel', async () => { - const components = generateComponents(3); - const actions = [undefined]; - - const response = await doPrompt(components, actions); - - expect(response.type).to.equal('CANCEL'); - }); - }); - - async function doPrompt(components: LocalComponent[], actions: any[]) { - components.forEach((component, index) => { - pathExists(true, component, '.t-meta.xml'); - if (index < actions.length) { - modalStub.onCall(index).returns(actions[index]); - } - }); - - return await checker.check({ - type: 'CONTINUE', - data: components - }); - } - - function generateComponents(count: number) { - const data = []; - for (let i = 1; i <= count; i++) { - data.push({ - fileName: `Test${i}`, - outputdir: 'package/tests', - type: 'TestType', - suffix: 't' - }); - } - return data; - } - - function pathExists( - value: boolean, - forComponent: LocalComponent, - withExtension: string - ) { - const path = join( - workspaceUtils.getRootWorkspacePath(), - `package/tests/${forComponent.fileName}${withExtension}` - ); - existsStub.withArgs(path).returns(value); - } - }); - - describe('TimestampConflictChecker', () => { - const mockWorkspaceContext = { getConnection: () => {} } as any; - let modalStub: SinonStub; - let settingsStub: SinonStub; - let conflictViewStub: SinonStub; - let appendLineStub: SinonStub; - let channelOutput: string[] = []; - - beforeEach(() => { - env = createSandbox(); - channelOutput = []; - modalStub = env.stub(notificationService, 'showWarningModal'); - settingsStub = env.stub( - salesforceCoreSettings, - 'getConflictDetectionEnabled' - ); - conflictViewStub = env.stub(conflictView, 'visualizeDifferences'); - appendLineStub = env.stub(channelService, 'appendLine'); - env.stub(WorkspaceContext, 'getInstance').returns(mockWorkspaceContext); - env - .stub(workspaceUtil, 'getWorkspaceOrgType') - .returns(OrgType.NonSourceTracked); - appendLineStub.callsFake(line => channelOutput.push(line)); - }); - - afterEach(() => env.restore()); - - const emptyMessages: ConflictDetectionMessages = { - warningMessageKey: '', - commandHint: i => i as string - }; - - const retrieveMessages: ConflictDetectionMessages = { - warningMessageKey: 'conflict_detect_conflicts_during_retrieve', - commandHint: i => i as string - }; - - const validInput: ContinueResponse = { - type: 'CONTINUE', - data: 'package.xml' - }; - - it('Should return CancelResponse if input passed in is CancelResponse', async () => { - const postChecker = new TimestampConflictChecker(false, emptyMessages); - const response = await postChecker.check({ type: 'CANCEL' }); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return ContinueResponse unchanged if input is ContinueResponse and conflict detection is disabled', async () => { - const postChecker = new TimestampConflictChecker(false, emptyMessages); - - settingsStub.returns(false); - const response = await postChecker.check(validInput); - - expect(response.type).to.equal('CONTINUE'); - if (response.type === 'CONTINUE') { - expect(response.data).to.equal('package.xml'); - } else { - expect.fail('Response should be of type ContinueResponse'); - } - }); - - it('Should return CancelResponse when a username is not defined.', async () => { - const postChecker = new TimestampConflictChecker(false, emptyMessages); - settingsStub.returns(true); - - const response = await postChecker.check(validInput); - expect(response.type).to.equal('CANCEL'); - }); - - it('Should return ContinueResponse when no conflicts are detected', async () => { - const postChecker = new TimestampConflictChecker(false, emptyMessages); - const response = await postChecker.handleConflicts( - 'manifest.xml', - 'admin@example.com', - { - different: new Set() - } as DirectoryDiffResults - ); - - expect(response.type).to.equal('CONTINUE'); - expect((response as ContinueResponse).data).to.equal( - 'manifest.xml' - ); - expect(appendLineStub.notCalled).to.equal(true); - }); - - it('Should post a warning and return CancelResponse when conflicts are detected and cancelled', async () => { - const postChecker = new TimestampConflictChecker(false, retrieveMessages); - const results = { - different: new Set([ - { - localRelPath: - 'main/default/objects/Property__c/fields/Broker__c.field-meta.xml', - remoteRelPath: - 'main/default/objects/Property__c/fields/Broker__c.field-meta.xml' - }, - { - localRelPath: - 'main/default/aura/auraPropertySummary/auraPropertySummaryController.js', - remoteRelPath: - 'main/default/objects/Property__c/fields/Broker__c.field-meta.xml' - } - ]), - scannedLocal: 4, - scannedRemote: 6 - } as DirectoryDiffResults; - modalStub.returns('Cancel'); - - const response = await postChecker.handleConflicts( - 'package.xml', - 'admin@example.com', - results - ); - expect(response.type).to.equal('CANCEL'); - - expect(modalStub.firstCall.args.slice(1)).to.eql([ - nls.localize('conflict_detect_show_conflicts'), - nls.localize('conflict_detect_override') - ]); - - expect(channelOutput).to.include.members([ - nls.localize('conflict_detect_conflict_header_timestamp', 2), - 'Broker__c.field-meta.xml', - 'auraPropertySummaryController.js', - nls.localize('conflict_detect_command_hint', 'package.xml') - ]); - - expect(conflictViewStub.calledOnce).to.equal(true); - }); - - it('Should post a warning and return ContinueResponse when conflicts are detected and overwritten', async () => { - const postChecker = new TimestampConflictChecker(false, retrieveMessages); - const results = { - different: new Set([ - { - localRelPath: 'MyClass.cls', - remoteRelPath: 'MyClass.cls' - } - ]) - } as DirectoryDiffResults; - modalStub.returns(nls.localize('conflict_detect_override')); - - const response = await postChecker.handleConflicts( - 'manifest.xml', - 'admin@example.com', - results - ); - expect(response.type).to.equal('CONTINUE'); - - expect(modalStub.firstCall.args.slice(1)).to.eql([ - nls.localize('conflict_detect_show_conflicts'), - nls.localize('conflict_detect_override') - ]); - }); - - it('Should post a warning and return CancelResponse when conflicts are detected and conflicts are shown', async () => { - const postChecker = new TimestampConflictChecker(false, retrieveMessages); - const results = { - different: new Set([ - { - localRelPath: 'MyClass.cls', - remoteRelPath: 'MyClass.cls' - } - ]) - } as DirectoryDiffResults; - modalStub.returns(nls.localize('conflict_detect_show_conflicts')); - - const response = await postChecker.handleConflicts( - 'manifest.xml', - 'admin@example.com', - results - ); - expect(response.type).to.equal('CANCEL'); - - expect(modalStub.firstCall.args.slice(1)).to.eql([ - nls.localize('conflict_detect_show_conflicts'), - nls.localize('conflict_detect_override') - ]); - - expect(conflictViewStub.calledOnce).to.equal(true); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/preconditionCheckers.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/preconditionCheckers.test.ts deleted file mode 100644 index 111924e2cf..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/preconditionCheckers.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { PreconditionChecker } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { CompositePreconditionChecker } from '../../../../src/commands/util'; - -describe('Precondition Checkers', () => { - describe('CompositePreconditionChecker', () => { - it('Should return false if one precondition checker is false', async () => { - const compositePreconditionsChecker = new CompositePreconditionChecker( - new (class implements PreconditionChecker { - public async check(): Promise { - return Promise.resolve(false); - } - })(), - new (class implements PreconditionChecker { - public async check(): Promise { - return Promise.resolve(true); - } - })() - ); - const response = await compositePreconditionsChecker.check(); - expect(response).to.be.eql(false); - }); - - it('Should return true if all precondition checkers are true', async () => { - const compositePreconditionsChecker = new CompositePreconditionChecker( - new (class implements PreconditionChecker { - public async check(): Promise { - return Promise.resolve(true); - } - })(), - new (class implements PreconditionChecker { - public async check(): Promise { - return Promise.resolve(true); - } - })() - ); - const response = await compositePreconditionsChecker.check(); - expect(response).to.be.eql(true); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sfCommandlet.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sfCommandlet.test.ts deleted file mode 100644 index 4c0caecab6..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sfCommandlet.test.ts +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { - CancelResponse, - ContinueResponse, - ParametersGatherer -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { createSandbox, SinonSandbox } from 'sinon'; -import { channelService } from '../../../../src/channels'; -import { - CommandletExecutor, - SfCommandlet -} from '../../../../src/commands/util'; -import { salesforceCoreSettings } from '../../../../src/settings'; - -describe('SfCommandlet', () => { - let sandbox: SinonSandbox; - beforeEach(() => { - sandbox = createSandbox(); - }); - afterEach(() => { - sandbox.restore(); - }); - it('Should not proceed if checker fails', async () => { - const commandlet = new SfCommandlet( - new (class { - public check(): boolean { - return false; - } - })(), - new (class implements ParametersGatherer<{}> { - public async gather(): Promise> { - throw new Error('This should not be called'); - } - })(), - new (class implements CommandletExecutor<{}> { - public execute(response: ContinueResponse<{}>): void { - throw new Error('This should not be called'); - } - })() - ); - - await commandlet.run(); - }); - - it('Should not call executor if gatherer is CANCEL', async () => { - const commandlet = new SfCommandlet( - new (class { - public check(): boolean { - return true; - } - })(), - new (class implements ParametersGatherer<{}> { - public async gather(): Promise> { - return { type: 'CANCEL' }; - } - })(), - new (class implements CommandletExecutor<{}> { - public execute(response: ContinueResponse<{}>): void { - throw new Error('This should not be called'); - } - })() - ); - - await commandlet.run(); - }); - - it('Should call executor if gatherer is CONTINUE', async () => { - let executed = false; - const commandlet = new SfCommandlet( - new (class { - public check(): boolean { - return true; - } - })(), - new (class implements ParametersGatherer<{}> { - public async gather(): Promise> { - return { type: 'CONTINUE', data: {} }; - } - })(), - new (class implements CommandletExecutor<{}> { - public execute(response: ContinueResponse<{}>): void { - executed = true; - } - })() - ); - - await commandlet.run(); - - // tslint:disable-next-line:no-unused-expression - expect(executed).to.be.true; - }); - - it('Should clear channel if user preference is set to true', async () => { - sandbox - .stub(salesforceCoreSettings, 'getEnableClearOutputBeforeEachCommand') - .returns(false); - const clearStub = sandbox.stub(channelService, 'clear'); - const commandlet = new SfCommandlet( - new (class { - public check(): boolean { - return true; - } - })(), - new (class implements ParametersGatherer<{}> { - public async gather(): Promise> { - return { type: 'CONTINUE', data: {} }; - } - })(), - new (class implements CommandletExecutor<{}> { - public execute(response: ContinueResponse<{}>): void {} - })() - ); - await commandlet.run(); - // tslint:disable-next-line:no-unused-expression - expect(clearStub.called).to.be.false; - }); - - it('Should not clear channel if user preference is set to false', async () => { - sandbox - .stub(salesforceCoreSettings, 'getEnableClearOutputBeforeEachCommand') - .returns(false); - const clearStub = sandbox.stub(channelService, 'clear'); - const commandlet = new SfCommandlet( - new (class { - public check(): boolean { - return true; - } - })(), - new (class implements ParametersGatherer<{}> { - public async gather(): Promise> { - return { type: 'CONTINUE', data: {} }; - } - })(), - new (class implements CommandletExecutor<{}> { - public execute(response: ContinueResponse<{}>): void {} - })() - ); - await commandlet.run(); - // tslint:disable-next-line:no-unused-expression - expect(clearStub.called).to.be.false; - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sourcePathStrategies.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sourcePathStrategies.test.ts deleted file mode 100644 index 6bd7761fe6..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sourcePathStrategies.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { join } from 'path'; -import { PathStrategyFactory } from '../../../../src/commands/util'; - -describe('Source Path Strategies', () => { - describe('DefaultPathStrategy', () => { - it('Should build a default path', () => { - const strategy = PathStrategyFactory.createDefaultStrategy(); - const path = strategy.getPathToSource('/folder', 'cmp', '.a'); - expect(path).to.equal(join('/folder', 'cmp.a')); - }); - }); - - describe('BundlePathStrategy', () => { - it('Should build a bundle path', () => { - const strategy = PathStrategyFactory.createBundleStrategy(); - const path = strategy.getPathToSource('/folder', 'cmp', '.a'); - expect(path).to.equal(join('/folder', 'cmp', 'cmp.a')); - }); - }); - - describe('WaveTemplateBundlePathStrategy', () => { - it('Should build a wave template bundle path', () => { - const strategy = PathStrategyFactory.createWaveTemplateBundleStrategy(); - const path = strategy.getPathToSource('/folder', 'name', '.a'); - expect(path).to.equal(join('/folder', 'name', 'template-info.a')); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sourceResultOutput.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sourceResultOutput.test.ts deleted file mode 100644 index a39d3e50d6..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/util/sourceResultOutput.test.ts +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -// import { Table } from '@salesforce/salesforcedx-utils-vscode'; -// import { -// ComponentStatus, -// registryData, -// SourceComponent, -// SourceDeployResult, -// SourceRetrieveResult, -// ToolingDeployStatus -// } from '@salesforce/source-deploy-retrieve'; -// import { expect } from 'chai'; -// import * as path from 'path'; -// import { -// createDeployOutput, -// createRetrieveOutput -// } from '../../../../src/commands/util'; -// import { nls } from '../../../../src/messages'; - -// describe('Source Deploy/Retrieve Output Utils', () => { -// const root = path.join(path.sep, 'path', 'to', 'project'); -// const packageDirs = ['force-app', path.join('test', 'force-app2')]; -// const apexClassPathOne = path.join(packageDirs[0], 'classes', 'test.cls'); -// const apexClassXmlPathOne = `${apexClassPathOne}-meta.xml`; -// const apexClassPathTwo = path.join(packageDirs[1], 'classes', 'testTwo.cls'); -// const apexClassXmlPathTwo = `${apexClassPathTwo}-meta.xml`; -// const lwcJsPath = path.join(packageDirs[0], 'lwc', 'test', 'test.js'); -// const lwcXmlPath = `${lwcJsPath}-meta.xml`; -// const apexComponentOne = SourceComponent.createVirtualComponent( -// { -// name: 'test', -// type: registryData.types.apexclass, -// xml: path.join(root, apexClassXmlPathOne), -// content: path.join(root, apexClassPathOne) -// }, -// [ -// { -// dirPath: path.join(root, packageDirs[0], 'classes'), -// children: ['test.cls', 'test.cls-meta.xml'] -// } -// ] -// ); -// const apexComponentTwo = SourceComponent.createVirtualComponent( -// { -// name: 'test', -// type: registryData.types.apexclass, -// xml: path.join(root, apexClassXmlPathTwo), -// content: path.join(root, apexClassPathTwo) -// }, -// [ -// { -// dirPath: path.join(root, packageDirs[1], 'classes'), -// children: ['testTwo.cls', 'testTwo.cls-meta.xml'] -// } -// ] -// ); -// const lwcComponent = SourceComponent.createVirtualComponent( -// { -// name: 'test', -// type: registryData.types.lightningcomponentbundle, -// xml: path.join(root, lwcXmlPath), -// content: path.join(root, packageDirs[0], 'lwc', 'test') -// }, -// [ -// { -// dirPath: path.join(root, packageDirs[0], 'lwc'), -// children: ['test'] -// }, -// { -// dirPath: path.join(root, packageDirs[0], 'lwc', 'test'), -// children: ['test.js', 'test.js-meta.xml'] -// } -// ] -// ); - -// describe('createDeployOutput', () => { -// const deploySuccessColumns = [ -// { key: 'state', label: nls.localize('table_header_state') }, -// { key: 'fullName', label: nls.localize('table_header_full_name') }, -// { key: 'type', label: nls.localize('table_header_type') }, -// { -// key: 'filePath', -// label: nls.localize('table_header_project_path') -// } -// ]; -// const deployFailureColumns = [ -// { -// key: 'filePath', -// label: nls.localize('table_header_project_path') -// }, -// { key: 'error', label: nls.localize('table_header_errors') } -// ]; -// it('should create a table with successful results', async () => { -// const { fullName, type } = apexComponentOne; -// const result: SourceDeployResult = { -// success: true, -// id: '', -// status: ToolingDeployStatus.Completed, -// components: [ -// { -// component: apexComponentOne, -// status: ComponentStatus.Changed, -// diagnostics: [] -// } -// ] -// }; -// const expectedOutput = new Table().createTable( -// [ -// { -// state: 'Changed', -// fullName, -// type: type.name, -// filePath: apexClassPathOne -// }, -// { -// state: 'Changed', -// fullName, -// type: type.name, -// filePath: apexClassXmlPathOne -// } -// ], -// deploySuccessColumns, -// nls.localize(`table_title_deployed_source`) -// ); -// expect(createDeployOutput(result, packageDirs)).to.equal(expectedOutput); -// }); - -// it('should create a table with successful results for multiple components', async () => { -// const result: SourceDeployResult = { -// success: true, -// id: '', -// status: ToolingDeployStatus.Completed, -// components: [ -// { -// component: apexComponentOne, -// status: ComponentStatus.Changed, -// diagnostics: [] -// }, -// { -// component: apexComponentTwo, -// status: ComponentStatus.Changed, -// diagnostics: [] -// } -// ] -// }; -// const expectedOutput = new Table().createTable( -// [ -// { -// state: 'Changed', -// fullName: apexComponentOne.fullName, -// type: apexComponentOne.type.name, -// filePath: apexClassPathOne -// }, -// { -// state: 'Changed', -// fullName: apexComponentOne.fullName, -// type: apexComponentOne.type.name, -// filePath: apexClassXmlPathOne -// }, -// { -// state: 'Changed', -// fullName: apexComponentTwo.fullName, -// type: apexComponentTwo.type.name, -// filePath: apexClassPathTwo -// }, -// { -// state: 'Changed', -// fullName: apexComponentTwo.fullName, -// type: apexComponentTwo.type.name, -// filePath: apexClassXmlPathTwo -// } -// ], -// deploySuccessColumns, -// nls.localize(`table_title_deployed_source`) -// ); -// expect(createDeployOutput(result, packageDirs)).to.equal(expectedOutput); -// }); - -// it('should create a table with successful results for a bundle type component', async () => { -// const { fullName, type } = lwcComponent; -// const result: SourceDeployResult = { -// success: true, -// id: '', -// status: DeployStatus.Succeeded, -// components: [ -// { -// component: lwcComponent, -// status: ComponentStatus.Created, -// diagnostics: [] -// } -// ] -// }; -// const expectedOutput = new Table().createTable( -// [ -// { -// state: 'Created', -// fullName, -// type: type.name, -// filePath: lwcJsPath -// }, -// { -// state: 'Created', -// fullName, -// type: type.name, -// filePath: lwcXmlPath -// } -// ], -// deploySuccessColumns, -// nls.localize(`table_title_deployed_source`) -// ); -// expect(createDeployOutput(result, packageDirs)).to.equal(expectedOutput); -// }); - -// it('should create a table with failed results', async () => { -// const result: SourceDeployResult = { -// success: false, -// id: '', -// status: DeployStatus.Failed, -// components: [ -// { -// component: apexComponentOne, -// status: ComponentStatus.Failed, -// diagnostics: [ -// { -// lineNumber: 4, -// columnNumber: 5, -// filePath: apexClassPathOne, -// message: "Missing ';' at '}'", -// type: 'Error' -// }, -// { -// lineNumber: 7, -// columnNumber: 9, -// filePath: apexClassPathOne, -// message: "Extra ':' at '}'", -// type: 'Error' -// } -// ] -// } -// ] -// }; -// const expectedOutput = new Table().createTable( -// [ -// { -// filePath: apexClassPathOne, -// error: "Missing ';' at '}' (4:5)" -// }, -// { -// filePath: apexClassPathOne, -// error: "Extra ':' at '}' (7:9)" -// } -// ], -// deployFailureColumns, -// nls.localize(`table_title_deploy_errors`) -// ); -// expect(createDeployOutput(result, packageDirs)).to.equal(expectedOutput); -// }); - -// it('should create a table with failures that do not have line and column info', async () => { -// const result: SourceDeployResult = { -// id: '', -// success: false, -// status: ToolingDeployStatus.Error, -// components: [ -// { -// component: apexComponentOne, -// status: ComponentStatus.Failed, -// diagnostics: [ -// { -// type: 'Error', -// filePath: apexClassPathOne, -// message: 'Unexpected error happened during deploy' -// } -// ] -// } -// ] -// }; -// const expectedOutput = new Table().createTable( -// [ -// { -// filePath: apexClassPathOne, -// error: 'Unexpected error happened during deploy' -// } -// ], -// deployFailureColumns, -// nls.localize(`table_title_deploy_errors`) -// ); -// expect(createDeployOutput(result, packageDirs)).to.equal(expectedOutput); -// }); - -// it('should create a table with queued results', async () => { -// const result: SourceDeployResult = { -// id: '', -// status: ToolingDeployStatus.Queued, -// components: [], -// success: false -// }; -// expect(createDeployOutput(result, packageDirs)).to.equal( -// nls.localize('beta_tapi_queue_status') -// ); -// }); -// }); - -// describe('createRetrieveOutput', () => { -// const retrieveSuccessColumns = [ -// { key: 'fullName', label: nls.localize('table_header_full_name') }, -// { key: 'type', label: nls.localize('table_header_type') }, -// { -// key: 'filePath', -// label: nls.localize('table_header_project_path') -// } -// ]; -// const retrieveFailureColumns = [ -// { key: 'fullName', label: nls.localize('table_header_full_name') }, -// { key: 'type', label: nls.localize('table_header_error_type') }, -// { key: 'message', label: nls.localize('table_header_message') } -// ]; - -// it('Should handle a retrieve result with successes and no failures', () => { -// const { fullName, type } = apexComponentOne; -// const result: SourceRetrieveResult = { -// status: RetrieveStatus.Succeeded, -// success: true, -// successes: [{ component: apexComponentOne }], -// failures: [] -// }; -// const expectedOutput = new Table().createTable( -// [ -// { -// fullName, -// type: type.name, -// filePath: apexClassPathOne -// }, -// { -// fullName, -// type: type.name, -// filePath: apexClassXmlPathOne -// } -// ], -// retrieveSuccessColumns, -// nls.localize('lib_retrieve_result_title') -// ); -// expect(createRetrieveOutput(result, packageDirs)).to.equal( -// expectedOutput -// ); -// }); - -// it('Should handle a retrieve result with failures and no successes', () => { -// const result: SourceRetrieveResult = { -// status: RetrieveStatus.Failed, -// success: false, -// successes: [], -// failures: [ -// { -// component: apexComponentOne, -// message: 'Missing metadata' -// } -// ] -// }; -// const expectedOutput = new Table().createTable( -// [ -// { -// fullName: apexComponentOne.fullName, -// type: 'Error', -// message: 'Missing metadata' -// } -// ], -// retrieveFailureColumns, -// nls.localize('lib_retrieve_message_title') -// ); -// expect(createRetrieveOutput(result, packageDirs)).to.equal( -// expectedOutput -// ); -// }); - -// it('Should handle a SourceRetrieveResult with successes and failures', () => { -// const result: SourceRetrieveResult = { -// status: RetrieveStatus.PartialSuccess, -// success: true, -// successes: [{ component: apexComponentOne }], -// failures: [{ component: apexComponentTwo, message: 'Missing metadata' }] -// }; -// const expectedSuccessOutput = new Table().createTable( -// [ -// { -// fullName: apexComponentOne.fullName, -// type: apexComponentOne.type.name, -// filePath: apexClassPathOne -// }, -// { -// fullName: apexComponentOne.fullName, -// type: apexComponentOne.type.name, -// filePath: apexClassXmlPathOne -// } -// ], -// retrieveSuccessColumns, -// nls.localize('lib_retrieve_result_title') -// ); -// const expectedFailureOutput = new Table().createTable( -// [ -// { -// fullName: apexComponentTwo.fullName, -// type: 'Error', -// message: 'Missing metadata' -// } -// ], -// retrieveFailureColumns, -// nls.localize('lib_retrieve_message_title') -// ); -// const combinedTableOutput = `${expectedSuccessOutput}\n${expectedFailureOutput}`; -// expect(createRetrieveOutput(result, packageDirs)).to.equal( -// combinedTableOutput -// ); -// }); - -// it('Should handle a malformed SourceRetrieveResult', () => { -// // @ts-ignore -// const apiResultWithOutType = { -// success: true, -// status: RetrieveStatus.Succeeded, -// components: [ -// { -// name: 'MyTestClass', -// xml: 'some/path/MyTestClass.cls-meta.xml' -// } -// ], -// messages: 'Message from library' -// } as SourceRetrieveResult; -// expect(createRetrieveOutput(apiResultWithOutType, packageDirs)).to.equal( -// nls.localize( -// 'lib_retrieve_result_parse_error', -// JSON.stringify(apiResultWithOutType) -// ) -// ); -// }); -// }); -// }); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/componentDiffer.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/componentDiffer.test.ts deleted file mode 100644 index 43a9bc533e..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/componentDiffer.test.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { SourceComponent } from '@salesforce/source-deploy-retrieve'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as os from 'os'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import * as Sinon from 'sinon'; -import { diffComponents } from '../../../src/conflict/componentDiffer'; - -describe('Component Differ', () => { - let walkContentStubOne: Sinon.SinonStub; - let walkContentStubTwo: Sinon.SinonStub; - - const dir = path.join(os.tmpdir(), 'component-diff-tests', `${new Date().getTime()}`); - const diffPathLocal = path.join(dir, 'local', 'dirOne', 'AccountController.cls'); - const diffPathRemote = path.join(dir, 'remote', 'AccountController.cls'); - const noDiffPathLocal = path.join(dir, 'local', 'dirTwo', 'HandlerCostCenter.cls'); - const noDiffPathRemote = path.join(dir, 'remote', 'HandlerCostCenter.cls'); - const xmlPathLocal = path.join(dir, 'local', 'dirOne', 'AccountController.cls-meta.xml'); - const xmlPathRemote = path.join(dir, 'remote', 'AccountController.cls-meta.xml'); - if (!fs.existsSync(path.join(dir, 'local'))) { - fs.mkdirSync(path.join(dir, 'local', 'dirOne'), {recursive: true}); - fs.mkdirSync(path.join(dir, 'local', 'dirTwo')); - } - if (!fs.existsSync(path.join(dir, 'remote'))) { - fs.mkdirSync(path.join(dir, 'remote'), {recursive: true}); - } - - const sampleComponentOne = { - fullName: 'AccountController', - xml: xmlPathLocal, - walkContent: () => [] as string[] - } as SourceComponent; - const sampleComponentTwo = { - fullName: 'AccountController', - xml: xmlPathRemote, - walkContent: () => [] as string[] - } as SourceComponent; - - fs.writeFileSync(diffPathLocal, 'abc'); - fs.writeFileSync(diffPathRemote, 'def'); - fs.writeFileSync(noDiffPathLocal, 'xyz'); - fs.writeFileSync(noDiffPathRemote, 'xyz'); - fs.writeFileSync(xmlPathLocal, '123'); - fs.writeFileSync(xmlPathRemote, '456'); - - beforeEach(() => { - walkContentStubOne = sinon.stub(sampleComponentOne, 'walkContent'); - walkContentStubTwo = sinon.stub(sampleComponentTwo, 'walkContent'); - }); - - afterEach(() => { - walkContentStubOne.restore(); - walkContentStubTwo.restore(); - }); - - it('Should return all file paths that differ', async () => { - walkContentStubOne.returns([diffPathLocal, noDiffPathLocal]); - walkContentStubTwo.returns([diffPathRemote, noDiffPathRemote]); - const results = diffComponents(sampleComponentOne, sampleComponentTwo); - - expect(walkContentStubOne.callCount).to.equal(1); - expect(walkContentStubTwo.callCount).to.equal(1); - expect(results).to.have.deep.members([{ - projectPath: diffPathLocal, - cachePath: diffPathRemote - }, - { - projectPath: xmlPathLocal, - cachePath: xmlPathRemote - }]); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/metadataCacheService.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/metadataCacheService.test.ts deleted file mode 100644 index be6b6530fd..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/metadataCacheService.test.ts +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ConfigUtil } from '@salesforce/salesforcedx-utils-vscode'; -import { - ComponentSet, - FileProperties, - MetadataApiRetrieve, - RetrieveResult, - SourceComponent -} from '@salesforce/source-deploy-retrieve'; -import { - MetadataApiRetrieveStatus, - RequestStatus -} from '@salesforce/source-deploy-retrieve/lib/src/client/types'; -import * as AdmZip from 'adm-zip'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import { - MetadataCacheExecutor, - MetadataCacheResult, - MetadataCacheService, - PathType -} from '../../../src/conflict/metadataCacheService'; -import { SalesforcePackageDirectories } from '../../../src/salesforceProject'; -import { stubRootWorkspace } from '../util/rootWorkspace.test-util'; - -describe('Metadata Cache', () => { - describe('Metadata Cache Executor', () => { - const PROJ_ROOT = path.join( - __dirname, - '..', - '..', - '..', - '..', - 'test', - 'vscode-integration', - 'diffs' - ); - const usernameOrAlias = 'admin@ut-sandbox.org'; - const PROJECT_DIR = path.join(PROJ_ROOT, 'meta-proj'); - let workspaceStub: sinon.SinonStub; - let executor: MetadataCacheExecutor; - let componentStub: sinon.SinonStub; - let operationStub: sinon.SinonStub; - let processStub: sinon.SinonStub; - - beforeEach(() => { - executor = new MetadataCacheExecutor( - usernameOrAlias, - 'Source Diff', - 'source-diff-loader', - handleCacheResults - ); - operationStub = sinon.stub( - MetadataCacheService.prototype, - 'createRetrieveOperation' - ); - componentStub = sinon.stub( - MetadataCacheService.prototype, - 'getSourceComponents' - ); - processStub = sinon.stub( - MetadataCacheService.prototype, - 'processResults' - ); - workspaceStub = stubRootWorkspace(PROJECT_DIR); - }); - - afterEach(() => { - componentStub.restore(); - processStub.restore(); - operationStub.restore(); - workspaceStub!.restore(); - shell.rm('-rf', PROJECT_DIR); - }); - - it('Should run metadata service', async () => { - componentStub.resolves(new ComponentSet()); - const mockOperation = new MetadataApiRetrieve({ - usernameOrConnection: usernameOrAlias, - components: new ComponentSet(), - output: '' - }); - const pollStatusStub = sinon.stub(mockOperation, 'pollStatus'); - pollStatusStub.callsFake(() => {}); - operationStub.resolves(mockOperation); - processStub.resolves(undefined); - sinon.stub(ConfigUtil, 'getUserConfiguredApiVersion').resolves('55.0'); - - await executor.run({ data: PROJECT_DIR, type: 'CONTINUE' }); - - expect(componentStub.callCount).to.equal(1); - expect(operationStub.callCount).to.equal(1); - expect(pollStatusStub.callCount).to.equal(1); - expect(processStub.callCount).to.equal(1); - }); - }); - - describe('Metadata Cache Service', () => { - const PROJ_ROOT = path.join( - __dirname, - '..', - '..', - '..', - '..', - 'test', - 'vscode-integration', - 'diffs' - ); - const TEST_ASSETS_FOLDER = path.join( - __dirname, - '..', - '..', - '..', - '..', - '..', - 'system-tests', - 'assets' - ); - const TEST_DATA_FOLDER = path.join(TEST_ASSETS_FOLDER, 'differ-testdata'); - const usernameOrAlias = 'admin@ut-sandbox.org'; - const PROJECT_DIR = path.join(PROJ_ROOT, 'meta-proj2'); - let workspaceStub: sinon.SinonStub; - let packageStub: sinon.SinonStub; - let service: MetadataCacheService; - - beforeEach(() => { - service = new MetadataCacheService(usernameOrAlias); - packageStub = sinon - .stub(SalesforcePackageDirectories, 'getPackageDirectoryFullPaths') - .resolves([]); - workspaceStub = stubRootWorkspace(PROJECT_DIR); - }); - - afterEach(() => { - service.clearCache(); - packageStub.restore(); - workspaceStub!.restore(); - shell.rm('-rf', PROJECT_DIR); - }); - - it('Should clear cache directory', async () => { - const cachePath = service.getCachePath(); - const tempFilePath = path.join(cachePath, 'TestFile.xml'); - - shell.mkdir('-p', cachePath); - shell.touch([tempFilePath]); - - expect( - fs.existsSync(tempFilePath), - `folder ${tempFilePath} should exist` - ).to.equal(true); - - const actualCachePath = service.clearCache(); - expect(actualCachePath).to.equal(cachePath); - - expect( - fs.existsSync(actualCachePath), - `folder ${actualCachePath} should not exist` - ).to.equal(false); - }); - - it('Should find one component', async () => { - const projectPath = path.join(PROJECT_DIR, 'src'); - - // populate project metadata - const projectZip = new AdmZip(); - projectZip.addLocalFolder(TEST_DATA_FOLDER); - projectZip.extractAllTo(projectPath); - - const componentPath = path.join( - projectPath, - 'aura', - 'PictureGalleryCard', - 'PictureGalleryCard.cmp' - ); - service.initialize(componentPath, PROJECT_DIR); - const components = await service.getSourceComponents(); - - expect(components.size).to.equal(1); - }); - - it('Should find components', async () => { - const projectPath = path.join(PROJECT_DIR, 'src'); - - // populate project metadata - const projectZip = new AdmZip(); - projectZip.addLocalFolder(TEST_DATA_FOLDER); - projectZip.extractAllTo(projectPath); - - service.initialize(projectPath, PROJECT_DIR); - const components = await service.getSourceComponents(); - - expect(components.size).to.equal(14); - }); - - it('Should find components using a manifest', async () => { - const projectPath = path.join(PROJECT_DIR, 'src'); - const manifestPath = path.join( - TEST_ASSETS_FOLDER, - 'proj-testdata', - 'manifest', - 'one-class.xml' - ); - - // populate project metadata - const projectZip = new AdmZip(); - projectZip.addLocalFolder(TEST_DATA_FOLDER); - projectZip.extractAllTo(projectPath); - - service.initialize(manifestPath, PROJECT_DIR, true); - const components = await service.getSourceComponents(); - - expect(components.size).to.equal(1); - }); - - it('Should return cache results', async () => { - const projectPath = path.join(PROJECT_DIR, 'src'); - const cachePath = service.getCachePath(); - const retrieveRoot = path.join('main', 'default'); - - // populate project metadata - const projectZip = new AdmZip(); - projectZip.addLocalFolder(TEST_DATA_FOLDER); - projectZip.extractAllTo(projectPath); - projectZip.extractAllTo(path.join(cachePath, retrieveRoot)); - - service.initialize(projectPath, PROJECT_DIR); - await service.getSourceComponents(); - const results = loadMockCache(cachePath); - - const cache = await service.processResults(results); - - expect(cache).to.not.equal(undefined); - expect(cache?.selectedPath).to.equal(projectPath); - expect(cache?.selectedType).to.equal(PathType.Folder); - expect(cache?.cachePropPath).to.equal( - path.join(cachePath, 'prop', 'file-props.json') - ); - - expect(cache?.cache.baseDirectory).to.equal(cachePath); - expect(cache?.cache.commonRoot).to.equal(retrieveRoot); - - expect(cache?.project.baseDirectory).to.equal(PROJECT_DIR); - expect(cache?.project.commonRoot).to.equal('src'); - - // verify contents of prop file - if (cache?.cachePropPath) { - const propObj = JSON.parse( - fs.readFileSync(cache?.cachePropPath, { - encoding: 'utf-8' - }) - ); - - expect(propObj.componentPath).to.equal(projectPath); - expect(propObj.fileProperties.length).to.equal(1); - const prop = propObj.fileProperties[0]; - expect(prop.fullName).to.equal('One'); - expect(prop.fileName).to.equal('One.cls'); - } - }); - }); - - async function handleCacheResults( - username: string, - cache?: MetadataCacheResult - ): Promise {} - - function loadMockCache(cachePath: string): RetrieveResult { - const props: FileProperties[] = [ - { - id: '1', - createdById: '2', - createdByName: 'Me', - createdDate: 'Today', - fileName: 'One.cls', - fullName: 'One', - lastModifiedById: '3', - lastModifiedByName: 'You', - lastModifiedDate: 'Tomorrow', - type: 'ApexClass' - } - ]; - - const response: MetadataApiRetrieveStatus = { - done: true, - status: RequestStatus.Succeeded, - success: true, - id: '', - fileProperties: props, - zipFile: '' - }; - - const cacheComps = ComponentSet.fromSource(cachePath); - const results = new RetrieveResult(response, cacheComps); - return results; - } - - describe('Static Methods', () => { - const compOne = { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - }; - const compTwo = { - fullName: 'Account', - type: { - name: 'CustomObject' - } - }; - const childComp = { - fullName: 'AccountNumber', - parent: compTwo, - type: { - name: 'CustomField' - } - }; - const fileProperties: FileProperties[] = [ - { - fullName: 'HandlerCostCenter', - lastModifiedDate: 'Today', - type: 'ApexClass', - id: '1', - createdById: '2', - createdByName: 'Me', - createdDate: 'Today', - fileName: 'One.cls', - lastModifiedById: '3', - lastModifiedByName: 'You' - }, - { - fullName: 'Account', - lastModifiedDate: 'Yesterday', - type: 'CustomObject', - id: '2', - createdById: '2', - createdByName: 'Me', - createdDate: 'Today', - fileName: 'Two.cls', - lastModifiedById: '3', - lastModifiedByName: 'You' - } - ]; - - it('Should correlate results correctly', () => { - const cacheResults = { - cache: { - baseDirectory: path.normalize('/a/b'), - commonRoot: 'c', - components: [compOne, compTwo, childComp] as SourceComponent[] - }, - project: { - baseDirectory: path.normalize('/d'), - commonRoot: path.normalize('e/f'), - components: [compTwo, childComp, compOne] as SourceComponent[] - }, - properties: fileProperties - } as MetadataCacheResult; - - const components = MetadataCacheService.correlateResults(cacheResults); - - expect(components.length).to.equal(2); - expect(components).to.have.deep.members([ - { - cacheComponent: compOne, - projectComponent: compOne, - lastModifiedDate: 'Today' - }, - { - cacheComponent: compTwo, - projectComponent: compTwo, - lastModifiedDate: 'Yesterday' - } - ]); - }); - - it('Should correlate results for just a child component', () => { - const cacheResults = { - cache: { - baseDirectory: path.normalize('/a/b'), - commonRoot: 'c', - components: [compOne, childComp] as SourceComponent[] - }, - project: { - baseDirectory: path.normalize('/d'), - commonRoot: path.normalize('e/f'), - components: [childComp, compOne] as SourceComponent[] - }, - properties: fileProperties - } as MetadataCacheResult; - - const components = MetadataCacheService.correlateResults(cacheResults); - - expect(components.length).to.equal(2); - expect(components).to.have.deep.members([ - { - cacheComponent: compOne, - projectComponent: compOne, - lastModifiedDate: 'Today' - }, - { - cacheComponent: childComp, - projectComponent: childComp, - lastModifiedDate: 'Yesterday' - } - ]); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/persistentStorageService.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/persistentStorageService.test.ts deleted file mode 100644 index 12bbcedfc7..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/persistentStorageService.test.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ComponentSet, DeployResult, FileProperties, registry, SourceComponent} from '@salesforce/source-deploy-retrieve'; -import { MetadataApiDeployStatus, RequestStatus} from '@salesforce/source-deploy-retrieve/lib/src/client/types'; -import { expect } from 'chai'; -import { basename, dirname, join} from 'path'; -import { PersistentStorageService } from '../../../src/conflict/persistentStorageService'; -import { MockExtensionContext } from '../telemetry/MockExtensionContext'; - -describe('Persistent Storage Service', () => { - const props: FileProperties[] = [ - { - id: '1', - createdById: '2', - createdByName: 'Me', - createdDate: 'Today', - fileName: join('classes', 'One.cls'), - fullName: 'One', - lastModifiedById: '3', - lastModifiedByName: 'You', - lastModifiedDate: 'Tomorrow', - type: 'ApexClass' - }, - { - id: '4', - createdById: '2', - createdByName: 'Me', - createdDate: 'Yesterday', - fileName: join('objects', 'Two.cls'), - fullName: 'Two', - lastModifiedById: '2', - lastModifiedByName: 'Me', - lastModifiedDate: 'Yesterday', - type: 'CustomObject' - } - ]; - const deployPropsOne = { - name: 'One', - fullName: 'One', - type: registry.types.apexclass, - content: join('project', 'classes', 'One.cls'), - xml: join('project', 'classes', 'One.cls-meta.xml') - }; - const deployComponentOne = SourceComponent.createVirtualComponent(deployPropsOne, - [{ - dirPath: dirname(deployPropsOne.content), - children: [basename(deployPropsOne.content), basename(deployPropsOne.xml)] - } - ]); - const deployPropsTwo = { - name: 'Two', - fullName: 'Two', - type: registry.types.customobject, - content: join('project', 'classes', 'Two.cls'), - xml: join('project', 'classes', 'Two.cls-meta.xml') - }; - const deployComponentTwo = SourceComponent.createVirtualComponent(deployPropsTwo, - [{ - dirPath: dirname(deployPropsTwo.content), - children: [basename(deployPropsTwo.content), basename(deployPropsTwo.xml)] - } - ]); - const mockDeployResult = new DeployResult( - { - status: RequestStatus.Succeeded, - lastModifiedDate: 'Yesterday' - } as MetadataApiDeployStatus, - new ComponentSet([ - deployComponentOne, - deployComponentTwo - ]) - ); - - beforeEach(() => { - const mockExtensionContext = new MockExtensionContext(false); - PersistentStorageService.initialize(mockExtensionContext); - }); - - it('Should store and retrieve file properties in Memento cache for Retrieve', () => { - const cache = PersistentStorageService.getInstance(); - cache.setPropertiesForFilesRetrieve(props); - expect(cache.getPropertiesForFile(cache.makeKey('ApexClass', 'One'))).to.deep.equal({lastModifiedDate: 'Tomorrow'}); - expect(cache.getPropertiesForFile(cache.makeKey('CustomObject', 'Two'))).to.deep.equal({lastModifiedDate: 'Yesterday'}); - cache.setPropertiesForFile(cache.makeKey('ApexClass', 'One'), undefined); - cache.setPropertiesForFile(cache.makeKey('CustomObject', 'Two'), undefined); - expect(cache.getPropertiesForFile(cache.makeKey('ApexClass', 'One'))).to.equal(undefined); - expect(cache.getPropertiesForFile(cache.makeKey('CustomObject', 'Two'))).to.equal(undefined); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/timestampConflictDetector.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/timestampConflictDetector.test.ts deleted file mode 100644 index 6d0c20fdf9..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/conflict/timestampConflictDetector.test.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - FileProperties, - SourceComponent -} from '@salesforce/source-deploy-retrieve'; -import { fail } from 'assert'; -import { expect } from 'chai'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import * as sinon from 'sinon'; -import { channelService } from '../../../src/channels'; -import { PersistentStorageService } from '../../../src/conflict'; -import * as differ from '../../../src/conflict/componentDiffer'; -import { TimestampFileProperties } from '../../../src/conflict/directoryDiffer'; -import { MetadataCacheResult } from '../../../src/conflict/metadataCacheService'; -import { TimestampConflictDetector } from '../../../src/conflict/timestampConflictDetector'; -import { nls } from '../../../src/messages'; -import { stubRootWorkspace } from '../util/rootWorkspace.test-util'; - -describe('Timestamp Conflict Detector Execution', () => { - const TODAY = '2023-01-28T00:15:28.000Z'; - const YESTERDAY = '2023-01-27T00:15:28.000Z'; - const PROJ_ROOT = path.join( - __dirname, - '..', - '..', - '..', - '..', - 'test', - 'vscode-integration', - 'conflict' - ); - const TEST_DATA_FOLDER = path.join( - __dirname, - '..', - '..', - '..', - '..', - '..', - 'system-tests', - 'assets', - 'proj-testdata' - ); - const PROJECT_DIR = path.join(PROJ_ROOT, 'proj'); - - let workspaceStub: sinon.SinonStub; - let executor: TimestampConflictDetector; - let executorSpy: sinon.SinonSpy; - let differStub: sinon.SinonStub; - let cacheStub: sinon.SinonStub; - let channelServiceStub: sinon.SinonStub; - - beforeEach(() => { - differStub = sinon.stub(differ, 'diffComponents'); - executor = new TimestampConflictDetector(); - executorSpy = sinon.spy(executor, 'createDiffs'); - cacheStub = sinon.stub( - PersistentStorageService.prototype, - 'getPropertiesForFile' - ); - channelServiceStub = sinon.stub(channelService, 'appendLine'); - workspaceStub = stubRootWorkspace(PROJECT_DIR); - }); - - afterEach(() => { - executorSpy.restore(); - differStub.restore(); - workspaceStub.restore(); - cacheStub.restore(); - channelServiceStub.restore(); - shell.rm('-rf', PROJECT_DIR); - }); - - it('Should report differences', async () => { - const cacheResults = { - cache: { - baseDirectory: path.normalize('/a/b'), - commonRoot: 'c', - components: [ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ] as SourceComponent[] - }, - project: { - baseDirectory: path.normalize('/d'), - commonRoot: path.normalize('e/f'), - components: [ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ] as SourceComponent[] - }, - properties: [ - { - fullName: 'HandlerCostCenter', - lastModifiedDate: TODAY, - type: 'ApexClass' - } - ] as FileProperties[] - } as MetadataCacheResult; - - const diffResults = [ - { - projectPath: '/d/e/f/classes/HandlerCostCenter.cls', - cachePath: '/a/b/c/classes/HandlerCostCenter.cls' - } - ] as differ.ComponentDiff[]; - - const storageResult = { - lastModifiedDate: YESTERDAY - }; - - differStub.returns(diffResults); - cacheStub.returns(storageResult); - - const results = await executor.createDiffs(cacheResults); - - expect(executorSpy.callCount).to.equal(1); - expect(cacheStub.callCount).to.equal(1); - - expect(differStub.callCount).to.equal(1); - expect(differStub.getCall(0).args).to.eql([ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - }, - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ]); - - expect(results.different).to.eql( - new Set([ - { - localRelPath: path.normalize('classes/HandlerCostCenter.cls'), - remoteRelPath: path.normalize('classes/HandlerCostCenter.cls'), - localLastModifiedDate: YESTERDAY, - remoteLastModifiedDate: TODAY - } - ]) - ); - }); - - it('Should not report differences if the component is only local', async () => { - const cacheResults = { - cache: { - baseDirectory: path.normalize('/a/b'), - commonRoot: 'c', - components: [] as SourceComponent[] - }, - project: { - baseDirectory: path.normalize('/d'), - commonRoot: path.normalize('e/f'), - components: [ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ] as SourceComponent[] - }, - properties: [ - { - fullName: 'HandlerCostCenter', - lastModifiedDate: TODAY, - type: 'ApexClass' - } - ] as FileProperties[] - } as MetadataCacheResult; - - const results = await executor.createDiffs(cacheResults); - - expect(executorSpy.callCount).to.equal(1); - expect(cacheStub.callCount).to.equal(0); - expect(differStub.callCount).to.equal(0); - expect(results.different).to.eql(new Set()); - }); - - it('Should not report differences if the component is only remote', async () => { - const cacheResults = { - cache: { - baseDirectory: path.normalize('/a/b'), - commonRoot: 'c', - components: [ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ] as SourceComponent[] - }, - project: { - baseDirectory: path.normalize('/d'), - commonRoot: path.normalize('e/f'), - components: [] as SourceComponent[] - }, - properties: [ - { - fullName: 'HandlerCostCenter', - lastModifiedDate: TODAY, - type: 'ApexClass' - } - ] as FileProperties[] - } as MetadataCacheResult; - - const results = await executor.createDiffs(cacheResults); - - expect(executorSpy.callCount).to.equal(1); - expect(cacheStub.callCount).to.equal(0); - expect(differStub.callCount).to.equal(0); - expect(results.different).to.eql(new Set()); - }); - - it('Should not report differences if the timestamps match', async () => { - const cacheResults = { - cache: { - baseDirectory: path.normalize('/a/b'), - commonRoot: 'c', - components: [ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ] as SourceComponent[] - }, - project: { - baseDirectory: path.normalize('/d'), - commonRoot: path.normalize('e/f'), - components: [ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ] as SourceComponent[] - }, - properties: [ - { - fullName: 'HandlerCostCenter', - lastModifiedDate: TODAY, - type: 'ApexClass' - } - ] as FileProperties[] - } as MetadataCacheResult; - - const storageResult = { - lastModifiedDate: TODAY - }; - - cacheStub.returns(storageResult); - - const results = await executor.createDiffs(cacheResults); - - expect(executorSpy.callCount).to.equal(1); - expect(cacheStub.callCount).to.equal(1); - expect(differStub.callCount).to.equal(0); - expect(results.different).to.eql(new Set()); - }); - - it('Should not report differences if the files match', async () => { - const cacheResults = { - cache: { - baseDirectory: path.normalize('/a/b'), - commonRoot: 'c', - components: [ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ] as SourceComponent[] - }, - project: { - baseDirectory: path.normalize('/d'), - commonRoot: path.normalize('e/f'), - components: [ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ] as SourceComponent[] - }, - properties: [ - { - fullName: 'HandlerCostCenter', - lastModifiedDate: TODAY, - type: 'ApexClass' - } - ] as FileProperties[] - } as MetadataCacheResult; - - const diffResults = [] as differ.ComponentDiff[]; - - const storageResult = { - lastModifiedDate: YESTERDAY - }; - - differStub.returns(diffResults); - cacheStub.returns(storageResult); - - const results = await executor.createDiffs(cacheResults); - - expect(executorSpy.callCount).to.equal(1); - expect(cacheStub.callCount).to.equal(1); - - expect(differStub.callCount).to.equal(1); - expect(differStub.getCall(0).args).to.eql([ - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - }, - { - fullName: 'HandlerCostCenter', - type: { - name: 'ApexClass' - } - } - ]); - - expect(results.different).to.eql(new Set()); - }); - - it('Should return empty diffs for an undefined retrieve result', async () => { - const cacheResults = undefined; - - const diffs = await executor.createDiffs(cacheResults); - - expect(channelServiceStub.callCount).to.equal(0); - expect(executorSpy.callCount).to.equal(1); - expect(differStub.callCount).to.equal(0); - expect(diffs.different).to.eql(new Set()); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/context/workspaceContext.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/context/workspaceContext.test.ts deleted file mode 100644 index cc3e8e93f8..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/context/workspaceContext.test.ts +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { - OrgUserInfo, - WorkspaceContextUtil -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { join } from 'path'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { SFDX_CONFIG_FILE, SFDX_FOLDER } from '../../../src/constants'; -import { workspaceContextUtils } from '../../../src/context'; -import { WorkspaceContext } from '../../../src/context/workspaceContext'; -import { decorators } from '../../../src/decorators'; -import { workspaceUtils } from '../../../src/util'; - -const env = createSandbox(); - -class MockFileWatcher implements vscode.Disposable { - private watchUri: vscode.Uri; - private changeSubscribers: ((uri: vscode.Uri) => void)[] = []; - private createSubscribers: ((uri: vscode.Uri) => void)[] = []; - private deleteSubscribers: ((uri: vscode.Uri) => void)[] = []; - - constructor(fsPath: string) { - this.watchUri = vscode.Uri.file(fsPath); - } - - public dispose() {} - - public onDidChange(f: (uri: vscode.Uri) => void): vscode.Disposable { - this.changeSubscribers.push(f); - return this; - } - - public onDidCreate(f: (uri: vscode.Uri) => void): vscode.Disposable { - this.createSubscribers.push(f); - return this; - } - - public onDidDelete(f: (uri: vscode.Uri) => void): vscode.Disposable { - this.deleteSubscribers.push(f); - return this; - } - - public async fire(type: 'change' | 'create' | 'delete') { - let subscribers; - - switch (type) { - case 'change': - subscribers = this.changeSubscribers; - break; - case 'create': - subscribers = this.createSubscribers; - break; - case 'delete': - subscribers = this.deleteSubscribers; - break; - } - - for (const subscriber of subscribers) { - await subscriber(this.watchUri); - } - } - - public ignoreCreateEvents = false; - public ignoreChangeEvents = false; - public ignoreDeleteEvents = false; -} - -class TestWorkspaceContextUtil extends WorkspaceContextUtil { - protected static testInstance: TestWorkspaceContextUtil; - protected constructor() { - super(); - - const bindedHandler = () => this.handleCliConfigChange(); - const cliConfigPath = join( - workspaceUtils.getRootWorkspacePath(), - SFDX_FOLDER, - SFDX_CONFIG_FILE - ); - this.cliConfigWatcher = new MockFileWatcher(cliConfigPath); - this.cliConfigWatcher.onDidChange(bindedHandler); - this.cliConfigWatcher.onDidCreate(bindedHandler); - this.cliConfigWatcher.onDidDelete(bindedHandler); - } - - public static getInstance(forceNew = false) { - if (!TestWorkspaceContextUtil.testInstance || forceNew) { - TestWorkspaceContextUtil.testInstance = new TestWorkspaceContextUtil(); - } - return TestWorkspaceContextUtil.testInstance; - } - - public getFileWatcher(): MockFileWatcher { - return this.cliConfigWatcher as MockFileWatcher; - } -} - -describe('WorkspaceContext', () => { - const testUser = 'test@test.com'; - const testAlias = 'TestOrg'; - const testUser2 = 'test2@test.com'; - - let setupWorkspaceOrgTypeStub: SinonStub; - let usernameStub: SinonStub; - let aliasStub: SinonStub; - let showOrgStub: SinonStub; - let workspaceContextUtil: WorkspaceContextUtil; - let workspaceContext: WorkspaceContext; - - beforeEach(async () => { - setupWorkspaceOrgTypeStub = env - .stub(workspaceContextUtils, 'setupWorkspaceOrgType') - .resolves(); - - workspaceContextUtil = TestWorkspaceContextUtil.getInstance(); - env.stub(WorkspaceContextUtil, 'getInstance').returns(workspaceContextUtil); - usernameStub = env - .stub(workspaceContextUtil, 'username') - .get(() => testUser); - aliasStub = env.stub(workspaceContextUtil, 'alias').get(() => testAlias); - showOrgStub = env.stub(decorators, 'showOrg').resolves(); - - const extensionContext = { - subscriptions: [] - } as unknown as vscode.ExtensionContext; - - workspaceContext = WorkspaceContext.getInstance(true); - await workspaceContext.initialize(extensionContext); - }); - - afterEach(() => env.restore()); - - it('should load the target org and alias upon initialization', () => { - expect(workspaceContext.username).to.equal(testUser); - expect(workspaceContext.alias).to.equal(testAlias); - expect(setupWorkspaceOrgTypeStub.called).to.equal(true); - }); - - it('should update target org and alias upon config change', async () => { - usernameStub.get(() => testUser2); - aliasStub.get(() => undefined); - - await (workspaceContextUtil as TestWorkspaceContextUtil) - .getFileWatcher() - .fire('change'); - - expect(setupWorkspaceOrgTypeStub.called).to.equal(true); - expect(workspaceContext.username).to.equal(testUser2); - expect(workspaceContext.alias).to.equal(undefined); - }); - - it('should update target org and alias to undefined if one is not set', async () => { - usernameStub.get(() => undefined); - aliasStub.get(() => undefined); - - await (workspaceContextUtil as TestWorkspaceContextUtil) - .getFileWatcher() - .fire('change'); - - expect(setupWorkspaceOrgTypeStub.called).to.equal(true); - expect(workspaceContext.username).to.equal(undefined); - expect(workspaceContext.alias).to.equal(undefined); - }); - - // tslint:disable-next-line:only-arrow-functions - it('should notify subscribers that the default org may have changed', async function () { - const someLogic = env.stub(); - workspaceContext.onOrgChange((orgInfo: OrgUserInfo) => { - someLogic(orgInfo); - }); - - // awaiting to ensure subscribers run their logic - const fileChangedPromise = ( - workspaceContextUtil as TestWorkspaceContextUtil - ) - .getFileWatcher() - .fire('change'); - const fileCreatedPromise = ( - workspaceContextUtil as TestWorkspaceContextUtil - ) - .getFileWatcher() - .fire('create'); - const fileDeletedPromise = ( - workspaceContextUtil as TestWorkspaceContextUtil - ) - .getFileWatcher() - .fire('delete'); - - // Test runs in CI build in approx: 45000ms - this.timeout(60000); - await Promise.all([ - fileChangedPromise, - fileCreatedPromise, - fileDeletedPromise - ]); - - expect(someLogic.callCount).to.equal(3); - expect(showOrgStub.called).to.equal(true); - }); - - describe('getConnection', () => { - const mockAuthInfo = { test: 'test' }; - const mockConnection = { authInfo: mockAuthInfo }; - - beforeEach(() => { - env.stub(workspaceContextUtil, 'getConnection').returns(mockConnection); - }); - - it('should return connection for the default org', async () => { - const connection = await workspaceContext.getConnection(); - - expect(connection).to.deep.equal(mockConnection); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/context/workspaceOrgTypeInteg.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/context/workspaceOrgTypeInteg.test.ts deleted file mode 100644 index 0cc5d78308..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/context/workspaceOrgTypeInteg.test.ts +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { AuthInfo, Org } from '@salesforce/core'; -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import { createSandbox } from 'sinon'; -import * as Sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - OrgType, - WorkspaceContext, - workspaceContextUtils -} from '../../../src/context'; -import * as workspaceUtil from '../../../src/context/workspaceOrgType'; -import { OrgAuthInfo } from '../../../src/util'; - -const sandbox = createSandbox(); - -const expectSetHasTargetOrg = ( - hasUsername: boolean, - executeCommandStub: sinon.SinonStub -) => { - expect(executeCommandStub.getCall(0).args).to.eql([ - 'setContext', - 'sf:has_target_org', - hasUsername - ]); -}; - -const expectTargetOrgHasChangeTracking = ( - hasChangeTracking: boolean, - executeCommandStub: sinon.SinonStub, - argOrder?: number -) => { - expect(executeCommandStub.getCall(argOrder ?? 1).args).to.eql([ - 'setContext', - 'sf:target_org_has_change_tracking', - hasChangeTracking - ]); -}; - -const mockWorkspaceContext = { getConnection: () => {} } as any; - -describe('workspaceOrgType', () => { - const scratchOrgUser = 'scratch@org.com'; - let getUsernameStub: Sinon.SinonStub; - let orgCreateStub: Sinon.SinonStub; - let getTargetOrgOrAliasStub: Sinon.SinonStub; - let createStub: Sinon.SinonStub; - let workspaceContextGetInstanceStub: Sinon.SinonStub; - - beforeEach(() => { - getUsernameStub = sandbox.stub(OrgAuthInfo, 'getUsername'); - orgCreateStub = sandbox.stub(Org, 'create'); - getTargetOrgOrAliasStub = sandbox.stub(OrgAuthInfo, 'getTargetOrgOrAlias'); - createStub = sandbox.stub(AuthInfo, 'create'); - workspaceContextGetInstanceStub = sandbox.stub( - WorkspaceContext, - 'getInstance' - ); - }); - - afterEach(() => { - sandbox.restore(); - }); - describe('getTargetOrgOrAlias', () => { - beforeEach(() => { - workspaceContextGetInstanceStub.returns(mockWorkspaceContext); - }); - it('returns undefined when no target-org is set', async () => { - getTargetOrgOrAliasStub.resolves(undefined); - expect(await workspaceContextUtils.getTargetOrgOrAlias()).to.equal( - undefined - ); - }); - - it('returns the target-org when the username is set', async () => { - const username = 'test@org.com'; - getTargetOrgOrAliasStub.resolves(username); - expect(await workspaceContextUtils.getTargetOrgOrAlias()).to.equal( - username - ); - }); - }); - - describe('getWorkspaceOrgType', () => { - beforeEach(() => { - workspaceContextGetInstanceStub.returns(mockWorkspaceContext); - }); - - it('returns the source-tracked org type', async () => { - getUsernameStub.resolves(scratchOrgUser); - orgCreateStub.resolves({ - supportsSourceTracking: async () => true - }); - - const orgType = await workspaceContextUtils.getWorkspaceOrgType(); - - expect(orgType).to.equal(OrgType.SourceTracked); - expect(orgCreateStub.calledOnce).to.eql(true); - }); - - it('returns the non-source-tracked org type', async () => { - const targetOrg = 'sandbox@org.com'; - getUsernameStub.resolves(targetOrg); - orgCreateStub.resolves({ - supportsSourceTracking: async () => false - }); - - const orgType = await workspaceContextUtils.getWorkspaceOrgType(); - expect(orgType).to.equal(OrgType.NonSourceTracked); - expect(orgCreateStub.calledOnce).to.eql(true); - }); - }); - - describe('setupWorkspaceOrgType', () => { - afterEach(() => { - sandbox.restore(); - }); - - it('should set sf:target_org_has_change_tracking context to false when no default org is set', async () => { - workspaceContextGetInstanceStub.returns(() => { - throw new Error('no connection found.'); - }); - const executeCommandStub = sandbox.stub( - vscode.commands, - 'executeCommand' - ); - - await workspaceUtil.setupWorkspaceOrgType(); - - expect(executeCommandStub.calledTwice).to.equal(true); - expectSetHasTargetOrg(false, executeCommandStub); - expectTargetOrgHasChangeTracking(false, executeCommandStub); - - executeCommandStub.restore(); - }); - - describe('setWorkspaceOrgTypeWithOrgType', () => { - it('should set sf:target_org_has_change_tracking to true when default org is source-tracked', async () => { - const executeCommandStub = sandbox.stub( - vscode.commands, - 'executeCommand' - ); - - workspaceContextUtils.setWorkspaceOrgTypeWithOrgType( - OrgType.SourceTracked - ); - - expect(executeCommandStub.calledOnce).to.equal(true); - expectTargetOrgHasChangeTracking(true, executeCommandStub, 0); - - executeCommandStub.restore(); - }); - - it('should set sf:target_org_has_change_tracking to false when the default org is not source-tracked', async () => { - const executeCommandStub = sandbox.stub( - vscode.commands, - 'executeCommand' - ); - - workspaceContextUtils.setWorkspaceOrgTypeWithOrgType( - OrgType.NonSourceTracked - ); - - expect(executeCommandStub.calledOnce).to.equal(true); - expectTargetOrgHasChangeTracking(false, executeCommandStub, 0); - - executeCommandStub.restore(); - }); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/diagnostics/index.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/diagnostics/index.test.ts deleted file mode 100644 index c436061ef7..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/diagnostics/index.test.ts +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ProjectDeployStartErrorResponse } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as path from 'path'; -import { DiagnosticCollection, languages, Uri } from 'vscode'; -import { - getAbsoluteFilePath, - getFileUri, - getRange, - handlePushDiagnosticErrors -} from '../../../src/diagnostics'; - -describe('Diagnostics', () => { - let pushErrorResult: ProjectDeployStartErrorResponse; - const workspacePath = 'local/workspace/path'; - const sourcePath = 'source/file/path'; - let errorCollection: DiagnosticCollection; - - beforeEach(() => { - errorCollection = languages.createDiagnosticCollection('test-errors'); - pushErrorResult = { - message: 'Push failed.', - name: 'PushFailed', - status: 1, - warnings: [], - files: [] - }; - }); - - afterEach(() => { - errorCollection.dispose(); - }); - - it('Should prevent generating range with negative positions', () => { - const range = getRange('0', '-12'); - expect(range.start.line).to.eql(0); - expect(range.start.character).to.eql(0); - expect(range.end.line).to.eql(0); - expect(range.end.character).to.eql(0); - }); - - it('Should convert to 0 based index for range', () => { - const range = getRange('1', '2'); - expect(range.start.line).to.equal(0); - expect(range.start.character).to.equal(1); - expect(range.end.line).to.equal(0); - expect(range.end.character).to.equal(1); - }); - - it('Should create diagnostics based off of push error results', () => { - const resultItem = { - filePath: 'src/classes/Testing.cls', - error: 'Invalid method referenced.', - lineNumber: '1', - columnNumber: '1', - type: 'ApexClass', - fullName: 'Testing' - }; - - pushErrorResult.files.push(resultItem); - - handlePushDiagnosticErrors( - pushErrorResult, - workspacePath, - sourcePath, - errorCollection - ); - - const testDiagnostics = languages.getDiagnostics( - Uri.file(path.join(workspacePath, resultItem.filePath)) - ); - - expect(testDiagnostics).to.be.an('array').to.have.lengthOf(1); - expect(testDiagnostics[0].message).to.be.equals(resultItem.error); - expect(testDiagnostics[0].severity).to.be.equals(0); // vscode.DiagnosticSeverity.Error === 0 - expect(testDiagnostics[0].source).to.be.equals(resultItem.type); - expect(testDiagnostics[0].range).to.be.an('object'); - - const testRange = getRange(resultItem.lineNumber, resultItem.columnNumber); - expect(testDiagnostics[0].range).to.deep.equal(testRange); - }); - - it('Should create multiple diagnostics based off of push error results', () => { - const resultItem1 = { - filePath: 'src/classes/Testing.cls', - error: 'Invalid method referenced.', - lineNumber: '8', - columnNumber: '50', - type: 'ApexClass', - fullName: 'Testing' - }; - - const resultItem2 = { - filePath: 'src/classes/SomeController.cls', - error: - 'Method does not exist or incorrect signature: void runAsSOMETHINGINVALID(User) from the type System (18:20).', - lineNumber: '18', - columnNumber: '20', - type: 'ApexClass', - fullName: 'SomeController' - }; - - pushErrorResult.files.push(resultItem1); - pushErrorResult.files.push(resultItem2); - - handlePushDiagnosticErrors( - pushErrorResult, - workspacePath, - sourcePath, - errorCollection - ); - - const testDiagnostics = languages.getDiagnostics( - Uri.file(path.join(workspacePath, resultItem1.filePath)) - ); - - expect(testDiagnostics).to.be.an('array').to.have.lengthOf(1); - expect(testDiagnostics[0].message).to.be.equals(resultItem1.error); - expect(testDiagnostics[0].severity).to.be.equals(0); // vscode.DiagnosticSeverity.Error === 0 - expect(testDiagnostics[0].source).to.be.equals(resultItem1.type); - expect(testDiagnostics[0].range).to.be.an('object'); - - const testRange = getRange( - resultItem1.lineNumber, - resultItem1.columnNumber - ); - expect(testDiagnostics[0].range).to.deep.equal(testRange); - - const testDiagnostics1 = languages.getDiagnostics( - Uri.file(path.join(workspacePath, resultItem2.filePath)) - ); - - expect(testDiagnostics1).to.be.an('array').to.have.lengthOf(1); - expect(testDiagnostics1[0].message).to.be.equals(resultItem2.error); - expect(testDiagnostics1[0].severity).to.be.equals(0); // vscode.DiagnosticSeverity.Error === 0 - expect(testDiagnostics1[0].source).to.be.equals(resultItem2.type); - expect(testDiagnostics1[0].range).to.be.an('object'); - - const testRange1 = getRange( - resultItem2.lineNumber, - resultItem2.columnNumber - ); - expect(testDiagnostics1[0].range).to.deep.equal(testRange1); - }); - - it('Should create diagnostics under sourcePath', () => { - const resultItem = { - filePath: 'N/A', - error: "Missing ';' at '{' (18:60)", - lineNumber: '18', - columnNumber: '60', - type: 'ApexClass' - }; - - pushErrorResult.files.push(resultItem); - handlePushDiagnosticErrors( - pushErrorResult, - workspacePath, - sourcePath, - errorCollection - ); - - const testDiagnostics = languages.getDiagnostics(Uri.file(sourcePath)); - - expect(testDiagnostics).to.be.an('array').to.have.lengthOf(1); - expect(testDiagnostics[0].message).to.be.equals(resultItem.error); - expect(testDiagnostics[0].severity).to.be.equals(0); // vscode.DiagnosticSeverity.Error === 0 - expect(testDiagnostics[0].source).to.be.equals(resultItem.type); - expect(testDiagnostics[0].range).to.be.an('object'); - - const testRange = getRange(resultItem.lineNumber, resultItem.columnNumber); - expect(testDiagnostics[0].range).to.deep.equal(testRange); - }); - - it('Should create multiple diagnostics under sourcePath', () => { - const resultItem1 = { - filePath: 'N/A', - error: "Missing ';' at '{' (18:60)", - lineNumber: '18', - columnNumber: '60', - type: 'ApexClass' - }; - const resultItem2 = { - error: - 'In field: application - no CustomApplication named Permstachio found', - type: 'PermissionSet', - filePath: 'N/A' - }; - - pushErrorResult.files.push(resultItem1); - pushErrorResult.files.push(resultItem2); - handlePushDiagnosticErrors( - pushErrorResult, - workspacePath, - sourcePath, - errorCollection - ); - - const testDiagnostics = languages.getDiagnostics(Uri.file(sourcePath)); - expect(testDiagnostics).to.be.an('array').to.have.lengthOf(2); - expect(testDiagnostics[0].message).to.be.equals(resultItem1.error); - expect(testDiagnostics[0].severity).to.be.equals(0); // vscode.DiagnosticSeverity.Error === 0 - expect(testDiagnostics[0].source).to.be.equals(resultItem1.type); - expect(testDiagnostics[0].range).to.be.an('object'); - const testRange = getRange( - resultItem1.lineNumber, - resultItem1.columnNumber - ); - expect(testDiagnostics[0].range).to.deep.equal(testRange); - expect(testDiagnostics[1].message).to.be.equals(resultItem2.error); - expect(testDiagnostics[1].severity).to.be.equals(0); // vscode.DiagnosticSeverity.Error === 0 - expect(testDiagnostics[1].source).to.be.equals(resultItem2.type); - expect(testDiagnostics[1].range).to.be.an('object'); - const testRange1 = getRange('1', '1'); - expect(testDiagnostics[1].range).to.deep.equal(testRange1); - }); - - it('Should not duplicate the workspace path when constructing the fileUri', () => { - const absoluteFilePath = `${workspacePath}/src/classes/Testing.cls`; - const fileUri = getFileUri(workspacePath, absoluteFilePath, ''); - const regEx = new RegExp(workspacePath, 'g'); - const count = (fileUri.match(regEx) || []).length; - expect(count).to.equal(1); - }); - - it('Should use the default error path as fileUri when N/A is returned as filePath', () => { - const defaultErrorPath = 'default/error/path'; - const filePath = 'N/A'; - const fileUri = getFileUri(workspacePath, filePath, defaultErrorPath); - expect(fileUri).to.equal(defaultErrorPath); - }); - - it('Should build the absolute file path when constructing the fileUri', () => { - const filePath = 'src/classes/Testing.cls'; - const asoluteFilePath = getAbsoluteFilePath(filePath, workspacePath); - expect(asoluteFilePath).to.equal(workspacePath + '/' + filePath); - }); - - it('Should not duplicate the workspace path when filePath is already absolute', () => { - const filePath = `${workspacePath}/src/classes/Testing.cls`; - const asoluteFilePath = getAbsoluteFilePath(filePath, workspacePath); - expect(asoluteFilePath).to.equal(filePath); - }); - - it('Should use the workspace path as fileUri when filePath is undefined', () => { - const filePath = undefined; - const asoluteFilePath = getAbsoluteFilePath(filePath, workspacePath); - expect(asoluteFilePath).to.equal(workspacePath); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/directoryDiffer.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/directoryDiffer.test.ts deleted file mode 100644 index 4263306ba7..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/directoryDiffer.test.ts +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as AdmZip from 'adm-zip'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as os from 'os'; -import * as path from 'path'; -import * as shell from 'shelljs'; -import { CommonDirDirectoryDiffer } from '../../src/conflict'; - -describe('Directory Differ', () => { - const TEST_DATA_FOLDER = path.join( - __dirname, - '..', - '..', - '..', - '..', - 'system-tests', - 'assets', - 'differ-testdata' - ); - let testRoot: string; - let dirOne: string; - let dirTwo: string; - - beforeEach(() => { - testRoot = path.join(os.tmpdir(), 'diff-test', `${new Date().getTime()}`); - dirOne = path.join(testRoot, 'One'); - dirTwo = path.join(testRoot, 'Two'); - - const testZip = new AdmZip(); - testZip.addLocalFolder(TEST_DATA_FOLDER); - testZip.extractAllTo(dirOne); - testZip.extractAllTo(dirTwo); - - // make directory membership slightly different - const toRemove = path.join(dirTwo, 'pages', 'TestPage.page'); - shell.rm(toRemove); - }); - - it('Should detect no differences', () => { - console.log('TestRoot: ' + testRoot); - const differ = new CommonDirDirectoryDiffer(); - const results = differ.diff(dirOne, dirTwo); - - expect( - results.different.size, - 'should not have detected differences' - ).to.equal(0); - expect( - results.scannedLocal, - 'incorrect number of files scanned in dirOne' - ).to.equal(43); - expect( - results.scannedRemote, - 'incorrect number of files scanned in dirTwo' - ).to.equal(42); - }); - - it('Should detect text differences', () => { - console.log('TestRoot: ' + testRoot); - const cls1ToChange = path.join('classes', 'JWT.cls'); - const cls2ToChange = path.join('classes', 'JWTBearerFlow.cls'); - const layoutToChange = path.join( - 'layouts', - 'User-User Layout.layout-meta.xml' - ); - - const replacementText = `${new Date().getTime()}`; - const filesToChange = [cls1ToChange, cls2ToChange, layoutToChange]; - filesToChange.forEach(f => { - const source = path.join(dirOne, f); - const target = path.join(dirTwo, f); - const content: string = fs.readFileSync(source, 'utf8'); - const updates = content.replace( - 'LOCAL-CHANGE-FOR-TESTING', - replacementText - ); - fs.writeFileSync(target, updates, 'utf8'); - }); - - const differ = new CommonDirDirectoryDiffer(); - const results = differ.diff(dirOne, dirTwo); - - expect(results.different).to.eql(new Set([ - { - localRelPath: cls1ToChange, - remoteRelPath: cls1ToChange - }, - { - localRelPath: layoutToChange, - remoteRelPath: layoutToChange - } - ])); - expect( - results.scannedLocal, - 'incorrect number of files scanned in dirOne' - ).to.equal(43); - expect( - results.scannedRemote, - 'incorrect number of files scanned in dirTwo' - ).to.equal(42); - }); - - it('Should detect binary differences', () => { - console.log('TestRoot: ' + testRoot); - const differ = new CommonDirDirectoryDiffer(); - - const source = path.join( - dirOne, - 'staticresources', - 'leaflet', - 'images', - 'layers.png' - ); - const target = path.join( - dirOne, - 'staticresources', - 'leaflet', - 'images', - 'marker-icon.png' - ); - - // overwrite the target - shell.cp(source, target); - const results = differ.diff(dirOne, dirTwo); - - expect(results.different).to.eql(new Set([ - { - localRelPath: path.join('staticresources', 'leaflet', 'images', 'marker-icon.png'), - remoteRelPath: path.join('staticresources', 'leaflet', 'images', 'marker-icon.png') - } - ])); - expect( - results.scannedLocal, - 'incorrect number of files scanned in dirOne' - ).to.equal(43); - expect( - results.scannedRemote, - 'incorrect number of files scanned in dirTwo' - ).to.equal(42); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/index.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/index.ts deleted file mode 100644 index a3ebab8830..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// -// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING -// -// This file is providing the test runner to use when running extension tests. -// By default the test runner in use is Mocha based. -// -// You can provide your own test runner if you want to override it by exporting -// a function run(testRoot: string, clb: (error:Error) => void) that the extension -// host can call to run the tests. The test runner is expected to use console.log -// to report the results back to the caller. When the tests are finished, return -// a possible error to the callback or null if none. - -import { join, normalize } from 'path'; - -// eslint-disable-next-line @typescript-eslint/no-var-requires -const testRunner = require('@salesforce/salesforcedx-test-utils-vscode/out/src/testrunner'); - -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure( - { - ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results - timeout: 20000, - fullTrace: true, - slow: 0 - }, - normalize(join(__dirname, '..', '..', '..')) -); - -module.exports = testRunner; diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/mocks.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/mocks.ts deleted file mode 100644 index c2aa3d6bca..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/mocks.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { EOL } from 'os'; -import { stub } from 'sinon'; - -export class MockChannel { - public readonly name = 'MockChannel'; - public value = ''; - - public append(value: string): void { - this.value += value; - } - - public appendLine(value: string): void { - this.value += value; - this.value += EOL; - } - - public clear(): void {} - public show(preserveFocus?: boolean | undefined): void; - public show(column?: any, preserveFocus?: any) {} - public hide(): void {} - public dispose(): void {} - public replace(value: string): void {} -} - -export const vscodeStub = { - CancellationTokenSource: class { - public listeners: any[] = []; - public token = { - isCancellationRequested: false, - onCancellationRequested: (listener: any) => { - this.listeners.push(listener); - return { - dispose: () => { - this.listeners = []; - } - }; - } - }; - public cancel = () => { - this.listeners.forEach(listener => { - listener.call(); - }); - }; - public dispose = () => {}; - }, - commands: stub(), - Disposable: stub(), - env: { - machineId: '12345534' - }, - Uri: { - parse: stub() - }, - ProgressLocation: { - SourceControl: 1, - Window: 10, - Notification: 15 - }, - window: { - showInformationMessage: () => { - return Promise.resolve(null); - }, - showWarningMessage: () => { - return Promise.resolve(null); - }, - showErrorMessage: () => { - return Promise.resolve(null); - }, - setStatusBarMessage: () => { - return Promise.resolve(null); - }, - withProgress: () => { - return Promise.resolve(true); - }, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - createOutputChannel: mockChannel => { - return mockChannel; - }, - OutputChannel: { show: () => {} } - }, - workspace: { - getConfiguration: () => { - return { - get: () => true, - update: () => true - }; - }, - onDidChangeConfiguration: stub() - } -}; diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/modes/index.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/modes/index.test.ts deleted file mode 100644 index fb293c14b0..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/modes/index.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { isDemoMode, isProdOrg } from '../../../src/modes/demo-mode'; - -// tslint:disable:no-unused-expression -describe('Demo Mode Utils', () => { - describe('isDemoMode', () => { - let originalValue: any; - - beforeEach(() => { - originalValue = process.env.SFDX_ENV; - }); - - afterEach(() => { - process.env.SFDX_ENV = originalValue; - }); - - it('Should report demo mode if SFDX_ENV === DEMO', () => { - process.env.SFDX_ENV = 'DEMO'; - expect(isDemoMode()).to.be.true; - }); - - it('Should not report demo mode if SFDX_ENV !== DEMO', () => { - process.env.SFDX_ENV = 'SOMETHING_ELSE'; - expect(isDemoMode()).to.be.false; - }); - }); - - describe('isProdOrg', () => { - it('Should not be a prod org if trialExpirationDate is a date string', () => { - expect( - isProdOrg({ - status: 0, - result: { - orgId: '00D_BOGUS', - username: '005_BOGUS', - trialExpirationDate: '2021-08-08T23:59:59.000+0000' - } - }) - ).to.be.false; - }); - - it('Should be a prod org if trialExpirationDate is undefined', () => { - expect( - isProdOrg({ - status: 0, - result: { - orgId: '00D_BOGUS', - username: '005_BOGUS' - } - }) - ).to.be.true; - }); - - it('Should be a prod org if trialExpirationDate is null', () => { - expect( - isProdOrg({ - status: 0, - result: { - orgId: '00D_BOGUS', - username: '005_BOGUS', - trialExpirationDate: null - } - }) - ).to.be.true; - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/notifications/index.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/notifications/index.test.ts deleted file mode 100644 index a6b537a6e1..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/notifications/index.test.ts +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ReplaySubject } from 'rxjs/ReplaySubject'; -import { assert, SinonStub, stub } from 'sinon'; -import { CancellationTokenSource, window } from 'vscode'; -import { channelService } from '../../../src/channels'; -import { nls } from '../../../src/messages'; -import { NotificationService } from '../../../src/notifications/notificationService'; -import { SalesforceCoreSettings } from '../../../src/settings/salesforceCoreSettings'; - -const SHOW_BUTTON_TEXT = nls.localize('notification_show_button_text'); -const SHOW_ONLY_STATUS_BAR_BUTTON_TEXT = nls.localize( - 'notification_show_in_status_bar_button_text' -); - -// tslint:disable:no-empty -describe('Notifications', () => { - let mShowInformation: SinonStub; - let mShowWarningMessage: SinonStub; - let mShowErrorMessage: SinonStub; - let mShow: SinonStub; - let mStatusBar: SinonStub; - let settings: SinonStub; - - beforeEach(() => { - mShow = stub(channelService, 'showChannelOutput'); - mShowInformation = stub(window, 'showInformationMessage').returns( - Promise.resolve(null) - ); - mShowWarningMessage = stub(window, 'showWarningMessage').returns( - Promise.resolve(null) - ); - mShowErrorMessage = stub(window, 'showErrorMessage').returns( - Promise.resolve(null) - ); - mStatusBar = stub(window, 'setStatusBarMessage').returns( - Promise.resolve(null) - ); - settings = stub( - SalesforceCoreSettings.prototype, - 'getShowCLISuccessMsg' - ).returns(true); - }); - - afterEach(() => { - mShow.restore(); - mShowInformation.restore(); - mShowWarningMessage.restore(); - mShowErrorMessage.restore(); - mStatusBar.restore(); - settings.restore(); - }); - - it('Should notify successful execution', done => { - const observable = new ReplaySubject(); - observable.next(0); - - const notificationService = NotificationService.getInstance(); - notificationService.reportExecutionStatus('mock command', observable); - - setTimeout(() => { - assert.notCalled(mShow); - assert.calledWith( - mShowInformation, - 'mock command successfully ran', - SHOW_BUTTON_TEXT, - SHOW_ONLY_STATUS_BAR_BUTTON_TEXT - ); - assert.notCalled(mShowWarningMessage); - assert.notCalled(mShowErrorMessage); - assert.notCalled(mStatusBar); - done(); - }, 0); - }); - - it('Should notify successful and show channel as requested', done => { - // For this particular test, we need it to return a different value - mShowInformation.restore(); - mShowInformation = stub(window, 'showInformationMessage').returns( - Promise.resolve(SHOW_BUTTON_TEXT) - ); - const observable = new ReplaySubject(); - observable.next(0); - - const notificationService = NotificationService.getInstance(); - notificationService.reportExecutionStatus('mock command', observable); - setTimeout(() => { - assert.calledOnce(mShow); - assert.calledWith( - mShowInformation, - 'mock command successfully ran', - SHOW_BUTTON_TEXT, - SHOW_ONLY_STATUS_BAR_BUTTON_TEXT - ); - assert.notCalled(mShowWarningMessage); - assert.notCalled(mShowErrorMessage); - assert.notCalled(mStatusBar); - done(); - }, 0); - }); - - it('Should notify successful in status bar based on user configuration', done => { - // Set user configuration to show success messages in status bar. - settings.restore(); - settings = stub( - SalesforceCoreSettings.prototype, - 'getShowCLISuccessMsg' - ).returns(false); - - const observable = new ReplaySubject(); - observable.next(0); - - const notificationService = NotificationService.getInstance(); - notificationService.reportExecutionStatus('mock command', observable); - - setTimeout(() => { - assert.notCalled(mShow); - assert.notCalled(mShowInformation); - assert.notCalled(mShowWarningMessage); - assert.notCalled(mShowErrorMessage); - assert.calledOnce(mStatusBar); - done(); - }, 0); - }); - - it('Should update setting to hide future information messages', done => { - // For this particular test, we need it to return a different value - mShowInformation.restore(); - mShowInformation = stub(window, 'showInformationMessage').returns( - Promise.resolve(SHOW_ONLY_STATUS_BAR_BUTTON_TEXT) - ); - const updateSetting = stub( - SalesforceCoreSettings.prototype, - 'updateShowCLISuccessMsg' - ); - const observable = new ReplaySubject(); - observable.next(0); - - const notificationService = NotificationService.getInstance(); - notificationService.reportExecutionStatus('mock command', observable); - - setTimeout(() => { - assert.calledWith( - mShowInformation, - 'mock command successfully ran', - SHOW_BUTTON_TEXT, - SHOW_ONLY_STATUS_BAR_BUTTON_TEXT - ); - assert.notCalled(mShow); - assert.notCalled(mShowWarningMessage); - assert.notCalled(mShowErrorMessage); - assert.notCalled(mStatusBar); - assert.calledOnce(updateSetting); - done(); - }, 0); - }); - - it('Should notify cancellation', done => { - const observable = new ReplaySubject(); - const cancellationTokenSource = new CancellationTokenSource(); - - const notificationService = NotificationService.getInstance(); - notificationService.reportExecutionStatus( - 'mock command', - observable, - cancellationTokenSource.token - ); - - cancellationTokenSource.cancel(); - - setTimeout(() => { - assert.calledOnce(mShow); - assert.notCalled(mShowInformation); - assert.calledWith(mShowWarningMessage, 'mock command was canceled'); - assert.notCalled(mShowErrorMessage); - done(); - }, 0); - }); - - it('Should notify unsuccessful execution', done => { - const ABNORMAL_EXIT = -1; - const observable = new ReplaySubject(); - observable.next(ABNORMAL_EXIT); - - const notificationService = NotificationService.getInstance(); - notificationService.reportExecutionStatus('mock command', observable); - - setTimeout(() => { - assert.calledOnce(mShow); - assert.notCalled(mShowInformation); - assert.notCalled(mShowWarningMessage); - assert.calledWith(mShowErrorMessage, 'mock command failed to run'); - done(); - }, 0); - }); - - it('Should notify errorneous execution', done => { - const error = new Error(''); - const observable = new ReplaySubject(); - observable.next(error); - - const notificationService = NotificationService.getInstance(); - notificationService.reportExecutionError('mock command', observable); - - setTimeout(() => { - assert.calledOnce(mShow); - assert.notCalled(mShowInformation); - assert.notCalled(mShowWarningMessage); - assert.calledWith(mShowErrorMessage, 'mock command failed to run'); - done(); - }, 0); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/notifications/progressNotification.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/notifications/progressNotification.test.ts deleted file mode 100644 index 30c31288e8..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/notifications/progressNotification.test.ts +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - CliCommandExecutor, - CommandExecution, - SfCommandBuilder -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { Subject } from 'rxjs/Subject'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { nls } from '../../../src/messages'; -import { ProgressNotification } from '../../../src/notifications'; - -// tslint:disable:no-unused-expression -describe('Progress Notification', () => { - let tokenSource: vscode.CancellationTokenSource; - let execution: CommandExecution; - beforeEach(() => { - tokenSource = new vscode.CancellationTokenSource(); - execution = new CliCommandExecutor( - new SfCommandBuilder().withArg('--help').build(), - {} - ).execute(tokenSource.token); - }); - - it('Should display progress as a cancellable notification', async () => { - const withProgressStub = sinon - .stub(vscode.window, 'withProgress') - .returns(Promise.resolve()); - - ProgressNotification.show(execution, tokenSource); - - expect(withProgressStub.called).to.be.true; - expect(withProgressStub.getCall(0).args[0]).to.eql({ - title: nls.localize('progress_notification_text', execution.command), - location: vscode.ProgressLocation.Notification, - cancellable: true - }); - withProgressStub.restore(); - }); - - it('Should display progress based on given progress location', () => { - const progressLocation = vscode.ProgressLocation.Window; - const withProgressStub = sinon - .stub(vscode.window, 'withProgress') - .returns(Promise.resolve()); - - ProgressNotification.show(execution, tokenSource, progressLocation); - - expect(withProgressStub.getCall(0).args[0]).to.eql({ - title: nls.localize('progress_notification_text', execution.command), - location: progressLocation, - cancellable: true - }); - withProgressStub.restore(); - }); - - it('Should subscribe to the observable when given a progress reporter', async () => { - const progressLocation = vscode.ProgressLocation.Window; - const withProgressStub = sinon - .stub(vscode.window, 'withProgress') - .returns(Promise.resolve()); - - const progress: vscode.Progress<{ - message?: string; - increment?: number; - }> = { - report: sinon.stub() - }; - const token = new vscode.CancellationTokenSource().token; - withProgressStub.yields(progress, token); - - const reporter = new Subject(); - const subscribeSpy = sinon.spy(reporter, 'subscribe'); - - await ProgressNotification.show( - execution, - tokenSource, - progressLocation, - reporter.asObservable() - ); - - sinon.assert.calledOnce(subscribeSpy); - sinon.assert.calledWith(subscribeSpy, sinon.match.has('next')); - sinon.assert.calledWith(subscribeSpy, sinon.match.has('complete')); - - withProgressStub.restore(); - }); - - it('Should report 100 progress when the reporter invokes complete', async () => { - const progressLocation = vscode.ProgressLocation.Window; - const withProgressStub = sinon - .stub(vscode.window, 'withProgress') - .returns(Promise.resolve()); - - const reportStub = sinon.stub(); - const progress: vscode.Progress<{ - message?: string; - increment?: number; - }> = { - report: reportStub - }; - const token = new vscode.CancellationTokenSource().token; - withProgressStub.yields(progress, token); - - const reporter = new Subject(); - - await ProgressNotification.show( - execution, - tokenSource, - progressLocation, - reporter.asObservable() - ); - - reporter.complete(); - sinon.assert.calledOnce(reportStub); - sinon.assert.calledWith(reportStub, sinon.match({ increment: 100 })); - - withProgressStub.restore(); - }); - - it('Should report incremental progress when the reporter invokes next', async () => { - const progressLocation = vscode.ProgressLocation.Window; - const withProgressStub = sinon - .stub(vscode.window, 'withProgress') - .returns(Promise.resolve()); - - const reportStub = sinon.stub(); - const progress: vscode.Progress<{ - message?: string; - increment?: number; - }> = { - report: reportStub - }; - const token = new vscode.CancellationTokenSource().token; - withProgressStub.yields(progress, token); - - const reporter = new Subject(); - - await ProgressNotification.show( - execution, - tokenSource, - progressLocation, - reporter.asObservable() - ); - - reporter.next(25); - sinon.assert.calledOnce(reportStub); - sinon.assert.calledWith(reportStub, sinon.match({ increment: 25 })); - - withProgressStub.restore(); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataCmp.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataCmp.test.ts deleted file mode 100644 index fe564d174a..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataCmp.test.ts +++ /dev/null @@ -1,755 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { Connection } from '@salesforce/core'; -import { - instantiateContext, - MockTestOrgData, - restoreContext, - stubContext -} from '@salesforce/core/lib/testSetup'; -import { - projectPaths, - WorkspaceContextUtil -} from '@salesforce/salesforcedx-utils-vscode'; -import { standardValueSet } from '@salesforce/source-deploy-retrieve/lib/src/registry'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import { SinonStub, stub } from 'sinon'; -import { isNullOrUndefined } from 'util'; -import { WorkspaceContext } from '../../../src/context'; -import { ComponentUtils } from '../../../src/orgBrowser'; -import { OrgAuthInfo } from '../../../src/util'; - -const $$ = instantiateContext(); -const sb = $$.SANDBOX; - -const mockFieldData = { - result: { - fields: [ - { - type: 'string', - relationshipName: undefined, - name: 'Name__c', - length: 50 - }, - { - type: 'email', - relationshipName: undefined, - name: 'Email__c', - length: 100 - }, - { - type: 'textarea', - relationshipName: undefined, - name: 'Notes__c', - length: 500 - }, - { - type: 'number', - relationshipName: undefined, - name: 'Age__c', - length: undefined - } - ] - } -}; - -const expectedfetchAndSaveSObjectFieldsPropertiesResult = { - status: 0, - result: [mockFieldData.result.fields] -}; - -const sObjectDescribeResult = { - fields: [mockFieldData.result.fields] -}; - -const expectedFieldList = [ - 'Name__c (string(50))', - 'Email__c (email(100))', - 'Notes__c (textarea(500))', - 'Age__c (number)' -]; - -// tslint:disable:no-unused-expression -describe('get metadata components path', () => { - let getUsernameStub: SinonStub; - let metadataFolderStub: SinonStub; - const cmpUtil = new ComponentUtils(); - const username = 'test-username1@example.com'; - const metadataDirectoryPath = 'test/path/.sfdx'; - - beforeEach(() => { - getUsernameStub = stub(WorkspaceContextUtil.prototype, 'username').returns( - 'test-username1@example.com' - ); - metadataFolderStub = stub(projectPaths, 'metadataFolder').returns( - metadataDirectoryPath - ); - }); - afterEach(() => { - getUsernameStub.restore(); - metadataFolderStub.restore(); - }); - - function expectedPath(fileName: string) { - return path.join(metadataDirectoryPath, fileName + '.json'); - } - - it('should return the path for a given username and metadata type', async () => { - const metadataType = 'ApexClass'; - const expectedPathToApexClassFolder = expectedPath(metadataType); - expect(await cmpUtil.getComponentsPath(metadataType)).to.equal( - expectedPathToApexClassFolder - ); - expect(metadataFolderStub.called).to.equal(true); - expect(metadataFolderStub.calledWith(username)).to.equal(false); - }); - - it('should return the path for a given folder', async () => { - const metadataType = 'Report'; - const folder = 'TestFolder'; - const compPath = await cmpUtil.getComponentsPath(metadataType, folder); - - const expectedPathToReportsFolder = expectedPath( - metadataType + '_' + folder - ); - - expect(compPath).to.equal(expectedPathToReportsFolder); - expect(metadataFolderStub.called).to.equal(true); - expect(metadataFolderStub.calledWith(username)).to.equal(false); - }); -}); - -describe('build metadata components list', () => { - let readFileStub: SinonStub; - const cmpUtil = new ComponentUtils(); - beforeEach(() => { - readFileStub = stub(fs, 'readFileSync'); - }); - afterEach(() => { - readFileStub.restore(); - }); - - it('should return a sorted list of fullNames when given a list of metadata components', async () => { - const metadataType = 'ApexClass'; - const fileData = JSON.stringify({ - status: 0, - result: [ - { - fullName: 'fakeName2', - type: 'ApexClass', - manageableState: 'unmanaged' - }, - { - fullName: 'fakeName1', - type: 'ApexClass', - manageableState: 'unmanaged' - }, - { - fullName: 'fakeName3', - type: 'ApexClass', - manageableState: 'unmanaged', - namespacePrefix: 'sf_namespace' - } - ] - }); - const fullNames = cmpUtil.buildComponentsList( - metadataType, - fileData, - undefined - ); - if (!isNullOrUndefined(fullNames)) { - expect(fullNames[0]).to.equal('fakeName1'); - expect(fullNames[1]).to.equal('fakeName2'); - expect(fullNames[2]).to.equal('sf_namespace__fakeName3'); - expect(readFileStub.called).to.equal(false); - } - }); - - it('should return a sorted list of fullNames when given the metadata components result file path', async () => { - const filePath = '/test/metadata/ApexClass.json'; - const metadataType = 'ApexClass'; - const fileData = JSON.stringify({ - status: 0, - result: [ - { - fullName: 'fakeName2', - type: 'ApexClass', - manageableState: 'unmanaged' - }, - { - fullName: 'fakeName1', - type: 'ApexClass', - manageableState: 'unmanaged' - }, - { - fullName: 'fakeName3', - type: 'ApexClass', - manageableState: 'unmanaged', - namespacePrefix: 'sf_namespace' - } - ] - }); - readFileStub.returns(fileData); - - const fullNames = cmpUtil.buildComponentsList( - metadataType, - undefined, - filePath - ); - if (!isNullOrUndefined(fullNames)) { - expect(fullNames[0]).to.equal('fakeName1'); - expect(fullNames[1]).to.equal('fakeName2'); - expect(fullNames[2]).to.equal('sf_namespace__fakeName3'); - expect(readFileStub.called).to.equal(true); - } - }); - - it('should not return components if they are uneditable', async () => { - const type = 'ApexClass'; - const states = ['installed', 'released', 'deleted', 'deprecated', 'beta']; - const fileData = { - status: 0, - result: states.map((s, i) => ({ - fullName: `fakeName${i}`, - type, - manageableState: s - })) - }; - - const fullNames = cmpUtil.buildComponentsList( - type, - JSON.stringify(fileData), - undefined - ); - - expect(fullNames.length).to.equal(0); - }); - - it('should return components that are editable', () => { - const type = 'CustomObject'; - const validStates = [ - 'unmanaged', - 'deprecatedEditable', - 'installedEditable', - undefined // unpackaged component - ]; - - const fileData = { - status: 0, - result: validStates.map((s, i) => ({ - fullName: `fakeName${i}`, - type, - manageableState: s - })) - }; - const fullNames = cmpUtil.buildComponentsList( - type, - JSON.stringify(fileData), - undefined - ); - - expect(fullNames).to.deep.equal([ - 'fakeName0', - 'fakeName1', - 'fakeName2', - 'fakeName3' - ]); - }); -}); - -describe('load metadata components and custom objects fields list', () => { - let mockConnection: Connection; - let connectionStub: SinonStub; - let getComponentsPathStub: SinonStub; - let getUsernameStub: SinonStub; - let fileExistsStub: SinonStub; - let buildComponentsListStub: SinonStub; - let buildCustomObjectFieldsListStub: SinonStub; - let fetchAndSaveMetadataComponentPropertiesStub: SinonStub; - let fetchAndSaveSObjectFieldsPropertiesStub: SinonStub; - const cmpUtil = new ComponentUtils(); - const defaultOrg = 'defaultOrg@test.com'; - const metadataType = 'ApexClass'; - const metadataTypeCustomObject = 'CustomObject'; - const metadataTypeStandardValueSet = 'StandardValueSet'; - const sObjectName = 'DemoCustomObject'; - const folderName = 'DemoDashboard'; - const metadataTypeDashboard = 'Dashboard'; - const filePath = '/test/metadata/ApexClass.json'; - const fileData = JSON.stringify({ - status: 0, - result: [ - { fullName: 'fakeName2', type: 'ApexClass' }, - { fullName: 'fakeName1', type: 'ApexClass' } - ] - }); - - beforeEach(async () => { - const testData = new MockTestOrgData(); - stubContext($$); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await testData.getConnection(); - getComponentsPathStub = sb - .stub(ComponentUtils.prototype, 'getComponentsPath') - .returns(filePath); - connectionStub = sb - .stub(WorkspaceContext.prototype, 'getConnection') - .resolves(mockConnection); - getUsernameStub = sb - .stub(OrgAuthInfo, 'getUsername') - .returns('test-username1@example.com'); - fileExistsStub = sb.stub(fs, 'existsSync'); - buildComponentsListStub = sb.stub( - ComponentUtils.prototype, - 'buildComponentsList' - ); - buildCustomObjectFieldsListStub = sb.stub( - ComponentUtils.prototype, - 'buildCustomObjectFieldsList' - ); - fetchAndSaveMetadataComponentPropertiesStub = sb - .stub(cmpUtil, 'fetchAndSaveMetadataComponentProperties') - .resolves(fileData); - fetchAndSaveSObjectFieldsPropertiesStub = sb - .stub(cmpUtil, 'fetchAndSaveSObjectFieldsProperties') - .resolves(mockFieldData); - }); - - afterEach(() => { - restoreContext($$); - }); - - it('should load metadata components through sfdx-core library if file does not exist', async () => { - fileExistsStub.returns(false); - const components = await cmpUtil.loadComponents(defaultOrg, metadataType); - expect(fetchAndSaveMetadataComponentPropertiesStub.calledOnce).to.equal( - true - ); - expect( - fetchAndSaveMetadataComponentPropertiesStub.calledWith( - metadataType, - mockConnection, - filePath - ) - ).to.be.true; - expect(buildComponentsListStub.calledOnce).to.be.true; - expect( - buildComponentsListStub.calledWith(metadataType, fileData, undefined) - ).to.be.true; - }); - - it('should load metadata components from json file if the file exists', async () => { - fileExistsStub.returns(true); - const components = await cmpUtil.loadComponents(defaultOrg, metadataType); - expect(fetchAndSaveMetadataComponentPropertiesStub.called).to.equal(false); - expect( - buildComponentsListStub.calledWith(metadataType, undefined, filePath) - ).to.be.true; - }); - - it('should load metadata components through sfdx-core library if forceRefresh is set to true and file exists', async () => { - fileExistsStub.returns(true); - await cmpUtil.loadComponents(defaultOrg, metadataType, undefined, true); - expect(fetchAndSaveMetadataComponentPropertiesStub.calledOnce).to.be.true; - expect( - fetchAndSaveMetadataComponentPropertiesStub.calledWith( - metadataType, - mockConnection, - filePath - ) - ).to.be.true; - expect(buildComponentsListStub.calledOnce).to.be.true; - expect( - buildComponentsListStub.calledWith(metadataType, fileData, undefined) - ).to.be.true; - }); - - it('should load metadata components listed under folders of Dashboards through sfdx-core library if file does not exist', async () => { - fileExistsStub.returns(false); - const components = await cmpUtil.loadComponents( - defaultOrg, - metadataTypeDashboard, - folderName, - undefined - ); - expect(fetchAndSaveMetadataComponentPropertiesStub.calledOnce).to.equal( - true - ); - expect( - fetchAndSaveMetadataComponentPropertiesStub.calledWith( - metadataTypeDashboard, - mockConnection, - filePath, - folderName - ) - ).to.be.true; - expect(buildComponentsListStub.calledOnce).to.be.true; - expect( - buildComponentsListStub.calledWith( - metadataTypeDashboard, - fileData, - undefined - ) - ).to.be.true; - }); - - it('should load metadata components listed under folders of Dashboards from json file if the file exists', async () => { - fileExistsStub.returns(true); - const components = await cmpUtil.loadComponents( - defaultOrg, - metadataTypeDashboard, - folderName, - undefined - ); - expect(fetchAndSaveMetadataComponentPropertiesStub.called).to.equal(false); - expect( - buildComponentsListStub.calledWith( - metadataTypeDashboard, - undefined, - filePath - ) - ).to.be.true; - }); - - it('should load sobject fields list through sfdx-core if file does not exist', async () => { - fileExistsStub.returns(false); - buildCustomObjectFieldsListStub.returns(''); - const components = await cmpUtil.loadComponents( - defaultOrg, - metadataTypeCustomObject, - sObjectName, - undefined - ); - expect(fetchAndSaveSObjectFieldsPropertiesStub.called).to.equal(true); - expect( - fetchAndSaveSObjectFieldsPropertiesStub.calledWith( - mockConnection, - filePath, - sObjectName - ) - ).to.be.true; - expect(buildCustomObjectFieldsListStub.called).to.equal(true); - expect(buildCustomObjectFieldsListStub.calledWith(mockFieldData, filePath)) - .to.be.true; - }); - - it('should load sobject fields list from json file if the file exists', async () => { - fileExistsStub.returns(true); - buildCustomObjectFieldsListStub.returns(''); - const components = await cmpUtil.loadComponents( - defaultOrg, - metadataTypeCustomObject, - sObjectName, - undefined - ); - expect(fetchAndSaveSObjectFieldsPropertiesStub.called).to.equal(false); - expect(buildCustomObjectFieldsListStub.called).to.equal(true); - expect(buildCustomObjectFieldsListStub.calledWith(undefined, filePath)).to - .be.true; - }); - - it('should load sobject fields list through sfdx-core if forceRefresh is set to true and file exists', async () => { - fileExistsStub.returns(true); - buildCustomObjectFieldsListStub.returns(''); - const components = await cmpUtil.loadComponents( - defaultOrg, - metadataTypeCustomObject, - sObjectName, - true - ); - expect(fetchAndSaveSObjectFieldsPropertiesStub.called).to.equal(true); - expect( - fetchAndSaveSObjectFieldsPropertiesStub.calledWith( - mockConnection, - filePath, - sObjectName - ) - ).to.be.true; - expect(buildCustomObjectFieldsListStub.called).to.equal(true); - expect(buildCustomObjectFieldsListStub.calledWith(mockFieldData, filePath)) - .to.be.true; - }); - - it('should validate that buildCustomObjectFieldsList() returns correctly formatted fields', async () => { - // const fieldData = JSON.stringify(mockFieldData); - const formattedFields = expectedFieldList; - buildCustomObjectFieldsListStub.returns(formattedFields); - const components = await cmpUtil.loadComponents( - defaultOrg, - metadataTypeCustomObject, - sObjectName - ); - expect(JSON.stringify(components)).to.equal( - JSON.stringify(formattedFields) - ); - }); - - it('should return hardcoded list of StandardValueSet fullNames', async () => { - const components = await cmpUtil.loadComponents( - defaultOrg, - metadataTypeStandardValueSet - ); - expect(JSON.stringify(components)).to.equal( - JSON.stringify(standardValueSet.fullnames) - ); - }); -}); - -describe('fetch metadata components and custom objects fields list', () => { - let mockConnection: Connection; - let connectionStub: SinonStub; - let fileExistsStub: SinonStub; - let fetchCustomObjectsFieldsStub: SinonStub; - let fetchExistingCustomObjectsFieldsStub: SinonStub; - let fetchMetadataComponentsStub: SinonStub; - let fetchExistingMetadataComponentsStub: SinonStub; - let getComponentsPathStub: SinonStub; - const cmpUtil = new ComponentUtils(); - const defaultOrg = 'defaultOrg@test.com'; - const customObjectMetadataType = 'CustomObject'; - const metadataType = 'ApexClass'; - const sObject = 'DemoCustomObject'; - const filePath = '/test/metadata/CustomObject_DemoCustomObject.json'; - const fieldsList = expectedFieldList; - - beforeEach(async () => { - const testData = new MockTestOrgData(); - stubContext($$); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await testData.getConnection(); - fileExistsStub = sb.stub(fs, 'existsSync'); - connectionStub = sb - .stub(WorkspaceContext.prototype, 'getConnection') - .resolves(mockConnection); - getComponentsPathStub = sb - .stub(ComponentUtils.prototype, 'getComponentsPath') - .returns(filePath); - fetchCustomObjectsFieldsStub = sb - .stub(ComponentUtils.prototype, 'fetchCustomObjectsFields') - .resolves(fieldsList); - fetchExistingCustomObjectsFieldsStub = sb - .stub(ComponentUtils.prototype, 'fetchExistingCustomObjectsFields') - .resolves(fieldsList); - fetchMetadataComponentsStub = sb - .stub(ComponentUtils.prototype, 'fetchMetadataComponents') - .resolves(''); - fetchExistingMetadataComponentsStub = sb - .stub(ComponentUtils.prototype, 'fetchExistingMetadataComponents') - .resolves(''); - }); - - afterEach(() => { - restoreContext($$); - }); - - it('should call fetchCustomObjectsFields() to fetch fields of a sobject if json file does not exist', async () => { - fileExistsStub.returns(false); - const components = await cmpUtil.loadComponents( - defaultOrg, - customObjectMetadataType, - sObject - ); - expect(fetchCustomObjectsFieldsStub.called).to.equal(true); - expect( - fetchCustomObjectsFieldsStub.calledWith(mockConnection, filePath, sObject) - ).to.be.true; - }); - - it('should call fetchExistingCustomObjectsFields() to fetch fields of a sobject if json file exists', async () => { - fileExistsStub.returns(true); - const components = await cmpUtil.loadComponents( - defaultOrg, - customObjectMetadataType, - sObject - ); - expect(fetchExistingCustomObjectsFieldsStub.called).to.equal(true); - expect(fetchExistingCustomObjectsFieldsStub.calledWith(filePath)).to.be - .true; - }); - - it('should call fetchCustomObjectsFields() to fetch fields of a sobject if json file exists and force is set to true', async () => { - fileExistsStub.returns(true); - const components = await cmpUtil.loadComponents( - defaultOrg, - customObjectMetadataType, - sObject, - true - ); - expect(fetchCustomObjectsFieldsStub.called).to.be.true; - expect( - fetchCustomObjectsFieldsStub.calledWith(mockConnection, filePath, sObject) - ).to.be.true; - }); - - it('should call fetchMetadataComponents() to fetch metadata components if json file does not exist', async () => { - fileExistsStub.returns(false); - const components = await cmpUtil.loadComponents(defaultOrg, metadataType); - expect(fetchMetadataComponentsStub.called).to.equal(true); - expect( - fetchMetadataComponentsStub.calledWith( - metadataType, - mockConnection, - filePath, - undefined - ) - ).to.be.true; - }); - - it('should call fetchExistingMetadataComponents() to fetch metadata components if json file exists', async () => { - fileExistsStub.returns(true); - const components = await cmpUtil.loadComponents(defaultOrg, metadataType); - expect(fetchExistingMetadataComponentsStub.called).to.equal(true); - expect( - fetchExistingMetadataComponentsStub.calledWith(metadataType, filePath) - ).to.be.true; - }); - - it('should call fetchMetadataComponents() to fetch metadata components if json file exists and force is set to true', async () => { - fileExistsStub.returns(true); - const components = await cmpUtil.loadComponents( - defaultOrg, - metadataType, - undefined, - true - ); - expect(fetchMetadataComponentsStub.called).to.be.true; - expect( - fetchMetadataComponentsStub.calledWith( - metadataType, - mockConnection, - filePath, - undefined - ) - ).to.be.true; - }); -}); - -describe('fetch fields of a standard or custom object', () => { - let mockConnection: Connection; - let connectionStub: SinonStub; - let fetchAndSaveSObjectFieldsPropertiesStub: SinonStub; - let buildCustomObjectFieldsListStub: SinonStub; - const cmpUtil = new ComponentUtils(); - const metadataType = 'CustomObject'; - const sObject = 'DemoCustomObject'; - const filePath = '/test/metadata/CustomObject_DemoCustomObject.json'; - const fieldData = JSON.stringify(mockFieldData); - const fieldsList = expectedFieldList; - - beforeEach(async () => { - const testData = new MockTestOrgData(); - stubContext($$); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await testData.getConnection(); - fetchAndSaveSObjectFieldsPropertiesStub = sb - .stub(cmpUtil, 'fetchAndSaveSObjectFieldsProperties') - .resolves(fieldData); - buildCustomObjectFieldsListStub = sb - .stub(ComponentUtils.prototype, 'buildCustomObjectFieldsList') - .returns(fieldsList); - connectionStub = sb - .stub(WorkspaceContext.prototype, 'getConnection') - .resolves(mockConnection); - }); - - afterEach(() => { - restoreContext($$); - }); - - it('should call fetchAndSaveSObjectFieldsProperties() and buildCustomObjectFields() while fetching custom object fields if file does not exist or forceRefresh is set to true', async () => { - const fieldList = await cmpUtil.fetchCustomObjectsFields( - mockConnection, - filePath, - sObject - ); - expect(fetchAndSaveSObjectFieldsPropertiesStub.called).to.equal(true); - expect( - fetchAndSaveSObjectFieldsPropertiesStub.calledWith( - mockConnection, - filePath, - sObject - ) - ).to.be.true; - expect(buildCustomObjectFieldsListStub.called).to.equal(true); - expect(buildCustomObjectFieldsListStub.calledWith(fieldData, filePath)).to - .be.true; - }); - - it('should validate that buildCustomObjectFields() is called while fetching custom object fields if file exists', async () => { - const fieldList = await cmpUtil.fetchExistingCustomObjectsFields(filePath); - expect(buildCustomObjectFieldsListStub.called).to.equal(true); - expect(buildCustomObjectFieldsListStub.calledWith(undefined, filePath)).to - .be.true; - }); - - it('should validate that fetchAndSaveSObjectFieldsProperties() is not called while fetching custom object fields if file exists', async () => { - const fieldList = await cmpUtil.fetchExistingCustomObjectsFields(filePath); - expect(fetchAndSaveSObjectFieldsPropertiesStub.called).to.equal(false); - }); -}); - -describe('retrieve fields data of a sobject to write in a json file designated for the sobject', () => { - let mockConnection: Connection; - let connectionStub: SinonStub; - let describeSObjectFieldsStub: SinonStub; - let writeFileStub: SinonStub; - const cmpUtil = new ComponentUtils(); - const sObjectName = 'DemoAccount'; - const filePath = '/test/metadata/CustomObject_DemoAccount.json'; - - beforeEach(async () => { - const testData = new MockTestOrgData(); - stubContext($$); - $$.setConfigStubContents('AuthInfoConfig', { - contents: await testData.getConfig() - }); - mockConnection = await testData.getConnection(); - connectionStub = sb - .stub(WorkspaceContext.prototype, 'getConnection') - .resolves(mockConnection); - describeSObjectFieldsStub = sb - .stub(mockConnection, 'describe') - .resolves(sObjectDescribeResult); - writeFileStub = sb.stub(fs, 'writeFileSync').returns({}); - }); - - afterEach(() => { - restoreContext($$); - }); - - it('should validate that fetchAndSaveSObjectFieldsProperties() writes a json file at sobject components path', async () => { - const sObjectFields = await cmpUtil.fetchAndSaveSObjectFieldsProperties( - mockConnection, - filePath, - sObjectName - ); - expect(writeFileStub.called).to.equal(true); - expect(writeFileStub.calledWith(filePath)).to.be.true; - }); - - it('should validate that fetchAndSaveSObjectFieldsProperties() returns the correctly formatted result file', async () => { - const sObjectFields = await cmpUtil.fetchAndSaveSObjectFieldsProperties( - mockConnection, - filePath, - sObjectName - ); - expect(sObjectFields).to.equal( - JSON.stringify(expectedfetchAndSaveSObjectFieldsPropertiesResult, null, 2) - ); - expect(JSON.parse(sObjectFields).result.length).to.equal( - expectedfetchAndSaveSObjectFieldsPropertiesResult.result.length - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataOutlineProvider.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataOutlineProvider.test.ts deleted file mode 100644 index f48187599a..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataOutlineProvider.test.ts +++ /dev/null @@ -1,677 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { fail } from 'assert'; -import { expect } from 'chai'; -import { SinonStub, stub } from 'sinon'; -import { nls } from '../../../src/messages'; -import { - BrowserNode, - ComponentUtils, - MetadataOutlineProvider, - NodeType, - parseErrors, - TypeUtils -} from '../../../src/orgBrowser'; - -/* tslint:disable:no-unused-expression */ -describe('load org browser tree outline', () => { - const username = 'test-username@test1234.com'; - let metadataProvider: MetadataOutlineProvider; - let loadComponentsStub: SinonStub; - let getTypesStub: SinonStub; - - beforeEach(() => { - metadataProvider = new MetadataOutlineProvider(username); - loadComponentsStub = stub(ComponentUtils.prototype, 'loadComponents'); - getTypesStub = stub(MetadataOutlineProvider.prototype, 'getTypes'); - }); - - afterEach(() => { - loadComponentsStub.restore(); - getTypesStub.restore(); - }); - - it('should load the root node with default org', async () => { - const expectedNode = new BrowserNode(username, NodeType.Org); - const orgNode = await metadataProvider.getChildren(); - expect(orgNode).to.deep.equal([expectedNode]); - }); - - it('should display emptyNode with error message if default org is not set', async () => { - metadataProvider = new MetadataOutlineProvider(undefined); - const expectedNode = new BrowserNode( - nls.localize('missing_default_org'), - NodeType.EmptyNode - ); - const orgNode = await metadataProvider.getChildren(); - expect(orgNode).to.deep.equal([expectedNode]); - }); - - it('should load metadata type nodes when tree is created', async () => { - const metadataInfo = [ - { - label: 'typeNode1', - type: NodeType.MetadataType, - xmlName: 'typeNode1' - }, - { - label: 'typeNode2', - type: NodeType.MetadataType, - xmlName: 'typeNode2' - } - ]; - const expected = getExpected( - 'typeNode1', - 'typeNode2', - NodeType.MetadataType - ); - const orgNode = new BrowserNode(username, NodeType.Org); - getTypesStub.returns(metadataInfo); - const typesNodes = await metadataProvider.getChildren(orgNode); - compareNodes(typesNodes, expected); - }); - - it('should throw error if trouble fetching components', async () => { - const metadataObject = getMetadataObject('typeNode1'); - const typeNode = new BrowserNode( - 'ApexClass', - NodeType.MetadataType, - undefined, - metadataObject - ); - loadComponentsStub.returns( - Promise.reject( - JSON.stringify({ - name: 'Should throw an error' - }) - ) - ); - - try { - await metadataProvider.getChildren(typeNode); - fail('Should have thrown an error getting the children'); - } catch (e) { - expect(e.message).to.equal( - `${nls.localize('error_fetching_metadata')} ${nls.localize( - 'error_org_browser_text' - )}` - ); - } - }); - - it('should display emptyNode with error message if no components are present for a given type', async () => { - const metadataObject = getMetadataObject('typeNode1'); - const typeNode = new BrowserNode( - 'ApexClass', - NodeType.MetadataType, - undefined, - metadataObject - ); - - const emptyNode = new BrowserNode( - nls.localize('empty_components'), - NodeType.EmptyNode - ); - loadComponentsStub.returns([]); - const cmpsNodes = await metadataProvider.getChildren(typeNode); - expect(cmpsNodes).to.deep.equal([emptyNode]); - }); - - it('should display folders and components that live in them when a folder type node is selected', async () => { - const folder1 = [ - { - fullName: 'SampleFolder/Sample_Template', - label: 'Sample_Template', - type: NodeType.MetadataComponent - }, - { - fullName: 'SampleFolder/Sample_Template2', - label: 'Sample_Template2', - type: NodeType.MetadataComponent - } - ]; - const folder2 = [ - { - fullName: 'SampleFolder2/Main', - label: 'Main', - type: NodeType.MetadataComponent - } - ]; - const folders = [ - { - fullName: 'SampleFolder', - label: 'SampleFolder', - type: NodeType.Folder - }, - { - fullName: 'SampleFolder2', - label: 'SampleFolder2', - type: NodeType.Folder - } - ]; - - loadComponentsStub - .withArgs(username, 'EmailFolder') - .returns(folders.map(n => n.fullName)); - loadComponentsStub - .withArgs(username, 'EmailTemplate', folders[0].fullName) - .returns(folder1.map(n => n.fullName)); - loadComponentsStub - .withArgs(username, 'EmailTemplate', folders[1].fullName) - .returns(folder2.map(n => n.fullName)); - - const metadataObject = getMetadataObject('typeNode1'); - - const testNode = new BrowserNode( - 'EmailTemplate', - NodeType.MetadataType, - undefined, - metadataObject - ); - - const f = await metadataProvider.getChildren(testNode); - compareNodes(f, folders); - - const f1 = await metadataProvider.getChildren(f[0]); - compareNodes(f1, folder1); - - const f2 = await metadataProvider.getChildren(f[1]); - compareNodes(f2, folder2); - }); - - it('should display fields when folder within Custom Objects type is selected', async () => { - const customObjectBrowserNodes = [ - new BrowserNode('Account', NodeType.Folder, 'Account', undefined), - new BrowserNode('Asset', NodeType.Folder, 'Asset', undefined), - new BrowserNode('Book__c', NodeType.Folder, 'Book__c', undefined), - new BrowserNode('Campaign', NodeType.Folder, 'Campaign', undefined), - new BrowserNode( - 'Customer Case', - NodeType.Folder, - 'Customer Case', - undefined - ) - ]; - const customObjectNames = [ - 'Account', - 'Asset', - 'Book__c', - 'Campaign', - 'Customer Case' - ]; - loadComponentsStub - .withArgs(username, 'CustomObject', undefined, false) - .returns(Promise.resolve(customObjectNames)); - - const bookFieldBrowserNodes = [ - new BrowserNode('Id (id)', NodeType.MetadataField, 'Id (id)', undefined), - new BrowserNode( - 'Owner (reference)', - NodeType.MetadataField, - 'Owner (reference)', - undefined - ), - new BrowserNode( - 'IsDeleted (boolean)', - NodeType.MetadataField, - 'IsDeleted (boolean)', - undefined - ), - new BrowserNode( - 'Name (string(80))', - NodeType.MetadataField, - 'Name (string(80))', - undefined - ), - new BrowserNode( - 'CreatedDate (datetime)', - NodeType.MetadataField, - 'CreatedDate (datetime)', - undefined - ), - new BrowserNode( - 'CreatedBy (reference)', - NodeType.MetadataField, - 'CreatedBy (reference)', - undefined - ), - new BrowserNode( - 'LastModifiedDate (datetime)', - NodeType.MetadataField, - 'LastModifiedDate (datetime)', - undefined - ), - new BrowserNode( - 'LastModifiedBy (reference)', - NodeType.MetadataField, - 'LastModifiedBy (reference)', - undefined - ), - new BrowserNode( - 'SystemModstamp (datetime)', - NodeType.MetadataField, - 'SystemModstamp (datetime)', - undefined - ), - new BrowserNode( - 'Price__c (currency)', - NodeType.MetadataField, - 'Price__c (currency)', - undefined - ) - ]; - const bookFieldNames = [ - 'Id (id)', - 'Owner (reference)', - 'IsDeleted (boolean)', - 'Name (string(80))', - 'CreatedDate (datetime)', - 'CreatedBy (reference)', - 'LastModifiedDate (datetime)', - 'LastModifiedBy (reference)', - 'SystemModstamp (datetime)', - 'Price__c (currency)' - ]; - loadComponentsStub - .withArgs(username, 'CustomObject', 'Book__c', false) - .returns(Promise.resolve(bookFieldNames)); - - const customObjectMetadataObject = { - directoryName: 'objects', - inFolder: false, - label: 'Custom Objects', - metaFile: false, - suffix: 'object', - xmlName: 'CustomObject' - }; - - const customObjectNode = new BrowserNode( - 'Custom Objects', - NodeType.MetadataType, - 'CustomObject', - customObjectMetadataObject - ); - - const customObjects = await metadataProvider.getChildren(customObjectNode); - compareNodes(customObjects, customObjectBrowserNodes); - - const fields = await metadataProvider.getChildren(customObjects[2]); - compareNodes(fields, bookFieldBrowserNodes); - }); - - it('should call loadComponents with force refresh', async () => { - loadComponentsStub.returns([]); - const metadataObject = getMetadataObject('typeNode1'); - const node = new BrowserNode( - 'ApexClass', - NodeType.MetadataType, - undefined, - metadataObject - ); - - await metadataProvider.getChildren(node); - expect(loadComponentsStub.getCall(0).args[3]).to.be.false; - - await metadataProvider.refresh(node); - await metadataProvider.getChildren(node); - expect(loadComponentsStub.getCall(1).args[3]).to.be.true; - - await metadataProvider.getChildren(node); - expect(loadComponentsStub.getCall(2).args[3]).to.be.false; - }); -}); - -describe('fetch nodes when org browser (cloud icon) is selected', () => { - const username = 'test-username@test1234.com'; - let metadataProvider: MetadataOutlineProvider; - let loadTypesStub: SinonStub; - - beforeEach(() => { - metadataProvider = new MetadataOutlineProvider(username); - loadTypesStub = stub(TypeUtils.prototype, 'loadTypes'); - }); - - afterEach(() => { - loadTypesStub.restore(); - }); - - it('should throw error if trouble fetching types', async () => { - const orgNode = new BrowserNode(username, NodeType.Org); - loadTypesStub.returns( - Promise.reject( - JSON.stringify({ - name: 'Should throw an error' - }) - ) - ); - try { - await metadataProvider.getChildren(orgNode); - fail('Should have thrown an error getting the children'); - } catch (e) { - expect(e.message).to.equal( - `${nls.localize('error_fetching_metadata')} ${nls.localize( - 'error_org_browser_text' - )}` - ); - } - }); - - it('should call loadTypes with force refresh', async () => { - loadTypesStub.returns([]); - const usernameStub = stub( - MetadataOutlineProvider.prototype, - 'getTargetOrgOrAlias' - ).returns(username); - const node = new BrowserNode(username, NodeType.Org); - - await metadataProvider.getChildren(node); - expect(loadTypesStub.getCall(0).args[0]).to.be.false; - - await metadataProvider.refresh(); - await metadataProvider.getChildren(node); - expect(loadTypesStub.getCall(1).args[0]).to.be.true; - - await metadataProvider.getChildren(node); - expect(loadTypesStub.getCall(2).args[0]).to.be.false; - usernameStub.restore(); - }); -}); - -describe('load fields or components when folder within metadata type is selected', () => { - const username = 'test-username@test1234.com'; - let metadataProvider: MetadataOutlineProvider; - let getComponentsStub: SinonStub; - - beforeEach(() => { - metadataProvider = new MetadataOutlineProvider(username); - getComponentsStub = stub( - MetadataOutlineProvider.prototype, - 'getComponents' - ); - }); - - afterEach(() => { - getComponentsStub.restore(); - }); - - it('should load component nodes when folder within Dashboards type is selected', async () => { - const expected = getExpected( - 'DashboardA', - 'DashboardB', - NodeType.MetadataComponent - ); - const metadataObject = getMetadataObject('Dashboard Folder'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const dashboardFolderNode = new BrowserNode( - 'Dashboard Folder', - NodeType.Folder, - 'DashboardFolder', - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(dashboardFolderNode); - compareNodes(cmpsNodes, expected); - }); - - it('should load component nodes when folder within Documents type is selected', async () => { - const expected = getExpected( - 'DocumentA', - 'DocumentB', - NodeType.MetadataComponent - ); - const metadataObject = getMetadataObject('Document Folder'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const documentFolderNode = new BrowserNode( - 'Document folder', - NodeType.Folder, - 'DocumentFolder', - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(documentFolderNode); - compareNodes(cmpsNodes, expected); - }); - - it('should load component nodes when folder within Email Templates type is selected', async () => { - const expected = getExpected( - 'TemplateA', - 'TemplateB', - NodeType.MetadataComponent - ); - const metadataObject = getMetadataObject('Email Template Folder'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const emailFolderNode = new BrowserNode( - 'Email Template Folder', - NodeType.Folder, - 'EmailFolder', - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(emailFolderNode); - compareNodes(cmpsNodes, expected); - }); - - it('should load component nodes when folder within Reports type is selected', async () => { - const expected = getExpected( - 'ReportA', - 'ReportB', - NodeType.MetadataComponent - ); - const metadataObject = getMetadataObject('Report Folder'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const reportFolderNode = new BrowserNode( - 'Report folder', - NodeType.Folder, - 'ReportFolder', - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(reportFolderNode); - compareNodes(cmpsNodes, expected); - }); - - it('should load field nodes when folder within Custom Objects type is selected', async () => { - const expected = getExpected( - 'Id (id)', - 'IsDeleted (boolean)', - NodeType.MetadataField - ); - const customObjectmetadataObject = getMetadataObject('Custom Objects'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const parentNode = new BrowserNode( - 'Custom Objects', - NodeType.MetadataType, - 'CustomObject', - customObjectmetadataObject - ); - - parentNode.setComponents(['TestAccount', 'TestCleanInfo'], NodeType.Folder); - const childNodes = parentNode.children || []; - const childNode1 = childNodes[0]; - childNode1.setComponents( - ['Id (id)', 'IsDeleted (boolean)'], - NodeType.MetadataField - ); - - const cmpsNodes = await metadataProvider.getChildren(childNode1); - compareNodes(cmpsNodes, expected); - }); - - it('should load component nodes when a non-folder type node is selected', async () => { - const expected = getExpected( - 'cmpNode1', - 'cmpNode2', - NodeType.MetadataComponent - ); - const metadataObject = getMetadataObject('Type Node 1'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const typeNode = new BrowserNode( - 'ApexClass', - NodeType.MetadataType, - undefined, - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(typeNode); - compareNodes(cmpsNodes, expected); - }); -}); - -describe('load folder node when folder-type metadata type is selected', () => { - const username = 'test-username@test1234.com'; - let metadataProvider: MetadataOutlineProvider; - let getComponentsStub: SinonStub; - - beforeEach(() => { - metadataProvider = new MetadataOutlineProvider(username); - getComponentsStub = stub( - MetadataOutlineProvider.prototype, - 'getComponents' - ); - }); - - afterEach(() => { - getComponentsStub.restore(); - }); - - it('should load folder nodes when Custom Objects type node is selected', async () => { - const expected = getExpected( - 'Account', - 'AccountCleanInfo', - NodeType.Folder - ); - const metadataObject = getMetadataObject('Custom Objects'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const customObjectNode = new BrowserNode( - 'Custom Objects', - NodeType.MetadataType, - 'CustomObject', - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(customObjectNode); - compareNodes(cmpsNodes, expected); - }); - - it('should load folder nodes when Dashboards type node is selected', async () => { - const expected = getExpected('Dashboard1', 'Dashboard2', NodeType.Folder); - const metadataObject = getMetadataObject('Dashboards'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const dashboardNode = new BrowserNode( - 'Dashboards', - NodeType.MetadataType, - 'Dashboard', - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(dashboardNode); - compareNodes(cmpsNodes, expected); - }); - - it('should load folder nodes when Documents type node is selected', async () => { - const expected = getExpected('Document1', 'Document2', NodeType.Folder); - const metadataObject = getMetadataObject('Documents'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const documentNode = new BrowserNode( - 'Documents', - NodeType.MetadataType, - 'Document', - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(documentNode); - compareNodes(cmpsNodes, expected); - }); - - it('should load folder nodes when EmailTemplates type node is selected', async () => { - const expected = getExpected('Template1', 'Template2', NodeType.Folder); - const metadataObject = getMetadataObject('Email Templates'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const emailTemplateNode = new BrowserNode( - 'Email Templates', - NodeType.MetadataType, - 'EmailTemplate', - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(emailTemplateNode); - compareNodes(cmpsNodes, expected); - }); - - it('should load folder nodes when Reports type node is selected', async () => { - const expected = getExpected('Report1', 'Report2', NodeType.Folder); - const metadataObject = getMetadataObject('Reports'); - getComponentsStub.returns(expected.map(n => n.fullName)); - const reportNode = new BrowserNode( - 'Reports', - NodeType.MetadataType, - 'Report', - metadataObject - ); - const cmpsNodes = await metadataProvider.getChildren(reportNode); - compareNodes(cmpsNodes, expected); - }); -}); - -// Can't compare nodes w/ deep.equal because of circular parent node reference -function compareNodes(actual: BrowserNode[], expected: any[]) { - expected.forEach((node, index) => { - Object.keys(node).forEach(key => { - expect((actual[index] as any)[key]).to.equal(node[key]); - }); - }); -} - -function getExpected(label1: string, label2: string, nodetype: NodeType) { - return [ - { - label: label1, - fullName: label1, - type: nodetype - }, - { - label: label2, - fullName: label2, - type: nodetype - } - ]; -} - -function getMetadataObject(label1: string) { - return { - xmlName: label1, - directoryName: 'testDirectory', - suffix: 'cls', - inFolder: true, - metaFile: false, - label: label1 - }; -} - -describe('parse errors and throw with appropriate message', () => { - it('should return default message when given a dirty json', async () => { - const error = `< Warning: sfdx-cli update available + - ${JSON.stringify({ status: 1, name: 'RetrievingError' })}`; - const errorResponse = parseErrors(error); - expect(errorResponse.message).to.equal( - `${nls.localize('error_fetching_metadata')} ${nls.localize( - 'error_org_browser_text' - )}` - ); - }); - - it('should return authorization token message when throwing RefreshTokenAuthError', async () => { - const error = JSON.stringify({ status: 1, name: 'RefreshTokenAuthError' }); - const errorResponse = parseErrors(error); - expect(errorResponse.message).to.equal( - `${nls.localize('error_auth_token')} ${nls.localize( - 'error_org_browser_text' - )}` - ); - }); - - it('should return no org found message when throwing NoOrgFound error', async () => { - const error = JSON.stringify({ status: 1, name: 'NoOrgFound' }); - const errorResponse = parseErrors(error); - expect(errorResponse.message).to.equal( - `${nls.localize('error_no_org_found')} ${nls.localize( - 'error_org_browser_text' - )}` - ); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataType.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataType.test.ts deleted file mode 100644 index a9cb9781ba..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/orgBrowser/metadataType.test.ts +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { - CommandOutput, - projectPaths -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import { SinonStub, stub } from 'sinon'; -import { isNullOrUndefined } from 'util'; -import { DescribeMetadataExecutor } from '../../../src/commands'; -import { TypeUtils } from '../../../src/orgBrowser'; -import { OrgAuthInfo, workspaceUtils } from '../../../src/util'; - -// tslint:disable:no-unused-expression -describe('get metadata types folder', () => { - let getTargetOrgStub: SinonStub; - let getUsernameStub: SinonStub; - let metadataFolderStub: SinonStub; - const rootWorkspacePath = workspaceUtils.getRootWorkspacePath(); - const metadataDirectoryPath = - 'test/path/.sfdx/orgs/test-username1@example.com/metadata'; - const typeUtil = new TypeUtils(); - beforeEach(() => { - getTargetOrgStub = stub(OrgAuthInfo, 'getTargetOrgOrAlias'); - getUsernameStub = stub(OrgAuthInfo, 'getUsername'); - metadataFolderStub = stub(projectPaths, 'metadataFolder').returns( - metadataDirectoryPath - ); - }); - afterEach(() => { - getTargetOrgStub.restore(); - getUsernameStub.restore(); - }); - - it('should return the path for a given username', async () => { - expect(await typeUtil.getTypesFolder()).to.equal(metadataDirectoryPath); - }); -}); - -describe('build metadata types list', () => { - let readFileStub: SinonStub; - const typeUtil = new TypeUtils(); - const fileData = JSON.stringify({ - status: 0, - result: { - metadataObjects: [ - { suffix: 'fakeName2', xmlName: 'FakeName2' }, - { suffix: 'fakeName1', xmlName: 'FakeName1' } - ] - } - }); - beforeEach(() => { - readFileStub = stub(fs, 'readFileSync'); - }); - afterEach(() => { - readFileStub.restore(); - }); - - it('should return a sorted list of xmlNames when given a list of metadata types', async () => { - readFileStub.returns(fileData); - const types = typeUtil.buildTypesList(fileData, undefined); - if (!isNullOrUndefined(types)) { - expect(types[0].xmlName).to.equal('FakeName1'); - expect(types[1].xmlName).to.equal('FakeName2'); - } - }); - - it('should return a sorted list of xmlNames when given the metadata types result file path', async () => { - const filePath = '/test/metadata/metadataTypes.json'; - readFileStub.returns(fileData); - - const types = typeUtil.buildTypesList(undefined, filePath); - if (!isNullOrUndefined(types)) { - expect(types[0].xmlName).to.equal('FakeName1'); - expect(types[1].xmlName).to.equal('FakeName2'); - expect(readFileStub.called).to.equal(true); - } - }); - - it('should filter out blocklisted metadata types', async () => { - const data = JSON.stringify({ - status: 0, - result: { - metadataObjects: Array.from(TypeUtils.UNSUPPORTED_TYPES).map( - xmlName => ({ xmlName }) - ) - } - }); - const types = await typeUtil.buildTypesList(data, undefined); - expect(types).to.be.empty; - }); -}); - -describe('load metadata types data', () => { - let readFileStub: SinonStub; - let getUsernameStub: SinonStub; - let fileExistsStub: SinonStub; - let buildTypesStub: SinonStub; - let execStub: SinonStub; - let cmdOutputStub: SinonStub; - let writeFileStub: SinonStub; - let getTypesFolderStub: SinonStub; - const typeUtil = new TypeUtils(); - let filePath = '/test/metadata/'; - beforeEach(() => { - readFileStub = stub(fs, 'readFileSync'); - getUsernameStub = stub(OrgAuthInfo, 'getUsername').returns(undefined); - fileExistsStub = stub(fs, 'existsSync'); - buildTypesStub = stub(TypeUtils.prototype, 'buildTypesList'); - execStub = stub(DescribeMetadataExecutor.prototype, 'execute'); - cmdOutputStub = stub(CommandOutput.prototype, 'getCmdResult'); - writeFileStub = stub(fs, 'writeFileSync'); - getTypesFolderStub = stub(TypeUtils.prototype, 'getTypesFolder').returns( - filePath - ); - }); - afterEach(() => { - readFileStub.restore(); - getUsernameStub.restore(); - fileExistsStub.restore(); - buildTypesStub.restore(); - execStub.restore(); - cmdOutputStub.restore(); - writeFileStub.restore(); - getTypesFolderStub.restore(); - }); - - it('should load metadata types through cli command if file does not exist', async () => { - fileExistsStub.returns(false); - const fileData = JSON.stringify({ - status: 0, - result: { - metadataObjects: [ - { suffix: 'fakeName2', xmlName: 'FakeName2' }, - { suffix: 'fakeName1', xmlName: 'FakeName1' } - ] - } - }); - cmdOutputStub.returns(fileData); - const components = await typeUtil.loadTypes(); - expect(cmdOutputStub.called).to.equal(true); - expect(buildTypesStub.calledWith(fileData, undefined)).to.be.true; - }); - - it('should load metadata types from file if file exists', async () => { - fileExistsStub.returns(true); - filePath = path.join(filePath, 'metadataTypes.json'); - const components = await typeUtil.loadTypes(); - expect(cmdOutputStub.called).to.equal(false); - expect(buildTypesStub.calledWith(undefined, filePath)).to.be.true; - }); - - it('should load metadata types through cli if file exists and force is set to true', async () => { - fileExistsStub.returns(true); - await typeUtil.loadTypes(true); - expect(cmdOutputStub.calledOnce).to.be.true; - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/orgPicker/orgList.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/orgPicker/orgList.test.ts deleted file mode 100644 index 77fe890067..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/orgPicker/orgList.test.ts +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { AuthInfo, OrgAuthorization, StateAggregator } from '@salesforce/core'; -import { ConfigUtil } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { nls } from '../../../src/messages'; -import { OrgList } from '../../../src/orgPicker'; -import * as util from '../../../src/util'; -import { OrgAuthInfo } from '../../../src/util'; - -const AN_ALIAS = 'anAlias'; -const sandbox = createSandbox(); - -describe('orgList Tests', () => { - afterEach(() => { - sandbox.restore(); - }); - - describe('getAuthInfoObjects', () => { - let getAuthInfoListAllAuthorizationsStub: SinonStub; - - beforeEach(() => { - getAuthInfoListAllAuthorizationsStub = sandbox.stub( - AuthInfo, - 'listAllAuthorizations' - ); - }); - - it('should return a list of FileInfo objects when given an array of file names', async () => { - // Arrange - const authFilesArray = [ - { username: 'test-username1@example.com' }, - { username: 'test-username2@example.com' } - ]; - getAuthInfoListAllAuthorizationsStub.resolves(authFilesArray); - const orgList = new OrgList(); - - // Act - const orgAuthorizations = await orgList.getOrgAuthorizations(); - - // Assert - expect(orgAuthorizations.length).to.equal(2); - - expect(orgAuthorizations[0].username).to.equal( - 'test-username1@example.com' - ); - expect(orgAuthorizations[1].username).to.equal( - 'test-username2@example.com' - ); - }); - - it('should return null when no auth files are present', async () => { - const orgList = new OrgList(); - getAuthInfoListAllAuthorizationsStub.resolves(null); - const orgAuthorizations = await orgList.getOrgAuthorizations(); - expect(orgAuthorizations).to.equal(null); - }); - - describe('Filter Authorization Info', async () => { - let getDevHubUsernameStub: SinonStub; - let getUsernameStub: SinonStub; - let stateAggregatorCreateStub: SinonStub; - let getAllStub: SinonStub; - let getAllAliasesForStub: SinonStub; - let getAuthFieldsForStub: SinonStub; - const orgList = new OrgList(); - - let fakeStateAggregator: any; - - beforeEach(() => { - getDevHubUsernameStub = sandbox.stub(OrgAuthInfo, 'getDevHubUsername'); - getUsernameStub = sandbox.stub(util.OrgAuthInfo, 'getUsername'); - - getAllStub = sandbox.stub(); - fakeStateAggregator = { - aliases: { - getAll: getAllStub - } - }; - stateAggregatorCreateStub = sandbox - .stub(StateAggregator, 'create') - .resolves(fakeStateAggregator); - - getAllAliasesForStub = sandbox.stub(ConfigUtil, 'getAllAliasesFor'); - getAuthFieldsForStub = sandbox.stub( - OrgList.prototype, - 'getAuthFieldsFor' - ); - }); - - function getFakeOrgAuthorization( - orgAuth?: Partial - ): OrgAuthorization { - const fakeOrgAuth: OrgAuthorization = { - orgId: orgAuth?.orgId ?? '000', - username: orgAuth?.username ?? 'test-username1@example.com', - oauthMethod: orgAuth?.oauthMethod ?? 'unknown', - aliases: orgAuth?.aliases ?? [], - configs: orgAuth?.configs ?? [], - isScratchOrg: orgAuth?.isScratchOrg ?? undefined, - isDevHub: orgAuth?.isDevHub ?? undefined, - isSandbox: orgAuth?.isSandbox ?? undefined, - instanceUrl: orgAuth?.instanceUrl ?? undefined, - accessToken: orgAuth?.accessToken ?? undefined, - error: orgAuth?.error ?? undefined, - isExpired: orgAuth?.isExpired ?? false - }; - return fakeOrgAuth; - } - - const dummyOrgAuth1 = getFakeOrgAuthorization({ - orgId: '000', - username: 'test-username1@example.com' - }); - const dummyOrgAuth2 = getFakeOrgAuthorization({ - orgId: '111', - username: 'test-username2@example.com' - }); - - const dummyScratchOrgAuth1 = getFakeOrgAuthorization({ - orgId: '000', - username: 'test-scratchorg1@example.com' - }); - const dummyScratchOrgAuth2 = getFakeOrgAuthorization({ - orgId: '111', - username: 'test-scratchorg2@example.com' - }); - const dummyScratchOrgAuthWithError = getFakeOrgAuthorization({ - orgId: '222', - username: 'test-scratchorg3@example.com', - error: - 'No authorization information found for test-scratchorg3@example.com.' - }); - - const dummyDevHubUsername1 = 'test-devhub1@example.com'; - const dummyDevHubUsername2 = 'test-devhub2@example.com'; - - it('should filter the list for users other than admins when scratchadminusername field is present', async () => { - // Arrange - const authInfoObjects: OrgAuthorization[] = [ - dummyOrgAuth1, - dummyOrgAuth2 - ]; - getAuthFieldsForStub - .withArgs(dummyOrgAuth1.username) - .returns({ scratchAdminUsername: 'nonadmin@user.com' }); - getDevHubUsernameStub.resolves(null); - getAllStub.returns([]); - - // Act - const authList = await orgList.filterAuthInfo(authInfoObjects); - - // Assert - expect(authList[0]).to.equal('test-username2@example.com'); - }); - - it('should filter the list to only show scratch orgs associated with current target dev hub without an alias', async () => { - const authInfoObjects: OrgAuthorization[] = [ - dummyScratchOrgAuth1, - dummyScratchOrgAuth2 - ]; - getAuthFieldsForStub.withArgs(dummyScratchOrgAuth1.username).returns({ - devHubUsername: dummyDevHubUsername1 - }); - getAuthFieldsForStub - .withArgs(dummyScratchOrgAuth2.username) - .returns({ devHubUsername: dummyDevHubUsername2 }); - getDevHubUsernameStub.resolves(dummyDevHubUsername1); - getUsernameStub.resolves(dummyDevHubUsername1); - getAllStub.returns([]); - - const authList = await orgList.filterAuthInfo(authInfoObjects); - - expect(authList[0]).to.equal('test-scratchorg1@example.com'); - }); - - it('should filter the list to only show scratch orgs associated with current target dev hub', async () => { - const authInfoObjects: OrgAuthorization[] = [ - dummyScratchOrgAuth1, - dummyScratchOrgAuth2 - ]; - getAuthFieldsForStub.withArgs(dummyScratchOrgAuth1.username).returns({ - devHubUsername: dummyDevHubUsername1 - }); - getAuthFieldsForStub - .withArgs(dummyScratchOrgAuth2.username) - .returns({ devHubUsername: dummyDevHubUsername2 }); - getDevHubUsernameStub.returns(dummyDevHubUsername1); - getUsernameStub.resolves(dummyDevHubUsername1); - getAllStub.returns([]); - - const authList = await orgList.filterAuthInfo(authInfoObjects); - expect(authList[0]).to.equal(dummyScratchOrgAuth1.username); - }); - - it('should filter the list to remove org authorizations that have errors', async () => { - const authInfoObjectsWithOneError: OrgAuthorization[] = [ - dummyScratchOrgAuth1, - dummyScratchOrgAuthWithError - ]; - getAuthFieldsForStub - .withArgs(authInfoObjectsWithOneError[0].username) - .returns({ - devHubUsername: dummyDevHubUsername1 - }); - getAllAliasesForStub - .withArgs(authInfoObjectsWithOneError[0].username) - .returns([AN_ALIAS]); - getDevHubUsernameStub.resolves(dummyDevHubUsername1); - - const authList = await orgList.filterAuthInfo( - authInfoObjectsWithOneError - ); - expect(getDevHubUsernameStub.calledOnce).to.equal(true); - expect(authList.length).to.equal(1); - expect(authList[0].includes(AN_ALIAS)).to.equal(true); - expect(authList[0].includes(dummyScratchOrgAuth1.username)).to.equal( - true - ); - }); - - it('should display alias with username when alias is available', async () => { - // Arrange - getDevHubUsernameStub.resolves(null); - const authInfoObjects: OrgAuthorization[] = [ - dummyOrgAuth1, - dummyOrgAuth2 - ]; - getAllStub.withArgs(dummyOrgAuth1.username).returns(['alias1']); - getAllAliasesForStub - .withArgs(dummyOrgAuth1.username) - .returns(['alias1']); - getAuthFieldsForStub.withArgs(authInfoObjects[0].username).returns({}); - - // Act - const authList = await orgList.filterAuthInfo(authInfoObjects); - - // Assert - expect(authList[0]).to.equal('alias1 - test-username1@example.com'); - }); - - it('should flag the org as expired if expiration date has passed', async () => { - const oneDayMillis = 60 * 60 * 24 * 1000; - const today = new Date(); - const yesterday = new Date(today.getTime() - oneDayMillis); - const tomorrow = new Date(today.getTime() + oneDayMillis); - - const authInfoObjects: OrgAuthorization[] = [ - getFakeOrgAuthorization({ - orgId: '000', - username: 'test-scratchorg-today@example.com' - }), - getFakeOrgAuthorization({ - orgId: '111', - username: 'test-scratchorg-yesterday@example.com' - }), - getFakeOrgAuthorization({ - orgId: '222', - username: 'test-scratchorg-tomorrow@example.com' - }) - ]; - - getAuthFieldsForStub - .withArgs('test-scratchorg-today@example.com') - .returns({ - devHubUsername: dummyDevHubUsername1, - expirationDate: today.toISOString().split('T')[0] - }); - getAuthFieldsForStub - .withArgs('test-scratchorg-yesterday@example.com') - .returns({ - devHubUsername: dummyDevHubUsername1, - expirationDate: yesterday.toISOString().split('T')[0] - }); - getAuthFieldsForStub - .withArgs('test-scratchorg-tomorrow@example.com') - .returns({ - devHubUsername: dummyDevHubUsername1, - expirationDate: tomorrow.toISOString().split('T')[0] - }); - getDevHubUsernameStub.resolves(dummyDevHubUsername1); - getUsernameStub.resolves(dummyDevHubUsername1); - getAllStub.returns([]); - - const authList = await orgList.filterAuthInfo(authInfoObjects); - - expect(authList[0]).to.equal( - 'test-scratchorg-today@example.com - ' + - nls.localize('org_expired') + - ' ' + - String.fromCodePoint(0x274c) - ); - expect(authList[1]).to.equal( - 'test-scratchorg-yesterday@example.com - ' + - nls.localize('org_expired') + - ' ' + - String.fromCodePoint(0x274c) - ); - expect(authList[2]).to.equal('test-scratchorg-tomorrow@example.com'); - }); - }); - describe('Set Default Org', () => { - let orgListStub: SinonStub; - let quickPickStub: SinonStub; - let executeCommandStub: SinonStub; - const orgsList = [ - 'alias - test-username1@example.com', - 'test-username2@example.com' - ]; - const orgList = new OrgList(); - - beforeEach(() => { - orgListStub = sandbox.stub(OrgList.prototype, 'updateOrgList'); - quickPickStub = sandbox.stub(vscode.window, 'showQuickPick'); - executeCommandStub = sandbox.stub(vscode.commands, 'executeCommand'); - }); - - it('should return Cancel if selection is undefined', async () => { - orgListStub.returns(orgsList); - quickPickStub.returns(undefined); - const response = await orgList.setDefaultOrg(); - expect(response.type).to.equal('CANCEL'); - }); - - it('should return Continue and call org:login:web command if SFDX: Authorize an Org is selected', async () => { - orgListStub.returns(orgsList); - quickPickStub.returns( - '$(plus) ' + nls.localize('org_login_web_authorize_org_text') - ); - const response = await orgList.setDefaultOrg(); - expect(response.type).to.equal('CONTINUE'); - expect(executeCommandStub.calledWith('sf.org.login.web')).to.equal( - true - ); - }); - - it('should return Continue and call org:create:scratch command if SFDX: Create a Default Scratch Org is selected', async () => { - orgListStub.returns(orgsList); - quickPickStub.returns( - '$(plus) ' + nls.localize('org_create_default_scratch_org_text') - ); - const response = await orgList.setDefaultOrg(); - expect(response.type).to.equal('CONTINUE'); - expect(executeCommandStub.calledWith('sf.org.create')).to.equal(true); - }); - - it('should return Continue and call force:auth:dev:hub command if SFDX: Authorize a Dev Hub is selected', async () => { - orgListStub.returns(orgsList); - quickPickStub.returns( - '$(plus) ' + nls.localize('org_login_web_authorize_dev_hub_text') - ); - const response = await orgList.setDefaultOrg(); - expect(response.type).to.equal('CONTINUE'); - expect( - executeCommandStub.calledWith('sf.org.login.web.dev.hub') - ).to.equal(true); - }); - - it('should return Continue and call sf:org:login:accessToken command if SFDX: Authorize an Org using Session ID', async () => { - orgListStub.returns(orgsList); - quickPickStub.returns( - '$(plus) ' + nls.localize('org_login_access_token_text') - ); - const response = await orgList.setDefaultOrg(); - expect(response.type).to.equal('CONTINUE'); - expect( - executeCommandStub.calledWith('sf.org.login.access.token') - ).to.equal(true); - }); - - it('should return Continue and call org:list:clean command if SFDX: Remove Deleted and Expired Orgs is selected', async () => { - orgListStub.returns(orgsList); - quickPickStub.returns('$(plus) ' + nls.localize('org_list_clean_text')); - const response = await orgList.setDefaultOrg(); - expect(response.type).to.equal('CONTINUE'); - expect(executeCommandStub.calledWith('sf.org.list.clean')).to.equal( - true - ); - }); - - it('should return Continue and call config:set command if a username/alias is selected', async () => { - orgListStub.returns(orgsList); - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands - quickPickStub.returns('$(plus)' + orgsList[0].split(' ', 1)); - const response = await orgList.setDefaultOrg(); - expect(response.type).to.equal('CONTINUE'); - expect(executeCommandStub.calledWith('sf.config.set')).to.equal(true); - }); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/predicates/index.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/predicates/index.test.ts deleted file mode 100644 index 63416d9f7b..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/predicates/index.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import { SinonStub, stub } from 'sinon'; -import { workspace } from 'vscode'; -import { SFDX_PROJECT_FILE } from '../../../src/constants'; -import { nls } from '../../../src/messages'; -import { isSalesforceProjectOpened } from '../../../src/predicates'; -import { workspaceUtils } from '../../../src/util'; - -// tslint:disable:no-unused-expression -describe('SFDX Project predicate', () => { - let mExistsSync: SinonStub; - - beforeEach(() => { - mExistsSync = stub(fs, 'existsSync'); - mExistsSync.resetBehavior(); - }); - - afterEach(() => mExistsSync.restore()); - - it('Should fail predicate with message when sfdx-project.json is missing', () => { - mExistsSync - .withArgs( - path.join(workspaceUtils.getRootWorkspacePath(), SFDX_PROJECT_FILE) - ) - .returns(false); - - const response = isSalesforceProjectOpened.apply(workspace); - expect(response.result).to.be.false; - expect(response.message).to.eql( - nls.localize('predicates_no_salesforce_project_found_text') - ); - }); - - it('Should pass predicate when sfdx-project.json is present', () => { - mExistsSync - .withArgs( - path.join(workspaceUtils.getRootWorkspacePath(), SFDX_PROJECT_FILE) - ) - .returns(true); - - const response = isSalesforceProjectOpened.apply(workspace); - expect(response.result).to.be.true; - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/salesforceProject/salesforcePackageDirectories.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/salesforceProject/salesforcePackageDirectories.test.ts deleted file mode 100644 index e1e21286ed..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/salesforceProject/salesforcePackageDirectories.test.ts +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import * as path from 'path'; -import { SinonStub, stub } from 'sinon'; -import { - SalesforcePackageDirectories, - SalesforceProjectConfig -} from '../../../src/salesforceProject'; -import { stubRootWorkspace } from '../util/rootWorkspace.test-util'; - -const PROJECT_PATH = path.join('sfdx', 'project', 'path'); - -/* tslint:disable:no-unused-expression */ -describe('Salesforce Package Directories', () => { - describe('getPackageDirectoryPaths', () => { - let salesforceProjectConfigStub: SinonStub; - afterEach(() => { - salesforceProjectConfigStub.restore(); - }); - it('should return one package directory', async () => { - salesforceProjectConfigStub = stub( - SalesforceProjectConfig, - 'getValue' - ).returns([{ path: 'force-app' }]); - expect( - await SalesforcePackageDirectories.getPackageDirectoryPaths() - ).to.eql(['force-app']); - }); - - it('should return multiple package directories with default as first', async () => { - salesforceProjectConfigStub = stub( - SalesforceProjectConfig, - 'getValue' - ).returns([ - { path: 'package1' }, - { path: 'package2' }, - { path: 'package3', default: true } - ]); - expect( - await SalesforcePackageDirectories.getPackageDirectoryPaths() - ).to.eql(['package3', 'package1', 'package2']); - }); - - it('should trim whitespace and remove leading slashes from package directories', async () => { - salesforceProjectConfigStub = stub( - SalesforceProjectConfig, - 'getValue' - ).returns([ - { path: ' package1 ' }, - { path: `${path.sep}package2` }, - { path: path.join('package', 'three') } - ]); - expect( - await SalesforcePackageDirectories.getPackageDirectoryPaths() - ).to.eql(['package1', 'package2', path.join('package', 'three')]); - }); - - it('should throw an error if no package directories are found in the sfdx-project.json', async () => { - salesforceProjectConfigStub = stub( - SalesforceProjectConfig, - 'getValue' - ).returns(undefined); - let errorWasThrown = false; - try { - await SalesforcePackageDirectories.getPackageDirectoryPaths(); - } catch (error) { - errorWasThrown = true; - expect(error.name).to.equal('NoPackageDirectoriesFound'); - } finally { - expect(errorWasThrown).to.be.true; - } - }); - - it('should throw an error if packageDirectories does not specify any paths', async () => { - salesforceProjectConfigStub = stub( - SalesforceProjectConfig, - 'getValue' - ).returns([]); - let errorWasThrown = false; - try { - await SalesforcePackageDirectories.getPackageDirectoryPaths(); - } catch (error) { - errorWasThrown = true; - expect(error.name).to.equal('NoPackageDirectoryPathsFound'); - } finally { - expect(errorWasThrown).to.be.true; - } - }); - }); - - describe('getPackageDirectoryFullPaths', () => { - let workspaceStub: SinonStub; - - beforeEach(() => { - workspaceStub = stubRootWorkspace(PROJECT_PATH); - }); - - afterEach(() => { - workspaceStub!.restore(); - }); - - it('should append the project path to the package directory path', async () => { - const getPackageDirectoryPathsStub = stub( - SalesforcePackageDirectories, - 'getPackageDirectoryPaths' - ).returns(['package1', 'package2']); - const fullPaths = - await SalesforcePackageDirectories.getPackageDirectoryFullPaths(); - expect(fullPaths.length).to.equal(2); - expect(fullPaths[0]).to.equal(path.join(PROJECT_PATH, 'package1')); - expect(fullPaths[1]).to.equal(path.join(PROJECT_PATH, 'package2')); - getPackageDirectoryPathsStub.restore(); - }); - }); - - describe('isInPackageDirectory', () => { - let getPackageDirectoryFullPathsStub: SinonStub; - afterEach(() => { - getPackageDirectoryFullPathsStub.restore(); - }); - it('should return true if the filePath is the path to a package directory', async () => { - const packagePath = path.join(PROJECT_PATH, 'force-app'); - getPackageDirectoryFullPathsStub = stub( - SalesforcePackageDirectories, - 'getPackageDirectoryFullPaths' - ).returns([packagePath]); - - expect( - await SalesforcePackageDirectories.isInPackageDirectory(packagePath) - ).to.be.true; - }); - - it('should return true if the filePath is one of several package directories', async () => { - const packagePath1 = path.join(PROJECT_PATH, 'force-app'); - const packagePath2 = path.join(PROJECT_PATH, 'another-app'); - const packagePath3 = path.join(PROJECT_PATH, 'a-third-app'); - getPackageDirectoryFullPathsStub = stub( - SalesforcePackageDirectories, - 'getPackageDirectoryFullPaths' - ).returns([packagePath1, packagePath2, packagePath3]); - const filePath = path.join( - packagePath2, - 'main', - 'default', - 'classes', - 'TestClass.cls' - ); - expect(await SalesforcePackageDirectories.isInPackageDirectory(filePath)) - .to.be.true; - }); - - it('should return false if the filePath is not in a package directory', async () => { - const filePath = path.join(PROJECT_PATH, '.forceignore'); - getPackageDirectoryFullPathsStub = stub( - SalesforcePackageDirectories, - 'getPackageDirectoryFullPaths' - ).returns([path.join(PROJECT_PATH, 'force-app')]); - expect(await SalesforcePackageDirectories.isInPackageDirectory(filePath)) - .to.be.false; - }); - }); - - describe('getDefaultPackageDir', () => { - let salesforceProjectConfigStub: SinonStub; - afterEach(() => { - salesforceProjectConfigStub.restore(); - }); - - it('should return the default directory path when it is defined', async () => { - salesforceProjectConfigStub = stub( - SalesforceProjectConfig, - 'getValue' - ).returns([ - { path: 'package1' }, - { path: 'package2' }, - { path: 'package3', default: true } - ]); - expect( - await SalesforcePackageDirectories.getDefaultPackageDir() - ).to.equal('package3'); - }); - - it('should return the first listed directory path when a default directory is not defined', async () => { - salesforceProjectConfigStub = stub( - SalesforceProjectConfig, - 'getValue' - ).returns([ - { path: 'package1' }, - { path: 'package2' }, - { path: 'package3' } - ]); - expect( - await SalesforcePackageDirectories.getDefaultPackageDir() - ).to.equal('package1'); - }); - - it('should return undefined when no project directories are defined', async () => { - salesforceProjectConfigStub = stub( - SalesforceProjectConfig, - 'getValue' - ).returns([]); - expect(await SalesforcePackageDirectories.getDefaultPackageDir()).to.be - .undefined; - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/settings/pushOrDeployOnSave.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/settings/pushOrDeployOnSave.test.ts deleted file mode 100644 index b4750c72ed..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/settings/pushOrDeployOnSave.test.ts +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { channelService } from '../../../src/channels'; -import { workspaceContextUtils } from '../../../src/context'; -import { nls } from '../../../src/messages'; -import { notificationService } from '../../../src/notifications'; -import { SalesforcePackageDirectories } from '../../../src/salesforceProject'; -import { - DeployQueue, - fileShouldNotBeDeployed, - pathIsInPackageDirectory -} from '../../../src/settings'; -import { SalesforceCoreSettings } from '../../../src/settings/salesforceCoreSettings'; -import { telemetryService } from '../../../src/telemetry'; - -/* tslint:disable:no-unused-expression */ - -const sandbox = createSandbox(); -const OrgType = workspaceContextUtils.OrgType; - -describe('Push or Deploy on Save', () => { - let appendLineStub: SinonStub; - let showErrorMessageStub: SinonStub; - beforeEach(() => { - appendLineStub = sandbox.stub(channelService, 'appendLine'); - showErrorMessageStub = sandbox.stub( - notificationService, - 'showErrorMessage' - ); - }); - - afterEach(() => sandbox.restore()); - - describe('pathIsInPackageDirectory', () => { - it('should return true if the path is in a package directory', async () => { - sandbox - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .returns(true); - const isInPackageDirectory = await pathIsInPackageDirectory('test-path'); - expect(isInPackageDirectory).to.be.true; - expect(appendLineStub.called).to.be.false; - expect(showErrorMessageStub.called).to.be.false; - }); - - it('should return false if the path is not in a package directory', async () => { - sandbox - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .returns(false); - const isInPackageDirectory = await pathIsInPackageDirectory('test-path'); - expect(isInPackageDirectory).to.be.false; - expect(appendLineStub.called).to.be.false; - expect(showErrorMessageStub.called).to.be.false; - }); - - it('should throw an error if no package directories are found in the sfdx-project.json', async () => { - const error = new Error(); - error.name = 'NoPackageDirectoriesFound'; - sandbox - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .throws(error); - let errorWasThrown = false; - - try { - await pathIsInPackageDirectory('test-path'); - } catch (e) { - errorWasThrown = true; - expect(e.message).to.equal( - nls.localize('error_no_package_directories_found_on_setup_text') - ); - } finally { - expect(errorWasThrown).to.be.true; - expect(appendLineStub.called).to.be.true; - expect(showErrorMessageStub.called).to.be.true; - } - }); - - it('should throw an error if packageDirectories does not specify any paths', async () => { - const error = new Error(); - error.name = 'NoPackageDirectoryPathsFound'; - sandbox - .stub(SalesforcePackageDirectories, 'isInPackageDirectory') - .throws(error); - let errorWasThrown = false; - try { - await pathIsInPackageDirectory('test-path'); - } catch (err) { - errorWasThrown = true; - expect(err.message).to.equal( - nls.localize('error_no_package_directories_paths_found_text') - ); - } finally { - expect(errorWasThrown).to.be.true; - expect(appendLineStub.called).to.be.true; - expect(showErrorMessageStub.called).to.be.true; - } - }); - }); - - describe('DeployQueue', () => { - let getWorkspaceOrgTypeStub: SinonStub; - let executeCommandStub: SinonStub; - - beforeEach(() => { - DeployQueue.reset(); - getWorkspaceOrgTypeStub = sandbox.stub( - workspaceContextUtils, - 'getWorkspaceOrgType' - ); - executeCommandStub = sandbox.stub(vscode.commands, 'executeCommand'); - sandbox - .stub(SalesforceCoreSettings.prototype, 'getPreferDeployOnSaveEnabled') - .returns(false); - }); - - it('should not deploy if nothing has been queued', async () => { - await DeployQueue.get().unlock(); - expect(executeCommandStub.notCalled).to.be.true; - }); - - it('should stop additional files from deploying until queue is unlocked', async () => { - getWorkspaceOrgTypeStub.resolves(OrgType.NonSourceTracked); - const telemetryStub = sandbox.stub(telemetryService, 'sendEventData'); - const queue = DeployQueue.get(); - - // start a deploy from an enqueue and lock deploys - expect(executeCommandStub.notCalled).to.be.true; - let uris = [vscode.Uri.file('/sample')]; - await queue.enqueue(uris[0]); - expect(executeCommandStub.calledOnce).to.be.true; - expect( - telemetryStub.calledWith( - 'deployOnSave', - { deployType: 'Deploy' }, - { documentsToDeploy: 1, waitTimeForLastDeploy: 0 } - ) - ).to.be.true; - - // try enquing more files and deploying - uris = [vscode.Uri.file('/sample2'), vscode.Uri.file('/sample3')]; - await queue.enqueue(uris[0]); - await queue.enqueue(uris[1]); - expect(executeCommandStub.calledTwice).to.be.false; - expect(telemetryStub.calledTwice).to.be.false; - - // signal to the queue we're done and deploy anything that has been queued while locked - await queue.unlock(); - expect(executeCommandStub.callCount).to.equal(3); - expect(executeCommandStub.getCall(1).args[1]).to.eql([uris[0]]); - - const telemArgs = telemetryStub.getCall(1).args; - expect(telemArgs[0]).to.equal('deployOnSave'); - expect(telemArgs[1]).to.deep.equal({ deployType: 'Deploy' }); - expect(telemArgs[2]['documentsToDeploy']).to.equal(1); - expect(telemArgs[2]['waitTimeForLastDeploy'] > 0).to.be.false; - }); - - it('should display an error to the user when the target-org org info cannot be found', async () => { - const namedOrgNotFoundError = new Error(); - namedOrgNotFoundError.name = 'NamedOrgNotFound'; - getWorkspaceOrgTypeStub.throws(namedOrgNotFoundError); - - await DeployQueue.get().enqueue(vscode.Uri.file('/sample')); - - const error = nls.localize('error_fetching_auth_info_text'); - expect(showErrorMessageStub.calledOnce).to.be.true; - expect(showErrorMessageStub.getCall(0).args[0]).to.equal(error); - expect(appendLineStub.calledOnce).to.be.true; - expect(appendLineStub.getCall(0).args[0]).to.equal(error); - }); - - it('should display an error to the user when no target-org is set', async () => { - const noTargetOrgSetError = new Error(); - noTargetOrgSetError.name = 'NoTargetOrgSet'; - getWorkspaceOrgTypeStub.throws(noTargetOrgSetError); - - await DeployQueue.get().enqueue(vscode.Uri.file('/sample')); - - const error = nls.localize('error_push_or_deploy_on_save_no_target_org'); - expect(showErrorMessageStub.calledOnce).to.be.true; - expect(showErrorMessageStub.getCall(0).args[0]).to.equal(error); - expect(appendLineStub.calledOnce).to.be.true; - expect(appendLineStub.getCall(0).args[0]).to.equal(error); - }); - - it('should call project:deploy:start when getPushOrDeployOnSaveIgnoreConflicts is false', async () => { - getWorkspaceOrgTypeStub.resolves(OrgType.SourceTracked); - sandbox - .stub( - SalesforceCoreSettings.prototype, - 'getPushOrDeployOnSaveIgnoreConflicts' - ) - .returns(false); - - await DeployQueue.get().enqueue(vscode.Uri.file('/sample')); - - expect(executeCommandStub.calledOnce).to.be.true; - expect(executeCommandStub.getCall(0).args[0]).to.eql( - 'sf.project.deploy.start' - ); - expect(showErrorMessageStub.calledOnce).to.be.false; - expect(appendLineStub.calledOnce).to.be.false; - }); - - it('should call project:deploy:start --ignore-conflicts when getPushOrDeployOnSaveIgnoreConflicts is true', async () => { - getWorkspaceOrgTypeStub.resolves(OrgType.SourceTracked); - sandbox - .stub( - SalesforceCoreSettings.prototype, - 'getPushOrDeployOnSaveIgnoreConflicts' - ) - .returns(true); - - await DeployQueue.get().enqueue(vscode.Uri.file('/sample')); - - expect(executeCommandStub.calledOnce).to.be.true; - expect(executeCommandStub.getCall(0).args[0]).to.eql( - 'sf.project.deploy.start.ignore.conflicts' - ); - expect(showErrorMessageStub.calledOnce).to.be.false; - expect(appendLineStub.calledOnce).to.be.false; - }); - - it('should call deploy on multiple paths', async () => { - getWorkspaceOrgTypeStub.resolves(OrgType.NonSourceTracked); - - await DeployQueue.get().enqueue(vscode.Uri.file('/sample')); - - expect(executeCommandStub.calledOnce).to.be.true; - expect(executeCommandStub.getCall(0).args[0]).to.eql( - 'sf.deploy.multiple.source.paths' - ); - expect(showErrorMessageStub.calledOnce).to.be.false; - expect(appendLineStub.calledOnce).to.be.false; - }); - }); - - describe('fileShouldNotBeDeployed', () => { - // verify which types of files we want to be deployed on save - - it('should return true for dot files', async () => { - const stopDotFileFromBeingDeployed = fileShouldNotBeDeployed( - '/force-app/main/default/.env' - ); - expect(stopDotFileFromBeingDeployed).to.be.true; - }); - it('should return true for soql files', async () => { - const stopSOQLFileFromBeingDeployed = fileShouldNotBeDeployed( - '/force-app/main/default/AccountQuery.soql' - ); - expect(stopSOQLFileFromBeingDeployed).to.be.true; - }); - it('should return true for anonymous apex files', async () => { - const stopAnonApexFileFromBeingDeployed = fileShouldNotBeDeployed( - '/force-app/main/default/GetAccounts.apex' - ); - expect(stopAnonApexFileFromBeingDeployed).to.be.true; - }); - it('should return false for class files', async () => { - const stopClassFileFromBeingDeployed = fileShouldNotBeDeployed( - '/force-app/main/default/MyAccountMap.cls' - ); - expect(stopClassFileFromBeingDeployed).to.be.false; - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/telemetry/index.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/telemetry/index.test.ts deleted file mode 100644 index 848f69fd11..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/telemetry/index.test.ts +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { AppInsights } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { assert, SinonStub, stub } from 'sinon'; -import { window } from 'vscode'; -import { SalesforceCoreSettings } from '../../../src/settings/salesforceCoreSettings'; -import { showTelemetryMessage, telemetryService } from '../../../src/telemetry'; -import { MockExtensionContext } from './MockExtensionContext'; - -describe('Telemetry', () => { - const machineId = '45678903'; - let mShowInformation: SinonStub; - let settings: SinonStub; - let mockExtensionContext: MockExtensionContext; - let reporter: SinonStub; - let exceptionEvent: SinonStub; - let teleStub: SinonStub; - let cliStub: SinonStub; - - describe('in dev mode', () => { - beforeEach(() => { - mShowInformation = stub(window, 'showInformationMessage').returns( - Promise.resolve(null) - ); - settings = stub( - SalesforceCoreSettings.prototype, - 'getTelemetryEnabled' - ).returns(true); - teleStub = stub(telemetryService, 'setCliTelemetryEnabled'); - cliStub = stub(telemetryService, 'checkCliTelemetry'); - cliStub.returns(Promise.resolve(true)); - }); - - afterEach(() => { - mShowInformation.restore(); - settings.restore(); - teleStub.restore(); - cliStub.restore(); - }); - - it('Should not initialize telemetry reporter', async () => { - // create vscode extensionContext - mockExtensionContext = new MockExtensionContext(true); - - await telemetryService.initializeService(mockExtensionContext); - - const telemetryReporter = telemetryService.getReporters(); - - expect(typeof telemetryReporter).to.eql('undefined'); - expect(teleStub.firstCall.args).to.eql([true]); - }); - - it('Should show telemetry info message', async () => { - // create vscode extensionContext in which telemetry msg has never been previously shown - mockExtensionContext = new MockExtensionContext(false); - - await telemetryService.initializeService(mockExtensionContext); - - const telemetryEnabled = await telemetryService.isTelemetryEnabled(); - expect(telemetryEnabled).to.be.eql(true); - - showTelemetryMessage(mockExtensionContext); - assert.calledOnce(mShowInformation); - expect(teleStub.firstCall.args).to.eql([true]); - }); - - it('Should not show telemetry info message', async () => { - // create vscode extensionContext in which telemetry msg has been previously shown - mockExtensionContext = new MockExtensionContext(true); - - await telemetryService.initializeService(mockExtensionContext); - - const telemetryEnabled = await telemetryService.isTelemetryEnabled(); - expect(telemetryEnabled).to.be.eql(true); - - showTelemetryMessage(mockExtensionContext); - assert.notCalled(mShowInformation); - expect(teleStub.firstCall.args).to.eql([true]); - }); - - it('Should disable CLI telemetry', async () => { - mockExtensionContext = new MockExtensionContext(true); - - cliStub.returns(Promise.resolve(false)); - await telemetryService.initializeService(mockExtensionContext); - - expect(teleStub.firstCall.args).to.eql([false]); - }); - }); - - describe('production mode', () => { - beforeEach(() => { - mShowInformation = stub(window, 'showInformationMessage').returns( - Promise.resolve(null) - ); - settings = stub( - SalesforceCoreSettings.prototype, - 'getTelemetryEnabled' - ).returns(true); - reporter = stub(AppInsights.prototype, 'sendTelemetryEvent'); - exceptionEvent = stub(AppInsights.prototype, 'sendExceptionEvent'); - teleStub = stub(telemetryService, 'setCliTelemetryEnabled'); - cliStub = stub(telemetryService, 'checkCliTelemetry'); - cliStub.returns(Promise.resolve(true)); - }); - - afterEach(() => { - mShowInformation.restore(); - settings.restore(); - reporter.restore(); - exceptionEvent.restore(); - teleStub.restore(); - cliStub.restore(); - }); - - it('Should show telemetry info message', async () => { - // create vscode extensionContext in which telemetry msg has never been previously shown - mockExtensionContext = new MockExtensionContext(false); - - await telemetryService.initializeService(mockExtensionContext); - - const telemetryEnabled = await telemetryService.isTelemetryEnabled(); - expect(telemetryEnabled).to.be.eql(true); - - showTelemetryMessage(mockExtensionContext); - assert.calledOnce(mShowInformation); - expect(teleStub.firstCall.args).to.eql([true]); - }); - - it('Should not show telemetry info message', async () => { - // create vscode extensionContext in which telemetry msg has been previously shown - mockExtensionContext = new MockExtensionContext(true); - - await telemetryService.initializeService(mockExtensionContext); - - const telemetryEnabled = await telemetryService.isTelemetryEnabled(); - expect(telemetryEnabled).to.be.eql(true); - - showTelemetryMessage(mockExtensionContext); - assert.notCalled(mShowInformation); - expect(teleStub.firstCall.args).to.eql([true]); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/traceflag/DeveloperLogTraceFlag.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/traceflag/DeveloperLogTraceFlag.test.ts deleted file mode 100644 index c70537f676..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/traceflag/DeveloperLogTraceFlag.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { developerLogTraceFlag } from '../../../src/commands'; - -// tslint:disable:no-unused-expression -describe('Start Apex Debug Logging', () => { - describe('Invalid start and end date', () => { - before(() => { - developerLogTraceFlag.setTraceFlagDebugLevelInfo( - 'fakeTraceFlagId', - new Date().toUTCString(), - new Date().toUTCString(), - 'fakeDebugLevelId' - ); - }); - - it('Should return false if date is invalid length', () => { - expect(developerLogTraceFlag.isValidDateLength()).to.be.false; - }); - - it('Should update dates to a 30 minute window if date length is invalid', () => { - expect(developerLogTraceFlag.isValidDateLength()).to.be.false; - developerLogTraceFlag.validateDates(); - expect( - developerLogTraceFlag.getExpirationDate().getTime() - - developerLogTraceFlag.getStartDate().getTime() - ).to.equal( - developerLogTraceFlag.LOG_TIMER_LENGTH_MINUTES * - developerLogTraceFlag.MILLISECONDS_PER_SECOND - ); - }); - }); - - describe('Validating debuglevelid', () => { - it('Should return true if debuglevelid exists', () => { - developerLogTraceFlag.setDebugLevelId('fakeDebugLevelId'); - expect(developerLogTraceFlag.isValidDebugLevelId()).to.be.true; - }); - - it('Should return false if debuglevelid is null', () => { - developerLogTraceFlag.setDebugLevelId(null); - expect(developerLogTraceFlag.isValidDebugLevelId()).to.be.false; - }); - - it('Should return false if debuglevelid is undefined', () => { - developerLogTraceFlag.setDebugLevelId(undefined); - expect(developerLogTraceFlag.isValidDebugLevelId()).to.be.false; - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/util/authInfo.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/util/authInfo.test.ts deleted file mode 100644 index 3d766ef212..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/util/authInfo.test.ts +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { AuthInfo, Connection, StateAggregator } from '@salesforce/core'; -import { ConfigUtil } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { createSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { nls } from '../../../src/messages'; -import { OrgAuthInfo } from '../../../src/util'; - -describe('OrgAuthInfo', () => { - const sandbox = createSandbox(); - - const username = 'user@test.test'; - let getTargetDevHubOrAliasStub: SinonStub; - - beforeEach(async () => { - getTargetDevHubOrAliasStub = sandbox.stub( - ConfigUtil, - 'getTargetDevHubOrAlias' - ); - }); - - afterEach(() => sandbox.restore()); - - describe('getUsername', () => { - const alias = 'TestOrg'; - - it('should return the given username if there is no alias', async () => { - const actualUsername = await OrgAuthInfo.getUsername(username); - expect(actualUsername).to.equal(username); - }); - - it('should return the given value if there is no alias', async () => { - const result = await OrgAuthInfo.getUsername(undefined!); - expect(result).to.equal(undefined); - }); - - it('should return the username for the matching alias', async () => { - const info = await StateAggregator.getInstance(); - sandbox - .stub(info.aliases, 'getUsername') - .withArgs(alias) - .returns(username); - expect(await OrgAuthInfo.getUsername(alias)).to.equal(username); - }); - }); - - describe('getTargetDevHubOrAlias', () => { - it('should return notification if there is no dev hub set', async () => { - getTargetDevHubOrAliasStub.resolves(undefined); - const infoMessageStub = sandbox.stub( - vscode.window, - 'showInformationMessage' - ); - - await OrgAuthInfo.getTargetDevHubOrAlias(true); - - expect(infoMessageStub.calledOnce).to.equal(true); - }); - - it('should run authorize a dev hub command if button clicked', async () => { - getTargetDevHubOrAliasStub.resolves(undefined); - const showMessageStub = sandbox.stub( - vscode.window, - 'showInformationMessage' - ); - showMessageStub.returns(nls.localize('notification_make_default_dev')); - const executeCommandStub = sandbox.stub( - vscode.commands, - 'executeCommand' - ); - - await OrgAuthInfo.getTargetDevHubOrAlias(true); - - expect( - executeCommandStub.calledWith('sf.org.login.web.dev.hub') - ).to.equal(true); - expect(showMessageStub.calledOnce).to.equal(true); - }); - - it('should not show a message if there is a dev hub set', async () => { - getTargetDevHubOrAliasStub.resolves('username'); - const infoMessageStub = sandbox.stub( - vscode.window, - 'showInformationMessage' - ); - - await OrgAuthInfo.getTargetDevHubOrAlias(true); - - expect(getTargetDevHubOrAliasStub.calledOnce).to.equal(true); - expect(infoMessageStub.calledOnce).to.equal(false); - }); - }); - - describe('getConnection', () => { - const fakeAuthInfo = { - authy: true - }; - const fakeConnection = { - connected: true - }; - const targetOrg = 'targetOrg'; - - let authinfoCreateStub: SinonStub; - let connectionCreateStub: SinonStub; - - beforeEach(() => { - authinfoCreateStub = sandbox - .stub(AuthInfo, 'create') - .resolves(fakeAuthInfo); - connectionCreateStub = sandbox - .stub(Connection, 'create') - .resolves(fakeConnection); - }); - - it('should use username/alias when passed as argument', async () => { - const connection = await OrgAuthInfo.getConnection(username); - expect(connection).to.equal(fakeConnection); - expect(authinfoCreateStub.calledWith({ username })).to.equal(true); - expect( - connectionCreateStub.calledWith({ authInfo: fakeAuthInfo }) - ).to.equal(true); - }); - - it('should use target org/alias when invoked without argument', async () => { - const configUtilStub = sandbox.stub(ConfigUtil, 'getTargetOrgOrAlias'); - configUtilStub.returns(targetOrg); - - const connection = await OrgAuthInfo.getConnection(); - expect(connection).to.equal(fakeConnection); - expect( - authinfoCreateStub.calledWith({ - username: targetOrg - }) - ).to.equal(true); - expect( - connectionCreateStub.calledWith({ authInfo: fakeAuthInfo }) - ).to.equal(true); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/util/cliConfiguration.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/util/cliConfiguration.test.ts deleted file mode 100644 index 0c1e6f2f77..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/util/cliConfiguration.test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { Config, ConfigFile, Global } from '@salesforce/core'; -import { - ConfigUtil, - GlobalCliEnvironment -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as shelljs from 'shelljs'; -import { assert, createSandbox, SinonSandbox, SinonStub } from 'sinon'; -import { window } from 'vscode'; -import { - ENV_SF_DISABLE_TELEMETRY, - TARGET_ORG_KEY -} from '../../../src/constants'; -import { WorkspaceContext } from '../../../src/context'; -import { - disableCLITelemetry, - isCLIInstalled, - isCLITelemetryAllowed, - showCLINotInstalledMessage, - workspaceUtils -} from '../../../src/util'; - -describe('SFDX CLI Configuration utility', () => { - let sandboxStub: SinonSandbox; - describe('isCLIInstalled', () => { - let whichStub: SinonStub; - - beforeEach(() => { - sandboxStub = createSandbox(); - whichStub = sandboxStub.stub(shelljs, 'which'); - }); - - afterEach(() => { - sandboxStub.restore(); - }); - - it('Should return false if sfdx cli path is not found', () => { - whichStub.withArgs('sfdx').returns(''); - - const response = isCLIInstalled(); - expect(response).equal(false); - }); - - it('Should return true if sfdx cli path is found', () => { - whichStub.withArgs('sfdx').returns('Users/some/path/sfdx/cli'); - - const response = isCLIInstalled(); - expect(response).equal(true); - }); - - it('Should return false if sfdx cli path query throwns an exception', () => { - whichStub - .withArgs('sfdx') - .throws(new Error('some exception while querying system path')); - - const response = isCLIInstalled(); - expect(response).equal(false); - }); - }); - - describe('showCLINotInstalledMessage', () => { - let mShowWarning: SinonStub; - - beforeEach(() => { - sandboxStub = createSandbox(); - mShowWarning = sandboxStub - .stub(window, 'showWarningMessage') - .returns(Promise.resolve(null)); - }); - - afterEach(() => { - sandboxStub.restore(); - }); - - it('Should show cli install info message', async () => { - showCLINotInstalledMessage(); - assert.calledOnce(mShowWarning); - }); - }); - - describe('CLI Telemetry', () => { - let isTelemetryDisabledStub: SinonStub; - - beforeEach(() => { - sandboxStub = createSandbox(); - isTelemetryDisabledStub = sandboxStub.stub( - ConfigUtil, - 'isTelemetryDisabled' - ); - }); - - afterEach(() => { - sandboxStub.restore(); - }); - - it('Should return false if telemetry setting is disabled', async () => { - isTelemetryDisabledStub.resolves('true'); - - const response = await isCLITelemetryAllowed(); - expect(response).to.equal(false); - }); - - it('Should return true if telemetry setting is undefined', async () => { - isTelemetryDisabledStub.resolves(undefined); - - const response = await isCLITelemetryAllowed(); - expect(response).to.equal(true); - }); - - it('Should return true if telemetry setting is enabled', async () => { - isTelemetryDisabledStub.resolves(false); - - const response = await isCLITelemetryAllowed(); - expect(response).to.equal(true); - }); - - it('Should set an environment variable', async () => { - const cliEnvSpy = sandboxStub.stub( - GlobalCliEnvironment.environmentVariables, - 'set' - ); - disableCLITelemetry(); - expect(cliEnvSpy.firstCall.args).to.eql([ - ENV_SF_DISABLE_TELEMETRY, - 'true' - ]); - }); - }); - - describe('ConfigAggregator integration tests', () => { - const dummyLocalTargetOrg = 'test@local.com'; - const origCwd = process.cwd(); - - before(() => { - // Ensure we are in the project directory - const rootWorkpace = workspaceUtils.getRootWorkspacePath(); - process.chdir(rootWorkpace); - }); - after(() => { - process.chdir(origCwd); - }); - - afterEach(async () => { - // Remove the config files that were created for the test - try { - const configFile = await ConfigFile.create( - Config.getDefaultOptions(false, 'sfdx-config.json') - ); - configFile.unlinkSync(); // delete the sfdx config file that was created for the test - - const config = await Config.create(Config.getDefaultOptions()); - config.unlinkSync(); // delete the sf config file that was created for the test - - // delete the sf directory that was created for the test - fs.rmdir('.sf', err => { - if (err) { - console.log(err); - } - }); - } catch (error) { - console.log(error); - } - }); - - /* - * workspaceContextUtil defines a listener that fires a VS Code event when - * the config file changes. Ideally, something like flushAllPromises() - * would be used to force the promises to resolve - however, there seems - * to be no mechanism to get the VS Code Events to fire before the assertions - * in the test. To work around this, a new listener for the event is - * configured in this test, and the assertions are made within that event listener. - * By asserting localProjectTargetOrgOrAlias, this test validates that: - * 1. The config file listener in workspaceContextUtil is active - * 2. When the listener detects a config file change (config.write()) it reloads the - * configAggregator to ensure it has the latest values - * 3. The VS Code onOrgChange event handler is invoked - * 4. The VS Code orgChange event was fired with the correct values - * 5. The call to ConfigUtil.getTargetOrgOrAlias() returns the expected local value - */ - it('Should return the locally configured target org when it exists', async function () { - this.timeout(60000); - - let res: (value: string) => void; - let rej: (reason?: any) => void; - const resultPromise = new Promise((resolveFunc, rejectsFunc) => { - res = resolveFunc; - rej = rejectsFunc; - }); - WorkspaceContext.getInstance().onOrgChange(async orgUserInfo => { - try { - // Act - const localProjectTargetOrgOrAlias = - await ConfigUtil.getTargetOrgOrAlias(); - - // Assert - expect(localProjectTargetOrgOrAlias).to.equal(dummyLocalTargetOrg); - expect(localProjectTargetOrgOrAlias).to.equal(orgUserInfo.username); - - res('success'); - } catch (e) { - rej(e); - } - }); - - // Arrange - // The stubContext method set the Global.SFDX_INTEROPERABILITY to false but - // doesn't reset it to the default true on restore. This causes issues with the sfdx config - // file watcher. Set it to true here to ensure we get the writes to the sfdx config file. - Global.SFDX_INTEROPERABILITY = true; - - // Create a local config file and set the local project target org - const config = await Config.create(Config.getDefaultOptions()); - config.set(TARGET_ORG_KEY, dummyLocalTargetOrg); - await config.write(); - - return resultPromise; - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/util/inputUtils.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/util/inputUtils.test.ts deleted file mode 100644 index a2e9fb8078..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/util/inputUtils.test.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { assert, expect } from 'chai'; -import { stub } from 'sinon'; -import * as vscode from 'vscode'; -import { InputUtils } from '../../../src/util/inputUtils'; - -describe('inputUtils Unit tests', () => { - - describe('getFormattedString', () => { - let showInputBoxStub: sinon.SinonStub; - const INPUT_VAL = 'Test Input'; - const EMPTY_STRING = ''; - const WHITESPACE = ' '; - - beforeEach(() => { - showInputBoxStub = stub(vscode.window, 'showInputBox'); - }); - - afterEach(() => { - showInputBoxStub.restore(); - }); - - it('should call showInputBox once', async () => { - showInputBoxStub.resolves(INPUT_VAL); - const trimmedString = await InputUtils.getFormattedString('', ''); - assert(showInputBoxStub.calledOnce); - }); - - it('should remove leading whitespace', async () => { - showInputBoxStub.resolves(` ${INPUT_VAL}`); - const trimmedString = await InputUtils.getFormattedString('', ''); - expect(trimmedString).to.be.eq(INPUT_VAL); - }); - - it('should remove trailing whitespace', async () => { - showInputBoxStub.resolves(`${INPUT_VAL} `); - const trimmedString = await InputUtils.getFormattedString('', ''); - expect(trimmedString).to.be.eq(INPUT_VAL); - }); - - it('should remove leading and trailing whitespace', async () => { - showInputBoxStub.resolves(` ${INPUT_VAL} `); - const trimmedString = await InputUtils.getFormattedString('', ''); - expect(trimmedString).to.be.eq(INPUT_VAL); - }); - - it('should return an empty string when given an empty string', async () => { - showInputBoxStub.resolves(EMPTY_STRING); - const trimmedString = await InputUtils.getFormattedString('', ''); - expect(trimmedString).to.be.eq(EMPTY_STRING); - }); - - it('should return empty string when given whitespace', async () => { - showInputBoxStub.resolves(WHITESPACE); - const trimmedString = await InputUtils.getFormattedString('', ''); - expect(trimmedString).to.be.eq(EMPTY_STRING); - }); - - it('should return undefined when given undefined', async () => { - showInputBoxStub.resolves(undefined); - const trimmedString = await InputUtils.getFormattedString('', ''); - assert.isUndefined(trimmedString); - }); - - it('should return null when given null', async () => { - showInputBoxStub.resolves(null); - const trimmedString = await InputUtils.getFormattedString('', ''); - assert.isNull(trimmedString); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/util/orgUtil.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/util/orgUtil.test.ts deleted file mode 100644 index f774a10cd4..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/util/orgUtil.test.ts +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// Imports for testing -import { AuthInfo } from '@salesforce/core'; -import { expect } from 'chai'; -import { before } from 'mocha'; -import { createSandbox, SinonSandbox, SinonSpy, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { channelService } from '../../../src/channels'; -import { OrgList } from '../../../src/orgPicker'; -import { checkForExpiredOrgs } from '../../../src/util'; - -describe('orgUtil tests', () => { - let sb: SinonSandbox; - before(() => { - sb = createSandbox(); - }); - - afterEach(async () => { - sb.restore(); - }); - - describe('checkForExpiredOrgs tests', () => { - const orgName1 = 'dreamhouse-org'; - const orgName2 = 'ebikes-lwc'; - const now = new Date(); - const threeDaysFromNow = new Date(now.getTime() + 24 * 3 * 60 * 60000); - const yesterday = new Date(now.getTime() - 24 * 60 * 60000); - - let showWarningMessageSpy: SinonSpy; - let appendLineSpy: SinonSpy; - let showChannelOutputSpy: SinonSpy; - let listAllAuthorizationsStub: SinonStub; - let authInfoCreateStub: SinonStub; - - beforeEach(() => { - showWarningMessageSpy = sb.spy(vscode.window, 'showWarningMessage'); - appendLineSpy = sb.spy(channelService, 'appendLine'); - showChannelOutputSpy = sb.spy(channelService, 'showChannelOutput'); - listAllAuthorizationsStub = sb.stub(AuthInfo, 'listAllAuthorizations'); - authInfoCreateStub = sb.stub(AuthInfo, 'create'); - }); - - it('should not display a notification when no orgs are present', async () => { - listAllAuthorizationsStub.resolves(undefined); - const orgList = new OrgList(); - await checkForExpiredOrgs(orgList); - - expect(showWarningMessageSpy.called).to.equal(false); - expect(appendLineSpy.called).to.equal(false); - expect(showChannelOutputSpy.called).to.equal(false); - }); - - it('should not display a notification when dev hubs are present', async () => { - listAllAuthorizationsStub.resolves([ - { - isDevHub: true, - username: 'foo', - aliases: [orgName1] - }, - { - isDevHub: true, - username: 'bar', - aliases: [orgName2] - } - ]); - const orgList = new OrgList(); - await checkForExpiredOrgs(orgList); - - expect(showWarningMessageSpy.called).to.equal(false); - expect(appendLineSpy.called).to.equal(false); - expect(showChannelOutputSpy.called).to.equal(false); - expect(authInfoCreateStub.called).to.equal(false); - }); - - it('should not display a notification when the scratch org has already expired', async () => { - listAllAuthorizationsStub.resolves([ - { - isDevHub: false, - username: 'foo', - aliases: [orgName1] - } - ]); - - authInfoCreateStub.resolves({ - getFields: () => { - return { - expirationDate: `${yesterday.getFullYear()}-${yesterday.getMonth() + - 1}-${yesterday.getDate()}` - }; - } - }); - const orgList = new OrgList(); - await checkForExpiredOrgs(orgList); - - expect(showWarningMessageSpy.called).to.equal(false); - expect(appendLineSpy.called).to.equal(false); - expect(showChannelOutputSpy.called).to.equal(false); - expect(authInfoCreateStub.called).to.equal(true); - }); - - it('should display a notification when the scratch org is about to expire', async () => { - const orgName = 'dreamhouse-org'; - listAllAuthorizationsStub.resolves([ - { - isDevHub: false, - username: 'foo', - aliases: [orgName] - } - ]); - - authInfoCreateStub.resolves({ - getFields: () => { - return { - expirationDate: `${threeDaysFromNow.getFullYear()}-${threeDaysFromNow.getMonth() + - 1}-${threeDaysFromNow.getDate()}` - }; - } - }); - - const orgList = new OrgList(); - await checkForExpiredOrgs(orgList); - - expect(showWarningMessageSpy.called).to.equal(true); - expect(appendLineSpy.called).to.equal(true); - expect(appendLineSpy.args[0][0]).to.contain(orgName); - expect(showChannelOutputSpy.called).to.equal(true); - }); - - it('should display multiple orgs in the output when there are several scratch orgs about to expire', async () => { - listAllAuthorizationsStub.resolves([ - { - isDevHub: false, - username: 'foo', - aliases: [orgName1] - }, - { - isDevHub: false, - username: 'bar', - aliases: [orgName2] - } - ]); - - authInfoCreateStub.resolves({ - getFields: () => { - return { - expirationDate: `${threeDaysFromNow.getFullYear()}-${threeDaysFromNow.getMonth() + - 1}-${threeDaysFromNow.getDate()}` - }; - } - }); - - const orgList = new OrgList(); - await checkForExpiredOrgs(orgList); - - expect(showWarningMessageSpy.called).to.equal(true); - expect(appendLineSpy.called).to.equal(true); - expect(appendLineSpy.args[0][0]).to.contain(orgName1); - expect(appendLineSpy.args[0][0]).to.contain(orgName2); - expect(showChannelOutputSpy.called).to.equal(true); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/util/rootWorkspace.test-util.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/util/rootWorkspace.test-util.ts deleted file mode 100644 index 59e6c50be5..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/util/rootWorkspace.test-util.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { SinonStub, stub } from 'sinon'; -import { workspace, WorkspaceFolder } from 'vscode'; - -/** - * These test utilities will mock vscode.workspace so that - * getRootWorkspace, hasRootWorkspace, and getRootWorkspacePath all - * work from the mock information you pass in. - */ - -export function stubRootWorkspace(path: string): SinonStub { - return stubWorkspace(generateMockRootWorkspace(path)); -} - -export function stubWorkspace(stubObj: WorkspaceFolder[]): SinonStub { - return stub(workspace, 'workspaceFolders').get( - function getWorkspaceFolders() { - return stubObj; - } - ); -} - -export function generateMockRootWorkspace(path: string): WorkspaceFolder[] { - return ([ - { - name: 'test', - uri: { - fsPath: path - } - } - ] as unknown) as WorkspaceFolder[]; -} diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/util/rootWorkspace.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/util/rootWorkspace.test.ts deleted file mode 100644 index 47bd8a3ba2..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/util/rootWorkspace.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { SinonStub } from 'sinon'; -import { WorkspaceFolder } from 'vscode'; -import { workspaceUtils } from '../../../src/util'; -import { stubWorkspace } from './rootWorkspace.test-util'; - -// tslint:disable:no-unused-expression -describe('RootWorkspace utils should', () => { - const myFolder: WorkspaceFolder = ({ - name: 'test', - uri: { - fsPath: '/test/test' - } - } as unknown) as WorkspaceFolder; - const myWorkspaces: WorkspaceFolder[] = ([ - myFolder - ] as unknown) as WorkspaceFolder[]; - const WORKSPACE_NAME = 'sfdx-simple'; - let workspaceStub: SinonStub | undefined; - - afterEach(() => { - if (workspaceStub) { - workspaceStub.restore(); - workspaceStub = undefined; - } - }); - - it('correctly determine if there is a workspace', () => { - expect(workspaceUtils.hasRootWorkspace()).to.be.true; - workspaceStub = stubWorkspace([]); - expect(workspaceUtils.hasRootWorkspace()).to.be.false; - }); - - it('get workspace information', () => { - expect(workspaceUtils.getRootWorkspace()).to.be.an.instanceOf(Object); - expect(workspaceUtils.getRootWorkspace().name).to.contain(WORKSPACE_NAME); - expect(workspaceUtils.getRootWorkspacePath()).to.contain(WORKSPACE_NAME); - }); - - it('return empty things ( not undefined ) if no root workspace', () => { - workspaceStub = stubWorkspace([]); - expect(workspaceUtils.getRootWorkspace()).to.be.empty; - expect(workspaceUtils.getRootWorkspacePath()).to.be.empty; - }); - - it('return correct parts of the root workspace', () => { - workspaceStub = stubWorkspace(myWorkspaces); - expect(workspaceUtils.getRootWorkspace().name).to.equal(myFolder.name); - expect(workspaceUtils.getRootWorkspacePath()).to.equal(myFolder.uri.fsPath); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/util/statuses/taskView.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/util/statuses/taskView.test.ts deleted file mode 100644 index 2c3ecbae2c..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/util/statuses/taskView.test.ts +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// tslint:disable:no-unused-expression - -import { - CliCommandExecutor, - CommandBuilder, - SfCommandBuilder -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { stub } from 'sinon'; -import { CancellationTokenSource } from 'vscode'; -import { nls } from '../../../../src/messages'; -import { Task, TaskViewService } from '../../../../src/statuses/taskView'; - -describe('Task View', () => { - describe('Task View Provider', () => { - let taskViewService: TaskViewService; - - beforeEach(() => { - taskViewService = new TaskViewService(); - }); - - it('Should add a command to its internal queue', () => { - taskViewService.addCommandExecution( - new CliCommandExecutor( - new SfCommandBuilder().withArg('--help').build(), - {} - ).execute() - ); - - expect(taskViewService.getChildren()).to.have.lengthOf(1); - expect(taskViewService.getChildren()[0].label).to.be.equal( - nls.localize('task_view_running_message', 'sf force --help') - ); - }); - - it('Should fire an event when a command is added', async () => { - taskViewService.addCommandExecution( - new CliCommandExecutor( - new SfCommandBuilder().withArg('--help').build(), - {} - ).execute() - ); - - const event = await new Promise((resolve, reject) => { - taskViewService.onDidChangeTreeData(e => { - resolve(e); - }); - }); - - // Expect that we see an event but the payload of the event is undefined - // to signal that the root has changed - expect(event).to.be.undefined; - }); - - it('Should remove a command from its internal queue when present', () => { - const task = taskViewService.addCommandExecution( - new CliCommandExecutor( - new SfCommandBuilder().withArg('--help').build(), - {} - ).execute() - ); - - taskViewService.removeTask(task); - - expect(taskViewService.getChildren()).to.have.lengthOf(0); - }); - - it('Should not remove a command from its internal queue when not present', () => { - taskViewService.addCommandExecution( - new CliCommandExecutor( - new SfCommandBuilder().withArg('--help').build(), - {} - ).execute() - ); - taskViewService.addCommandExecution( - new CliCommandExecutor( - new SfCommandBuilder().withArg('--help').build(), - {} - ).execute() - ); - const bogusTask = new Task(taskViewService, stub() as any); - - const wasRemoved = taskViewService.removeTask(bogusTask); - expect(wasRemoved).to.be.false; - - expect(taskViewService.getChildren()).to.have.lengthOf(2); - }); - - it('Should terminate and remove specific task if provided', () => { - const tokenSource = new CancellationTokenSource(); - const task = taskViewService.addCommandExecution( - new CliCommandExecutor( - new SfCommandBuilder().withArg('--help').build(), - {} - ).execute(tokenSource.token), - tokenSource - ); - - expect(taskViewService.getChildren()).to.have.lengthOf(1); - - taskViewService.terminateTask(task); - - expect(taskViewService.getChildren()).to.have.lengthOf(0); - }); - - it('Should terminate LRU task if no specific task provided', () => { - taskViewService.addCommandExecution( - new CliCommandExecutor( - new SfCommandBuilder().withArg('--help').build(), - {} - ).execute() - ); - - expect(taskViewService.getChildren()).to.have.lengthOf(1); - - taskViewService.terminateTask(); - - expect(taskViewService.getChildren()).to.have.lengthOf(0); - }); - }); - - describe('Task', () => { - it('Should remove itself from Task View once terminated', async () => { - const taskViewService = new TaskViewService(); - const execution = new CliCommandExecutor( - new SfCommandBuilder().withArg('--help').build(), - {} - ).execute(); - taskViewService.addCommandExecution(execution); - - expect(taskViewService.getChildren()).to.have.lengthOf(1); - - await new Promise((resolve, reject) => { - taskViewService.onDidChangeTreeData(e => { - resolve(e); - }); - }); - - expect(taskViewService.getChildren()).to.have.lengthOf(0); - }); - - it('Should remove itself from Task View if erroneous', async () => { - const taskViewService = new TaskViewService(); - const execution = new CliCommandExecutor( - new CommandBuilder('sf_').build(), - {} - ).execute(); - taskViewService.addCommandExecution(execution); - - expect(taskViewService.getChildren()).to.have.lengthOf(1); - - await new Promise((resolve, reject) => { - taskViewService.onDidChangeTreeData(e => { - resolve(e); - }); - }); - - expect(taskViewService.getChildren()).to.have.lengthOf(0); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lightning/test/vscode-integration/extension.test.ts b/packages/salesforcedx-vscode-lightning/test/vscode-integration/extension.test.ts deleted file mode 100644 index f9ffe00a5a..0000000000 --- a/packages/salesforcedx-vscode-lightning/test/vscode-integration/extension.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { Context } from 'mocha'; -import * as vscode from 'vscode'; - -const PERFECT_MATCH = 10; - -const matchExtensionAsHtml = async (extension: string) => { - const doc = await vscode.workspace.openTextDocument( - vscode.Uri.parse(`untitled:fake/path/doc.${extension}`) - ); - expect(vscode.languages.match({ language: 'html' }, doc)).to.equal( - PERFECT_MATCH - ); -}; - -describe('Lightning file association', () => { - it('Should support .app association', async () => { - await matchExtensionAsHtml('.app'); - }); - - it('Should support .cmp association', async () => { - await matchExtensionAsHtml('.cmp'); - }); - - it('Should support .design association', async () => { - await matchExtensionAsHtml('.design'); - }); - - it('Should support .evt association', async () => { - await matchExtensionAsHtml('.evt'); - }); - - it('Should support.intf association', async () => { - await matchExtensionAsHtml('.intf'); - }); - - it('Should support .auradoc association', async () => { - await matchExtensionAsHtml('.auradoc'); - }); - - it('Should support .tokens association', async () => { - await matchExtensionAsHtml('.tokens'); - }); -}); - -describe('Test commands', () => { - let coreExtension: vscode.Extension; - let auraExtension: vscode.Extension; - - beforeEach(async () => { - if ( - vscode.workspace && - vscode.workspace.workspaceFolders && - vscode.workspace.workspaceFolders[0] - ) { - coreExtension = vscode.extensions.getExtension( - 'salesforce.salesforcedx-vscode-core' - ) as vscode.Extension; - - auraExtension = vscode.extensions.getExtension( - 'salesforce.salesforcedx-vscode-lightning' - ) as vscode.Extension; - } - }); - - it('coreExtension activation', async function(this: Context) { - this.timeout(10000); - await coreExtension.activate(); - expect(coreExtension.isActive); - }); - - it('aura activation', async function(this: Context) { - this.timeout(10000); - await auraExtension.activate(); - expect(auraExtension.isActive); - }); -}); diff --git a/packages/salesforcedx-vscode-lightning/test/vscode-integration/hover.test.ts b/packages/salesforcedx-vscode-lightning/test/vscode-integration/hover.test.ts deleted file mode 100644 index 2d37cc33fb..0000000000 --- a/packages/salesforcedx-vscode-lightning/test/vscode-integration/hover.test.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import { - Hover, - Position, - MarkdownString, - commands, - window, - workspace -} from 'vscode'; - -describe('Aura Hovers', function() { - this.timeout(4000); - - let auraDir: string; - - beforeEach(async () => { - auraDir = path.join( - workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'default', - 'aura' - ); - - await new Promise(r => setTimeout(r, 1000)); - }); - - afterEach(async () => { - await commands.executeCommand('workbench.action.closeActiveEditor'); - }); - - // eslint-disable-next-line prefer-arrow/prefer-arrow-functions - it('Should provide additional details when hovering over an aura tag', async function() { - const doc = await workspace.openTextDocument( - path.join(auraDir, 'auraPubsubSubscriber', 'auraPubsubSubscriber.cmp') - ); - const editor = await window.showTextDocument(doc); - - // hover over the 'lightning:card' tag - const position = new Position(25, 17); - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - const hoverInstances = (await commands.executeCommand( - 'vscode.executeHoverProvider', - editor.document.uri, - position - )) as Hover[]; - - expect(hoverInstances).to.have.lengthOf.at.least(1); - - const content = findContentFromInstances(hoverInstances, 'lightning:card'); - - expect(content).not.to.be.undefined; - expect(content).not.to.be.null; - - expect(content!.value).to.include('lightning:card'); - expect(content!.value).to.include('View in Component Library'); - }); - - // eslint-disable-next-line prefer-arrow/prefer-arrow-functions - it('Should provide additional details when hovering over an aura attribute', async function() { - const doc = await workspace.openTextDocument( - path.join(auraDir, 'auraPubsubSubscriber', 'auraPubsubSubscriber.cmp') - ); - const editor = await window.showTextDocument(doc); - - // hover over the 'title' attribute - const position = new Position(25, 24); - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - const hoverInstances = (await commands.executeCommand( - 'vscode.executeHoverProvider', - editor.document.uri, - position - )) as Hover[]; - - expect(hoverInstances).to.have.lengthOf.at.least(1); - - const content = findContentFromInstances(hoverInstances, '**title**'); - - expect(content).not.to.be.undefined; - expect(content).not.to.be.null; - - expect(content!.value).to.include('title'); - expect(content!.value).to.include( - 'The title can include text or another component, and is displayed in the header.' - ); - }); -}); - -/** Helper to find the expected hover content - * - * @param instances - hover instances - * @param expectedContent - content that is being searched for - * @returns the first content which includes the expected value || undefined - */ -const findContentFromInstances = (instances: Hover[], expectedContent: string) => { - for (const instance of instances) { - // type assertion to prevent using a deprecated type - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - const contents = instance!.contents as MarkdownString[]; - - const content = contents.find(cncnt => - cncnt.value.includes(expectedContent) - ); - - // return the first found match - if (content) { - return content; - } - } -}; diff --git a/packages/salesforcedx-vscode-lightning/test/vscode-integration/index.ts b/packages/salesforcedx-vscode-lightning/test/vscode-integration/index.ts deleted file mode 100644 index cf43a7e530..0000000000 --- a/packages/salesforcedx-vscode-lightning/test/vscode-integration/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { join, normalize } from 'path'; - -// eslint-disable-next-line @typescript-eslint/no-var-requires -const testRunner = require('@salesforce/salesforcedx-test-utils-vscode/out/src/testrunner'); - -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure( - { - ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results - fullTrace: true, - retries: 2, - slow: 0 - }, - normalize(join(__dirname, '..', '..', '..')) -); - -module.exports = testRunner; diff --git a/packages/salesforcedx-vscode-lightning/test/vscode-integration/intellisense.test.ts b/packages/salesforcedx-vscode-lightning/test/vscode-integration/intellisense.test.ts deleted file mode 100644 index 0707f21a11..0000000000 --- a/packages/salesforcedx-vscode-lightning/test/vscode-integration/intellisense.test.ts +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { assert, expect } from 'chai'; -import * as path from 'path'; -import * as vscode from 'vscode'; - -describe('Aura Intellisense Test Suite', () => { - let auraDir: string; - - beforeEach(async () => { - auraDir = path.join( - vscode.workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'default', - 'aura' - ); - await new Promise(r => setTimeout(r, 1000)); - }); - - afterEach(async () => { - await vscode.commands.executeCommand('workbench.action.closeActiveEditor'); - }); - - /** - * Test that aura markup intellisense contains aura, lightning, custom aura, custom lwc tags - */ - - it('Aura markup intellisense', async () => { - const docUri = vscode.Uri.file( - path.join(auraDir, 'DemoComponent', 'DemoComponent.cmp') - ); - const doc = await vscode.workspace.openTextDocument(docUri); - const editor = await vscode.window.showTextDocument(doc); - - // We have to have some text or we'll just get generic completions - const text = ' { - editBuilder.replace(rangeReplace, text); - }); - - await testCompletion(docUri, endPosition, { - items: [ - // Aura system attributes - { label: 'aura:attribute', kind: vscode.CompletionItemKind.Property }, - // Standard components - { - label: 'lightning:button', - kind: vscode.CompletionItemKind.Property - }, - // Custom Aura - { - label: 'c:DemoApp', - kind: vscode.CompletionItemKind.Property - }/*, - // NOTE: this commented out since it caused the test to inconsistently fail - // in the autobuilds, this area is covered by tests in the lang server repo. - // Custom LWC - { - label: 'c:demoLwcComponent', - kind: vscode.CompletionItemKind.Property - }*/ - ] - }); - }); - - /** - * Test aura javascript completions - */ - - it('Aura global javascript intellisense', async () => { - const docUri = vscode.Uri.file( - path.join(auraDir, 'DemoComponent', 'DemoComponentController.js') - ); - const doc = await vscode.workspace.openTextDocument(docUri); - const editor = await vscode.window.showTextDocument(doc); - - // We have to have some text or we'll just get generic completions - const text = '$A.util.get'; - const startPosition = new vscode.Position(2, 3); - const endPosition = new vscode.Position( - startPosition.line, - startPosition.character + text.length - ); - const rangeReplace = new vscode.Range(startPosition, endPosition); - await editor.edit(editBuilder => { - editBuilder.replace(rangeReplace, text); - }); - - await testCompletion(docUri, endPosition, { - items: [ - { label: 'getBooleanValue', kind: vscode.CompletionItemKind.Function } - ] - }); - }); - - it('Aura property javascript intellisense', async () => { - const docUri = vscode.Uri.file( - path.join(auraDir, 'DemoComponent', 'DemoComponentController.js') - ); - const doc = await vscode.workspace.openTextDocument(docUri); - const editor = await vscode.window.showTextDocument(doc); - - // We have to have some text or we'll just get generic completions - const text = 'component.get'; - const startPosition = new vscode.Position(2, 3); - const endPosition = new vscode.Position( - startPosition.line, - startPosition.character + text.length - ); - const rangeReplace = new vscode.Range(startPosition, endPosition); - await editor.edit(editBuilder => { - editBuilder.replace(rangeReplace, text); - }); - - await testCompletion(docUri, endPosition, { - items: [{ label: 'getEvent', kind: vscode.CompletionItemKind.Function }] - }); - }); - - it('Aura helper javascript intellisense', async () => { - const docUri = vscode.Uri.file( - path.join(auraDir, 'DemoComponent', 'DemoComponentController.js') - ); - const doc = await vscode.workspace.openTextDocument(docUri); - const editor = await vscode.window.showTextDocument(doc); - - // We have to have some text or we'll just get generic completions - const text = 'helper.hel'; - const startPosition = new vscode.Position(2, 3); - const endPosition = new vscode.Position( - startPosition.line, - startPosition.character + text.length - ); - const rangeReplace = new vscode.Range(startPosition, endPosition); - await editor.edit(editBuilder => { - editBuilder.replace(rangeReplace, text); - }); - - await testCompletion(docUri, endPosition, { - items: [ - { label: 'helperFunction', kind: vscode.CompletionItemKind.Function } - ] - }); - }); -}); - -// NOTE: Because the completion providers always returns all possible results and then VSCode -// does the filtering based on what is typed, we have no good way of testing what vscode is -// actually displaying to the user based on what we typed -const testCompletion = async ( - docUri: vscode.Uri, - position: vscode.Position, - expectedCompletionList: vscode.CompletionList -) => { - // Simulate triggering a completion - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - const actualCompletionList = (await vscode.commands.executeCommand( - 'vscode.executeCompletionItemProvider', - docUri, - position - )) as vscode.CompletionList; - - expectedCompletionList.items.forEach(expectedItem => { - const actualItem = actualCompletionList.items.find(obj => { - if (obj.label) { - return obj.label === expectedItem.label; - } - return false; - }); - - assert.isDefined( - actualItem, - // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-plus-operands - "Couldn't find expected completion item '" + expectedItem.label + "'" - ); - assert.equal( - actualItem!.label, - expectedItem.label, - // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-plus-operands - 'Expected completion item to have label: ' + expectedItem.label - ); - assert.equal( - actualItem!.kind, - expectedItem.kind, - "Expected completion item'" + - // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-plus-operands - expectedItem.label + - "' to have type: " + - expectedItem.kind - ); - if (actualItem?.detail === 'Lightning') { - assert.isDefined( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - actualItem!.documentation, - "Expected completion item '" + - // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-plus-operands - expectedItem.label + - "' to have documentation" - ); - } - }); -}; diff --git a/packages/salesforcedx-vscode-lightning/test/vscode-integration/navigation.test.ts b/packages/salesforcedx-vscode-lightning/test/vscode-integration/navigation.test.ts deleted file mode 100644 index ec2a9829f2..0000000000 --- a/packages/salesforcedx-vscode-lightning/test/vscode-integration/navigation.test.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import { Location, Position, commands, window, workspace } from 'vscode'; -import URI from 'vscode-uri'; - -describe('Aura Definition Linking', () => { - let auraDir: string; - let lwcDir: string; - - beforeEach(async () => { - auraDir = path.join( - workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'default', - 'aura' - ); - - lwcDir = path.join( - workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'default', - 'lwc' - ); - - await new Promise(r => setTimeout(r, 1500)); - }); - - afterEach(async () => { - await commands.executeCommand('workbench.action.closeActiveEditor'); - }); - - it('Should provide navigation to a selected Aura tag', async () => { - // select the 'c:DemoComponent' Aura tag - await testDefinitionNavigation( - path.join(auraDir, 'DemoApp', 'DemoApp.app'), - path.join(auraDir, 'DemoComponent', 'DemoComponent.cmp'), - new Position(1, 12) - ); - }); - - it('Should provide navigation to a selected LWC tag', async () => { - // select the 'c:contactList' LWC tag - await testDefinitionNavigation( - path.join(auraDir, 'auraEmbeddedLWC', 'auraEmbeddedLWC.cmp'), - path.join(lwcDir, 'contactList', 'contactList.js'), - new Position(20, 28) - ); - }); -}); - -/** Helper to test the definition provider - * - * @param startLocation - starting location - * @param endLocation - expected definition location given the position - * @param position - position to initiate the definition lookup - */ -const testDefinitionNavigation = async ( - startLocation: string, - endLocation: string, - position: Position -) => { - const doc = await workspace.openTextDocument(startLocation); - const editor = await window.showTextDocument(doc); - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - const locations = (await commands.executeCommand( - 'vscode.executeDefinitionProvider', - editor.document.uri, - position - )) as Location[]; - - expect(locations).to.have.lengthOf(1); - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - const location = locations![0]; - - expect(location).to.have.property('uri'); - - const expectedURI = URI.file(endLocation); - - expect(location.uri.toString()).to.equal(expectedURI.toString()); -}; diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/activation/MockExtensionContext.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/activation/MockExtensionContext.ts deleted file mode 100644 index f93ce95642..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/activation/MockExtensionContext.ts +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import * as path from 'path'; -import { - EnvironmentVariableCollection, - EnvironmentVariableMutator, - EnvironmentVariableScope, - Extension, - ExtensionContext, - ExtensionMode, - Memento, - SecretStorage, - Uri -} from 'vscode'; - -class MockMemento implements Memento { - private telemetryGS: boolean; - - constructor(setGlobalState: boolean) { - this.telemetryGS = setGlobalState; - } - keys(): readonly string[] { - throw new Error('Method not implemented.'); - } - - public get(key: string): any { - if (this.telemetryGS === true) { - return true; - } - return undefined; - } - - public update(key: string, value: any): Promise { - return Promise.resolve(); - } - - public setKeysForSync(keys: readonly string[]): void { - return; - } -} - -class MockEnvironmentVariableCollection - implements EnvironmentVariableCollection { - [Symbol.iterator](): Iterator<[variable: string, mutator: EnvironmentVariableMutator], any, undefined> { - throw new Error('Method not implemented.'); - } - public persistent = true; - public description = 'Mock Environment Variable Collection'; - public replace(variable: string, value: string): void { - throw new Error('Method not implemented.'); - } - public append(variable: string, value: string): void { - throw new Error('Method not implemented.'); - } - public prepend(variable: string, value: string): void { - throw new Error('Method not implemented.'); - } - public get(variable: string): EnvironmentVariableMutator | undefined { - throw new Error('Method not implemented.'); - } - public forEach( - callback: ( - variable: string, - mutator: EnvironmentVariableMutator, - collection: EnvironmentVariableCollection - ) => any, - thisArg?: any - ): void { - throw new Error('Method not implemented.'); - } - public delete(variable: string): void { - throw new Error('Method not implemented.'); - } - public clear(): void { - throw new Error('Method not implemented.'); - } - public getScoped(scope: EnvironmentVariableScope): EnvironmentVariableCollection { - const envVar: any = null; - return envVar; - } -} - -export class MockExtensionContext implements ExtensionContext { - constructor(mm: boolean) { - this.globalState = new MockMemento(mm); - this.secrets = { - onDidChange: {} as any, - get(key: string): Thenable { - return Promise.resolve(undefined); - }, - store(key: string, value: string): Thenable { - return Promise.resolve(); - }, - delete(key: string): Thenable { - return Promise.resolve(); - }, - }; - this.extension = { - packageJSON: { - version: 'v55.5.5', - aiKey: 'fakeAIKey', - name: 'salesforcedx-vscode-lwc', - serverPath: [ - 'node_modules', - '@salesforce', - 'lwc-language-server', - 'lib', - 'server.js' - ] - } - } as any; - } - secrets: SecretStorage; - extension: Extension; - public storageUri: Uri | undefined; - public globalStorageUri: Uri = Uri.parse('file://globalStorage'); - public logUri = Uri.parse('file://logUri'); - public extensionMode = ExtensionMode.Test; - public extensionUri = Uri.parse('file://test'); - public environmentVariableCollection = new MockEnvironmentVariableCollection(); - public subscriptions: Array<{ dispose(): any }> = []; - public workspaceState!: Memento; - public globalState: Memento & { setKeysForSync(keys: readonly string[]): void; }; - public extensionPath: string = 'myExtensionPath'; - public globalStoragePath = 'globalStatePath'; - public logPath = 'logPath'; - public asAbsolutePath(relativePath: string): string { - return path.join('../../package.json'); // this should point to the src/package.json - } - public storagePath: string = 'myStoragePath'; -} diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/activation/activationMode.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/activation/activationMode.test.ts deleted file mode 100644 index 1abc624a23..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/activation/activationMode.test.ts +++ /dev/null @@ -1,153 +0,0 @@ -import * as chai from 'chai'; -import { activate } from '../../../src/index'; -import * as constants from '../../../src/constants'; -import * as vscode from 'vscode'; -import sinon, { stubInterface, stubObject } from 'ts-sinon'; -import * as sinonChai from 'sinon-chai'; -import { shared as lspCommon } from '@salesforce/lightning-lsp-common'; -import { MockExtensionContext } from './MockExtensionContext'; -import { expect, assert } from 'chai'; - -chai.use(sinonChai); - -describe('activation modes', () => { - const sandbox = sinon.createSandbox(); - let mockExtensionContext: vscode.ExtensionContext; - - beforeEach(function() { - sandbox.spy(constants, 'log'); - - mockExtensionContext = stubInterface(); - - // @ts-ignore - mockExtensionContext.subscriptions = []; - - // @ts-ignore - mockExtensionContext.asAbsolutePath = path => { - return path; - }; - }); - - afterEach(function() { - sandbox.restore(); - }); - - it('activates every time when activationMode is set to always', async function() { - const EXPECTED = 'always'; - // create vscode extensionContext - mockExtensionContext = new MockExtensionContext(true); - const mockConfiguration = stubObject( - vscode.workspace.getConfiguration('salesforcedx-vscode-lightning'), - { - get: EXPECTED - } - ); - sandbox - .stub(vscode.workspace, 'getConfiguration') - .returns(mockConfiguration); - - const stub = sandbox.stub(vscode.commands, 'registerCommand'); - - await activate(mockExtensionContext); - - assert(stub.called); - }); - - it('activates every time when activationMode is set to always for non LWC projects', async function() { - const EXPECTED = 'always'; - // create vscode extensionContext - mockExtensionContext = new MockExtensionContext(true); - const mockConfiguration = stubObject( - vscode.workspace.getConfiguration('salesforcedx-vscode-lightning'), - { - get: EXPECTED - } - ); - sandbox - .stub(vscode.workspace, 'getConfiguration') - .returns(mockConfiguration); - sandbox.stub(lspCommon, 'isLWC').returns(false); - const stub = sandbox.stub(vscode.commands, 'registerCommand'); - - await activate(mockExtensionContext); - - assert(stub.called); - }); - - it('does not activate when activationMode is set to off', async function() { - const logMessage = - 'LWC Language Server activationMode set to off, exiting...'; - const EXPECTED = 'off'; - - const mockConfiguration = stubObject( - vscode.workspace.getConfiguration('salesforcedx-vscode-lightning'), - { - get: EXPECTED - } - ); - sandbox - .stub(vscode.workspace, 'getConfiguration') - .returns(mockConfiguration); - - sandbox - .mock(vscode.commands) - .expects('registerCommand') - .never(); - - await activate(mockExtensionContext); - - // Verify that we do not call vscode.commands.registerCommand at all - // We can also verify that we logged the message - expect(constants.log).calledWith(logMessage); - }); - - it('conditionally activates when activationMode is set to autodetect for LWC projects', async function() { - const EXPECTED = 'autodetect'; - // create vscode extensionContext - mockExtensionContext = new MockExtensionContext(true); - const mockConfiguration = stubObject( - vscode.workspace.getConfiguration('salesforcedx-vscode-lightning'), - { - get: EXPECTED - } - ); - - sandbox.stub(lspCommon, 'isLWC').returns(true); - - sandbox - .stub(vscode.workspace, 'getConfiguration') - .returns(mockConfiguration); - - const stub = sandbox.stub(vscode.commands, 'registerCommand'); - - await activate(mockExtensionContext); - - assert(stub.called); - }); - - it('does not activate when activationMode is set to autodetect for non-LWC projects', async function() { - const EXPECTED = 'autodetect'; - // create vscode extensionContext - mockExtensionContext = new MockExtensionContext(true); - const mockConfiguration = stubObject( - vscode.workspace.getConfiguration('salesforcedx-vscode-lightning'), - { - get: EXPECTED - } - ); - - sandbox.stub(lspCommon, 'isLWC').returns(false); - - sandbox - .stub(vscode.workspace, 'getConfiguration') - .returns(mockConfiguration); - - // Verify - sandbox - .mock(vscode.commands) - .expects('registerCommand') - .never(); - - await activate(mockExtensionContext); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/commandUtils.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/commandUtils.test.ts deleted file mode 100644 index ea2b325c61..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/commandUtils.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as sinon from 'sinon'; -import { showError } from '../../../src/commands/commandUtils'; -import { - ChannelService, - notificationService -} from '@salesforce/salesforcedx-utils-vscode'; -import { telemetryService } from '../../../src/telemetry'; - -describe('command utilities', () => { - describe('showError', () => { - it('should call the telemetry service', async () => { - const spy = sinon.spy(telemetryService, 'sendException'); - - showError( - new Error('test error message'), - 'lightning_lwc_start_test', - 'SFDX: Start Local Development Server' - ); - - sinon.assert.calledOnce(spy); - sinon.assert.calledWith( - spy, - `lightning_lwc_start_test_error`, - 'test error message' - ); - - spy.restore(); - }); - - it('should call the notification service', () => { - const spy = sinon.spy(notificationService, 'showErrorMessage'); - - showError( - new Error('test error message'), - 'lightning_lwc_start_test', - 'SFDX: Start Local Development Server' - ); - - sinon.assert.calledTwice(spy); - sinon.assert.calledWith( - spy, - sinon.match('SFDX: Start Local Development Server') - ); - - spy.restore(); - }); - - it('should send a message to the channel', () => { - const spy = sinon.spy(ChannelService.prototype, 'appendLine'); - - showError( - new Error('test error message'), - 'lightning_lwc_start_test', - 'SFDX: Start Local Development Server' - ); - - sinon.assert.calledOnce(spy); - sinon.assert.calledWith(spy, `Error: test error message`); - - spy.restore(); - }); - - it('should show the channel output', () => { - const spy = sinon.spy(ChannelService.prototype, 'showChannelOutput'); - - showError( - new Error('test error message'), - 'lightning_lwc_start_test', - 'SFDX: Start Local Development Server' - ); - - sinon.assert.calledOnce(spy); - - spy.restore(); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcOpen.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcOpen.test.ts deleted file mode 100644 index c2483817ec..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcOpen.test.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as sinon from 'sinon'; -import { SinonSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { DEV_SERVER_DEFAULT_BASE_URL } from '../../../src/commands/commandConstants'; -import * as commandUtils from '../../../src/commands/commandUtils'; -import { lightningLwcOpen } from '../../../src/commands/lightningLwcOpen'; -import { DevServerService } from '../../../src/service/devServerService'; - -describe('lightningLwcOpen', () => { - let sandbox: SinonSandbox; - let devServiceStub: any; - let openBrowserStub: SinonStub<[string], Thenable>; - - beforeEach(() => { - sandbox = sinon.createSandbox(); - devServiceStub = sinon.createStubInstance(DevServerService); - sandbox.stub(DevServerService, 'instance').get(() => devServiceStub); - openBrowserStub = sandbox.stub(commandUtils, 'openBrowser'); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('calls openBrowser when a server is already running', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - devServiceStub.getBaseUrl.returns(DEV_SERVER_DEFAULT_BASE_URL); - - await lightningLwcOpen(); - - sinon.assert.calledOnce(openBrowserStub); - sinon.assert.calledWith( - openBrowserStub, - sinon.match(DEV_SERVER_DEFAULT_BASE_URL) - ); - }); - - it('starts the server if it is not running yet', async () => { - devServiceStub.isServerHandlerRegistered.returns(false); - - const executeCommandStub = sandbox.stub(vscode.commands, 'executeCommand'); - - await lightningLwcOpen(); - - sinon.assert.calledOnce(executeCommandStub); - sinon.assert.calledWith(executeCommandStub, 'sf.lightning.lwc.start'); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcPreview.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcPreview.test.ts deleted file mode 100644 index 1ab7d639a4..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcPreview.test.ts +++ /dev/null @@ -1,1427 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { SfCommandlet } from '@salesforce/salesforcedx-utils-vscode'; -import { - CliCommandExecution, - CliCommandExecutor, - Command, - CommandBuilder, - CommandExecution, - CommandOutput, - SfCommandBuilder -} from '@salesforce/salesforcedx-utils-vscode'; -import { CancellationToken } from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import { Subject } from 'rxjs/Subject'; -import * as sinon from 'sinon'; -import { SinonSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import URI from 'vscode-uri'; -import { - DEV_SERVER_PREVIEW_ROUTE, - DEV_SERVER_DEFAULT_BASE_URL -} from '../../../src/commands/commandConstants'; -import * as commandUtils from '../../../src/commands/commandUtils'; -import { - DeviceQuickPickItem, - directoryLevelUp, - getProjectRootDirectory, - lwcPreview, - PlatformName, - platformOptions -} from '../../../src/commands/lightningLwcPreview'; -import { nls } from '../../../src/messages'; -import { DevServerService } from '../../../src/service/devServerService'; -import { WorkspaceUtils } from '../../../src/util/workspaceUtils'; -import { - ChannelService, - notificationService -} from '@salesforce/salesforcedx-utils-vscode'; - -const sfDeviceListCommand = 'force:lightning:local:device:list'; -const sfMobilePreviewCommand = 'force:lightning:lwc:preview'; -const rememberDeviceKey = 'preview.rememberDevice'; -const logLevelKey = 'preview.logLevel'; -const defaultLogLevel = 'warn'; -const androidSuccessString = 'Launching... Opening Browser'; - -const iOSPickedDevice: DeviceQuickPickItem = { - label: 'iPhone 8', - detail: 'iOS 13.3', - name: 'iPhone 8' -}; -const iOSDeviceListJson = ` - { - "status":0, - "result":[ - { - "name":"iPhone 8", - "udid":"6CC16032-2671-4BD2-8FF1-0E314945010C", - "state":"Shutdown", - "runtimeId":"iOS 13.3", - "isAvailable":true - }, - { - "name":"LWCSimulator", - "udid":"09D522C8-DC85-4259-AD15-15D36672D2EA", - "state":"Shutdown", - "runtimeId":"iOS 13.3", - "isAvailable":true - } - ] - } -`; - -const androidPickedDevice: DeviceQuickPickItem = { - label: 'Pixel API 29', - detail: 'Google APIs, API 29', - name: 'Pixel_API_29' -}; -const androidDeviceListJson = ` - { - "status":0, - "result":[ - { - "name":"emu2", - "displayName":"emu2", - "deviceName":"pixel", - "path":"/Users/maliroteh/.android/avd/emu2.avd", - "target":"Default Android System Image", - "api":"API 29" - }, - { - "name":"Pixel_API_29", - "displayName":"Pixel API 29", - "deviceName":"pixel", - "path":"/Users/maliroteh/.android/avd/Pixel_API_29.avd", - "target":"Google APIs", - "api":"API 29" - } - ] - } -`; - -const pickedApp: vscode.QuickPickItem = { - label: 'LWC Test App', - detail: 'com.salesforce.mobile-tooling.lwc-test-app' -}; -const appConfigFileJson = ` -{ - "apps": { - "ios": [ - { - "id": "com.salesforce.mobile-tooling.lwc-test-app", - "name": "LWC Test App", - "get_app_bundle": "configure_test_app.js", - "launch_arguments": [ - { "name": "arg1", "value": "val1" }, - { "name": "arg2", "value": "val2" } - ] - } - ], - "android": [ - { - "id": "com.salesforce.mobile-tooling.lwc-test-app", - "name": "LWC Test App", - "activity": ".MainActivity", - "get_app_bundle": "configure_test_app.js", - "launch_arguments": [ - { "name": "arg1", "value": "val1" }, - { "name": "arg2", "value": "val2" } - ] - } - ] - } -} -`; - -describe('lightningLwcPreview - lwcPreview ', () => { - let sandbox: SinonSandbox; - let devServiceStub: any; - let openBrowserStub: SinonStub<[string], Thenable>; - let existsSyncStub: sinon.SinonStub<[fs.PathLike], boolean>; - let lstatSyncStub: sinon.SinonStub; - let showErrorMessageStub: sinon.SinonStub; - let isSFContainerModeStub: sinon.SinonStub; - const root = /^win32/.test(process.platform) ? 'c:\\' : '/var'; - const mockLwcFileDirectory = path.join( - root, - 'project', - 'force-app', - 'main', - 'default', - 'lwc', - 'foo' - ); - const mockLwcFileDirectoryUri = URI.file(mockLwcFileDirectory); - const mockLwcFilePath = path.join(mockLwcFileDirectory, 'foo.js'); - const mockLwcFilePathUri = URI.file(mockLwcFilePath); - const notLwcModulePath = path.join(root, 'foo'); - const notLwcModulePathUri = URI.file(notLwcModulePath); - const nonExistentPath = path.join(root, 'foo'); - const nonExistentPathUri = URI.file(nonExistentPath); - let showQuickPickStub: sinon.SinonStub; - let showInputBoxStub: sinon.SinonStub; - let getConfigurationStub: sinon.SinonStub; - let getGlobalStoreStub: sinon.SinonStub; - let cmdWithArgSpy: sinon.SinonSpy<[string], CommandBuilder>; - let cmdWithFlagSpy: sinon.SinonSpy<[string, string], CommandBuilder>; - let mobileExecutorStub: sinon.SinonStub< - [(CancellationToken | undefined)?], - CliCommandExecution | MockExecution - >; - let commandOutputStub: sinon.SinonStub<[CommandExecution], Promise>; - let mockExecution: MockExecution; - let showWarningMessageSpy: sinon.SinonSpy; - let successInfoMessageSpy: sinon.SinonSpy; - let streamCommandOutputSpy: sinon.SinonSpy; - let appendLineSpy: sinon.SinonSpy; - - const desktopQuickPick = platformOptions[0]; - const androidQuickPick = platformOptions[1]; - const iOSQuickPick = platformOptions[2]; - const rememberedAndroidDevice = 'rememberedAndroid'; - const rememberediOSDevice = 'rememberediOS'; - - class MockMemento implements vscode.Memento { - keys(): readonly string[] { - throw new Error('Method not implemented.'); - } - public get(key: string): T | undefined { - switch (key) { - case `last${PlatformName.Android}Device`: - return rememberedAndroidDevice as unknown as T; - case `last${PlatformName.iOS}Device`: - return rememberediOSDevice as unknown as T; - default: - return undefined; - } - } - public update(key: string, value: any): Thenable { - return Promise.resolve(); - } - } - - class MockWorkspace implements vscode.WorkspaceConfiguration { - // tslint:disable-next-line:member-access - shouldRemember = false; - // tslint:disable-next-line:member-access - loglevel = defaultLogLevel; - - constructor(shouldRemember: boolean, loglevel?: string) { - this.shouldRemember = shouldRemember; - if (loglevel !== undefined) { - this.loglevel = loglevel; - } - } - - readonly [key: string]: any; - public get(section: string): T | undefined; - public get(section: string, defaultValue: T): T; - public get(section: any, defaultValue?: any) { - switch (section) { - case logLevelKey: - return this.loglevel; - case rememberDeviceKey: - return this.shouldRemember; - default: - return undefined; - } - } - public has(section: string): boolean { - return this.shouldRemember; - } - public inspect(section: string): - | { - key: string; - defaultValue?: T | undefined; - globalValue?: T | undefined; - workspaceValue?: T | undefined; - workspaceFolderValue?: T | undefined; - } - | undefined { - return undefined; - } - public update( - section: string, - value: any, - configurationTarget?: boolean | vscode.ConfigurationTarget | undefined - ): Thenable { - return Promise.resolve(); - } - } - - class MockExecution implements CommandExecution { - public command: Command; - public processExitSubject: Subject; - public processErrorSubject: Subject; - public stdoutSubject: Subject; - public stderrSubject: Subject; - - constructor(command: Command) { - this.command = command; - this.processExitSubject = new Subject(); - this.processErrorSubject = new Subject(); - this.stdoutSubject = new Subject(); - this.stderrSubject = new Subject(); - } - - public killExecution(): Promise { - return Promise.resolve(); - } - } - - beforeEach(() => { - sandbox = sinon.createSandbox(); - devServiceStub = sinon.createStubInstance(DevServerService); - sandbox.stub(DevServerService, 'instance').get(() => devServiceStub); - openBrowserStub = sandbox.stub(commandUtils, 'openBrowser'); - existsSyncStub = sandbox.stub(fs, 'existsSync'); - lstatSyncStub = sandbox.stub(fs, 'lstatSync'); - showErrorMessageStub = sandbox.stub( - notificationService, - 'showErrorMessage' - ); - showQuickPickStub = sandbox.stub(vscode.window, 'showQuickPick'); - showInputBoxStub = sandbox.stub(vscode.window, 'showInputBox'); - getConfigurationStub = sandbox.stub( - WorkspaceUtils.prototype, - 'getWorkspaceSettings' - ); - getGlobalStoreStub = sandbox.stub( - WorkspaceUtils.prototype, - 'getGlobalStore' - ); - cmdWithArgSpy = sandbox.spy(SfCommandBuilder.prototype, 'withArg'); - cmdWithFlagSpy = sandbox.spy(SfCommandBuilder.prototype, 'withFlag'); - mockExecution = new MockExecution(new SfCommandBuilder().build()); - mobileExecutorStub = sinon.stub(CliCommandExecutor.prototype, 'execute'); - mobileExecutorStub.returns(mockExecution); - commandOutputStub = sinon.stub(CommandOutput.prototype, 'getCmdResult'); - commandOutputStub.returns(Promise.resolve('{}')); - showWarningMessageSpy = sandbox.spy(vscode.window, 'showWarningMessage'); - successInfoMessageSpy = sandbox.spy( - vscode.window, - 'showInformationMessage' - ); - streamCommandOutputSpy = sandbox.stub( - ChannelService.prototype, - 'streamCommandOutput' - ); - appendLineSpy = sinon.spy(ChannelService.prototype, 'appendLine'); - }); - - afterEach(() => { - sinon.restore(); - sandbox.restore(); - cmdWithArgSpy.restore(); - cmdWithFlagSpy.restore(); - showWarningMessageSpy.restore(); - successInfoMessageSpy.restore(); - mobileExecutorStub.restore(); - commandOutputStub.restore(); - streamCommandOutputSpy.restore(); - appendLineSpy.restore(); - }); - - function mockFileExists(mockPath: string) { - existsSyncStub.callsFake(fsPath => { - if ( - path.normalize(fsPath.toString()).toLowerCase() === - path.normalize(mockPath).toLowerCase() - ) { - return true; - } else { - return false; - } - }); - } - - it('exists sync called with correct path', async () => { - // Returns false for remembered device settings. - getConfigurationStub.returns(new MockWorkspace(false)); - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(mockLwcFilePath); - - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - showQuickPickStub.resolves(desktopQuickPick); - await lwcPreview(mockLwcFilePathUri); - - sinon.assert.calledOnce(openBrowserStub); - sinon.assert.calledOnce(existsSyncStub); - sinon.assert.calledWith( - existsSyncStub, - /^win32/.test(process.platform) - ? 'c:\\project\\force-app\\main\\default\\lwc\\foo\\foo.js' - : '/var/project/force-app/main/default/lwc/foo/foo.js' - ); - }); - - it('calls openBrowser with the correct url for files', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - devServiceStub.getBaseUrl.returns(DEV_SERVER_DEFAULT_BASE_URL); - devServiceStub.getComponentPreviewUrl.returns( - 'http://localhost:3333/preview/c/foo' - ); - getConfigurationStub.returns(new MockWorkspace(false)); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - showQuickPickStub.resolves(desktopQuickPick); - - await lwcPreview(mockLwcFilePathUri); - - sinon.assert.calledWith( - devServiceStub.getComponentPreviewUrl, - sinon.match('c/foo') - ); - sinon.assert.calledOnce(openBrowserStub); - sinon.assert.calledWith( - openBrowserStub, - sinon.match( - `${DEV_SERVER_DEFAULT_BASE_URL}/${DEV_SERVER_PREVIEW_ROUTE}/c/foo` - ) - ); - }); - - it('calls openBrowser with the correct url for directories', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - devServiceStub.getComponentPreviewUrl.returns( - 'http://localhost:3333/preview/c/foo' - ); - mockFileExists(mockLwcFileDirectory); - getConfigurationStub.returns(new MockWorkspace(false)); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - showQuickPickStub.resolves(desktopQuickPick); - - await lwcPreview(mockLwcFileDirectoryUri); - - sinon.assert.calledWith( - devServiceStub.getComponentPreviewUrl, - sinon.match('c/foo') - ); - sinon.assert.calledOnce(openBrowserStub); - sinon.assert.calledWith( - openBrowserStub, - sinon.match('http://localhost:3333/preview/c/foo') - ); - }); - - it('starts the server if it is not running when desktop selected', async () => { - devServiceStub.isServerHandlerRegistered.returns(false); - mockFileExists(mockLwcFilePath); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - showQuickPickStub.resolves(desktopQuickPick); - const commandletStub = sandbox.stub(SfCommandlet.prototype, 'run'); - await lwcPreview(mockLwcFilePathUri); - - sinon.assert.calledOnce(commandletStub); - }); - - it('starts the server if it is not running when Android selected', async () => { - await doStartServerTest(true); - }); - - it('starts the server if it is not running when iOS selected', async () => { - await doStartServerTest(false); - }); - - async function doStartServerTest(isAndroid: Boolean) { - const platform = isAndroid ? PlatformName.Android : PlatformName.iOS; - const deviceName = isAndroid ? 'SFDXEmulator' : 'SFDXSimulator'; - devServiceStub.isServerHandlerRegistered.returns(false); - mockFileExists(mockLwcFilePath); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(isAndroid ? androidQuickPick : iOSQuickPick); - showInputBoxStub.resolves(''); - const commandletStub = sandbox.stub(SfCommandlet.prototype, 'run'); - await lwcPreview(mockLwcFilePathUri); - - if (isAndroid) { - mockExecution.stdoutSubject.next(androidSuccessString); - } else { - mockExecution.processExitSubject.next(0); - } - - sinon.assert.calledOnce(showQuickPickStub); - sinon.assert.calledOnce(showInputBoxStub); - sinon.assert.calledOnce(commandletStub); - expect(cmdWithArgSpy.callCount).to.equal(2); - expect(cmdWithArgSpy.getCall(0).args[0]).equals(sfDeviceListCommand); - expect(cmdWithArgSpy.getCall(1).args[0]).equals(sfMobilePreviewCommand); - expect(cmdWithFlagSpy.callCount).to.equal(7); - expect(cmdWithFlagSpy.getCall(0).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(1).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(2).args).to.have.same.members([ - '-t', - deviceName - ]); - expect(cmdWithFlagSpy.getCall(3).args).to.have.same.members([ - '-n', - 'c/foo' - ]); - expect(cmdWithFlagSpy.getCall(4).args).to.have.same.members([ - '-a', - 'browser' - ]); - expect(cmdWithFlagSpy.getCall(5).args).to.have.same.members([ - '-d', - mockLwcFileDirectory - ]); - expect(cmdWithFlagSpy.getCall(6).args).to.have.same.members([ - '--loglevel', - 'warn' - ]); - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - expect(successInfoMessageSpy.callCount).to.equal(1); - expect( - successInfoMessageSpy.calledWith( - isAndroid - ? nls.localize('lightning_lwc_android_start', deviceName) - : nls.localize('lightning_lwc_ios_start', deviceName) - ) - ); - } - - it('shows an error when source path is not recognized as an lwc module file', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(notLwcModulePath); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - showQuickPickStub.resolves(desktopQuickPick); - - await lwcPreview(notLwcModulePathUri); - - sinon.assert.calledWith( - showErrorMessageStub, - sinon.match( - nls.localize( - `lightning_lwc_preview_unsupported`, - /^win32/.test(process.platform) ? 'c:\\foo' : '/var/foo' - ) - ) - ); - }); - - it('shows an error when source path does not exist', async () => { - mockFileExists(nonExistentPath); - devServiceStub.isServerHandlerRegistered.returns(true); - existsSyncStub.returns(false); - showQuickPickStub.resolves(desktopQuickPick); - - await lwcPreview(nonExistentPathUri); - - sinon.assert.calledWith( - showErrorMessageStub, - sinon.match( - nls.localize( - `lightning_lwc_preview_file_nonexist`, - /^win32/.test(process.platform) ? 'c:\\foo' : '/var/foo' - ) - ) - ); - }); - - it('shows an error message when open browser throws an error', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(mockLwcFileDirectory); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - - showQuickPickStub.resolves(desktopQuickPick); - openBrowserStub.throws('test error'); - - await lwcPreview(mockLwcFileDirectoryUri); - - const commandName = nls.localize(`lightning_lwc_preview_text`); - sinon.assert.calledTwice(showErrorMessageStub); - sinon.assert.calledWith( - showErrorMessageStub, - sinon.match(nls.localize('command_failure', commandName)) - ); - }); - - it('calls SFDX preview with the correct url for files', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(androidQuickPick); - showInputBoxStub.resolves(''); - await lwcPreview(mockLwcFilePathUri); - mockExecution.stdoutSubject.next(androidSuccessString); - - sinon.assert.calledOnce(showQuickPickStub); - sinon.assert.calledOnce(showInputBoxStub); - expect(cmdWithArgSpy.callCount).to.equal(2); - expect(cmdWithArgSpy.getCall(0).args[0]).equals(sfDeviceListCommand); - expect(cmdWithArgSpy.getCall(1).args[0]).equals(sfMobilePreviewCommand); - expect(cmdWithFlagSpy.callCount).to.equal(7); - expect(cmdWithFlagSpy.getCall(0).args).to.have.same.members([ - '-p', - PlatformName.Android - ]); - expect(cmdWithFlagSpy.getCall(1).args).to.have.same.members([ - '-p', - PlatformName.Android - ]); - expect(cmdWithFlagSpy.getCall(2).args).to.have.same.members([ - '-t', - 'SFDXEmulator' - ]); - expect(cmdWithFlagSpy.getCall(3).args).to.have.same.members([ - '-n', - 'c/foo' - ]); - expect(cmdWithFlagSpy.getCall(4).args).to.have.same.members([ - '-a', - 'browser' - ]); - expect(cmdWithFlagSpy.getCall(5).args).to.have.same.members([ - '-d', - mockLwcFileDirectory - ]); - expect(cmdWithFlagSpy.getCall(6).args).to.have.same.members([ - '--loglevel', - 'warn' - ]); - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - expect(successInfoMessageSpy.callCount).to.equal(1); - }); - - it('calls SFDX preview with the correct url for directories', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(iOSQuickPick); - showInputBoxStub.resolves(''); - await lwcPreview(mockLwcFileDirectoryUri); - mockExecution.processExitSubject.next(0); - - sinon.assert.calledOnce(showQuickPickStub); - sinon.assert.calledOnce(showInputBoxStub); - expect(cmdWithArgSpy.callCount).to.equal(2); - expect(cmdWithArgSpy.getCall(0).args[0]).equals(sfDeviceListCommand); - expect(cmdWithArgSpy.getCall(1).args[0]).equals(sfMobilePreviewCommand); - expect(cmdWithFlagSpy.callCount).to.equal(7); - expect(cmdWithFlagSpy.getCall(0).args).to.have.same.members([ - '-p', - PlatformName.iOS - ]); - expect(cmdWithFlagSpy.getCall(1).args).to.have.same.members([ - '-p', - PlatformName.iOS - ]); - expect(cmdWithFlagSpy.getCall(2).args).to.have.same.members([ - '-t', - 'SFDXSimulator' - ]); - expect(cmdWithFlagSpy.getCall(3).args).to.have.same.members([ - '-n', - 'c/foo' - ]); - expect(cmdWithFlagSpy.getCall(4).args).to.have.same.members([ - '-a', - 'browser' - ]); - expect(cmdWithFlagSpy.getCall(5).args).to.have.same.members([ - '-d', - mockLwcFileDirectoryUri.fsPath - ]); - expect(cmdWithFlagSpy.getCall(6).args).to.have.same.members([ - '--loglevel', - 'warn' - ]); - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - expect(successInfoMessageSpy.callCount).to.equal(1); - }); - - it('shows an error when source path is not recognized as an lwc module file', async () => { - mockFileExists(notLwcModulePath); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(androidQuickPick); - showInputBoxStub.resolves('test'); - await lwcPreview(notLwcModulePathUri); - - sinon.assert.calledWith( - showErrorMessageStub, - sinon.match( - nls.localize( - `lightning_lwc_preview_unsupported`, - /^win32/.test(process.platform) ? 'c:\\foo' : '/var/foo' - ) - ) - ); - sinon.assert.notCalled(mobileExecutorStub); - expect(successInfoMessageSpy.callCount).to.equal(0); - }); - - it('shows an error when source path does not exist', async () => { - mockFileExists(nonExistentPath); - existsSyncStub.returns(false); - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(androidQuickPick); - showInputBoxStub.resolves(undefined); - await lwcPreview(nonExistentPathUri); - - sinon.assert.calledWith( - showErrorMessageStub, - sinon.match( - nls.localize( - `lightning_lwc_preview_file_nonexist`, - /^win32/.test(process.platform) ? 'c:\\foo' : '/var/foo' - ) - ) - ); - sinon.assert.notCalled(mobileExecutorStub); - expect(successInfoMessageSpy.callCount).to.equal(0); - }); - - it('calls SFDX preview with specified Android device name', async () => { - await doSpecifiedDeviceTest(true); - }); - - it('calls SFDX preview with specified iOS device name', async () => { - await doSpecifiedDeviceTest(false); - }); - - async function doSpecifiedDeviceTest(isAndroid: Boolean) { - const deviceName = isAndroid ? 'androidtestname' : 'iostestname'; - const platform = isAndroid ? PlatformName.Android : PlatformName.iOS; - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(mockLwcFileDirectory); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(isAndroid ? androidQuickPick : iOSQuickPick); - showInputBoxStub.resolves(deviceName); - - await lwcPreview(mockLwcFileDirectoryUri); - if (isAndroid) { - mockExecution.stdoutSubject.next(androidSuccessString); - } else { - mockExecution.processExitSubject.next(0); - } - - sinon.assert.calledOnce(showQuickPickStub); - sinon.assert.calledOnce(showInputBoxStub); - expect(cmdWithFlagSpy.getCall(0).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(1).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(2).args).to.have.same.members([ - '-t', - deviceName - ]); - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - expect(successInfoMessageSpy.callCount).to.equal(1); - expect( - successInfoMessageSpy.calledWith( - isAndroid - ? nls.localize('lightning_lwc_android_start', deviceName) - : nls.localize('lightning_lwc_ios_start', deviceName) - ) - ); - } - - it('calls SFDX preview with remembered Android device name', async () => { - await doRememberedDeviceTest(true); - }); - - it('calls SFDX preview with remembered iOS device name', async () => { - await doRememberedDeviceTest(false); - }); - - async function doRememberedDeviceTest(isAndroid: Boolean) { - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(mockLwcFilePath); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(true)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(isAndroid ? androidQuickPick : iOSQuickPick); - showInputBoxStub.resolves(''); - await lwcPreview(mockLwcFilePathUri); - - if (isAndroid) { - mockExecution.stdoutSubject.next(androidSuccessString); - } else { - mockExecution.processExitSubject.next(0); - } - - sinon.assert.calledOnce(showQuickPickStub); - sinon.assert.calledOnce(showInputBoxStub); - - const platform = isAndroid ? PlatformName.Android : PlatformName.iOS; - const deviceName = isAndroid - ? rememberedAndroidDevice - : rememberediOSDevice; - - expect(cmdWithFlagSpy.getCall(0).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(1).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(2).args).to.have.same.members([ - '-t', - deviceName - ]); - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - expect(successInfoMessageSpy.callCount).to.equal(1); - expect( - successInfoMessageSpy.calledWith( - isAndroid - ? nls.localize('lightning_lwc_android_start', deviceName) - : nls.localize('lightning_lwc_ios_start', deviceName) - ) - ); - } - - it('shows warning when you cancel Android device name input', async () => { - await doCancelledExecutionTest(true); - }); - - it('shows warning when you cancel iOS device name input', async () => { - await doCancelledExecutionTest(false); - }); - - async function doCancelledExecutionTest(isAndroid: Boolean) { - mockFileExists(mockLwcFilePath); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(true)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(isAndroid ? androidQuickPick : iOSQuickPick); - // This simulates the user hitting the escape key to cancel input. - showInputBoxStub.resolves(undefined); - await lwcPreview(mockLwcFilePathUri); - - sinon.assert.calledOnce(showQuickPickStub); - sinon.assert.calledOnce(showInputBoxStub); - expect(cmdWithArgSpy.callCount).to.equal(1); - expect(cmdWithFlagSpy.callCount).to.equal(1); - sinon.assert.calledOnce(mobileExecutorStub); // device list only (no preview) - expect( - showWarningMessageSpy.calledWith( - nls.localize('lightning_lwc_operation_cancelled') - ) - ); - } - - it('shows error in console when Android SFDX execution fails', async () => { - await doFailedExecutionTest(true); - }); - - it('shows error in console when iOS SFDX execution fails', async () => { - await doFailedExecutionTest(false); - }); - - async function doFailedExecutionTest(isAndroid: Boolean) { - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(mockLwcFilePath); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(isAndroid ? androidQuickPick : iOSQuickPick); - showInputBoxStub.resolves(''); - await lwcPreview(mockLwcFilePathUri); - mockExecution.processExitSubject.next(1); - - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - sinon.assert.calledTwice(showErrorMessageStub); - sinon.assert.calledWith( - showErrorMessageStub, - sinon.match( - isAndroid - ? nls.localize( - 'lightning_lwc_android_failure', - androidQuickPick.defaultTargetName - ) - : nls.localize( - 'lightning_lwc_ios_failure', - iOSQuickPick.defaultTargetName - ) - ) - ); - sinon.assert.calledOnce(streamCommandOutputSpy); - expect(successInfoMessageSpy.callCount).to.equal(0); - } - - it('shows install message if sfdx plugin is not installed', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(mockLwcFilePath); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(androidQuickPick); - showInputBoxStub.resolves(''); - - commandOutputStub.returns( - Promise.reject(`${sfDeviceListCommand} is not a sf command.`) - ); - - await lwcPreview(mockLwcFilePathUri); - - sinon.assert.calledOnce(mobileExecutorStub); // device list only - - sinon.assert.calledWith( - showErrorMessageStub, - sinon.match(nls.localize('lightning_lwc_no_mobile_plugin')) - ); - - sinon.assert.notCalled(streamCommandOutputSpy); - sinon.assert.notCalled(successInfoMessageSpy); - - sinon.assert.calledOnce(appendLineSpy); - expect( - appendLineSpy.calledWith(nls.localize('lightning_lwc_no_mobile_plugin')) - ); - }); - - it('correct log level is used when the setting is changed', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(mockLwcFilePath); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(false, 'debug')); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub.resolves(androidQuickPick); - showInputBoxStub.resolves(''); - await lwcPreview(mockLwcFilePathUri); - mockExecution.stdoutSubject.next(androidSuccessString); - - sinon.assert.calledOnce(showQuickPickStub); - sinon.assert.calledOnce(showInputBoxStub); - expect(cmdWithArgSpy.callCount).to.equal(2); - expect(cmdWithArgSpy.getCall(0).args[0]).equals(sfDeviceListCommand); - expect(cmdWithArgSpy.getCall(1).args[0]).equals(sfMobilePreviewCommand); - expect(cmdWithFlagSpy.callCount).to.equal(7); - expect(cmdWithFlagSpy.getCall(0).args).to.have.same.members([ - '-p', - PlatformName.Android - ]); - expect(cmdWithFlagSpy.getCall(1).args).to.have.same.members([ - '-p', - PlatformName.Android - ]); - expect(cmdWithFlagSpy.getCall(2).args).to.have.same.members([ - '-t', - 'SFDXEmulator' - ]); - expect(cmdWithFlagSpy.getCall(3).args).to.have.same.members([ - '-n', - 'c/foo' - ]); - expect(cmdWithFlagSpy.getCall(4).args).to.have.same.members([ - '-a', - 'browser' - ]); - expect(cmdWithFlagSpy.getCall(5).args).to.have.same.members([ - '-d', - mockLwcFileDirectory - ]); - expect(cmdWithFlagSpy.getCall(6).args).to.have.same.members([ - '--loglevel', - 'debug' - ]); - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - expect(successInfoMessageSpy.callCount).to.equal(1); - }); - - it('Shows device pick list for Android devices', async () => { - await doDeviceListQuickPickTest(true); - }); - - it('Shows device pick list for iOS devices', async () => { - await doDeviceListQuickPickTest(false); - }); - - async function doDeviceListQuickPickTest(isAndroid: Boolean) { - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(mockLwcFileDirectory); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub - .onFirstCall() - .resolves(isAndroid ? androidQuickPick : iOSQuickPick); - showQuickPickStub - .onSecondCall() - .resolves(isAndroid ? androidPickedDevice : iOSPickedDevice); - commandOutputStub.returns( - Promise.resolve(isAndroid ? androidDeviceListJson : iOSDeviceListJson) - ); - - await lwcPreview(mockLwcFileDirectoryUri); - - if (isAndroid) { - mockExecution.stdoutSubject.next(androidSuccessString); - } else { - mockExecution.processExitSubject.next(0); - } - - sinon.assert.calledTwice(showQuickPickStub); // platform + device list - sinon.assert.notCalled(showInputBoxStub); - - const platform = isAndroid ? PlatformName.Android : PlatformName.iOS; - const deviceName = isAndroid - ? androidPickedDevice.name - : iOSPickedDevice.name; - - expect(cmdWithFlagSpy.getCall(0).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(1).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(2).args).to.have.same.members([ - '-t', - deviceName - ]); - - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - - expect(successInfoMessageSpy.callCount).to.equal(1); - expect( - successInfoMessageSpy.calledWith( - isAndroid - ? nls.localize('lightning_lwc_android_start', deviceName) - : nls.localize('lightning_lwc_ios_start', deviceName) - ) - ); - } - - it('Shows input box when choosing New from device pick list for Android devices', async () => { - await doNewDeviceQuickPickTest(true); - }); - - it('Shows input box when choosing New from device pick list for iOS devices', async () => { - await doNewDeviceQuickPickTest(false); - }); - - async function doNewDeviceQuickPickTest(isAndroid: Boolean) { - const deviceName = isAndroid ? 'androidtestname' : 'iostestname'; - const platform = isAndroid ? PlatformName.Android : PlatformName.iOS; - devServiceStub.isServerHandlerRegistered.returns(true); - mockFileExists(mockLwcFileDirectory); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub - .onFirstCall() - .resolves(isAndroid ? androidQuickPick : iOSQuickPick); - showQuickPickStub.onSecondCall().resolvesArg(0); - showInputBoxStub.resolves(deviceName); - commandOutputStub.returns( - Promise.resolve(isAndroid ? androidDeviceListJson : iOSDeviceListJson) - ); - - await lwcPreview(mockLwcFileDirectoryUri); - - if (isAndroid) { - mockExecution.stdoutSubject.next(androidSuccessString); - } else { - mockExecution.processExitSubject.next(0); - } - - sinon.assert.calledTwice(showQuickPickStub); // platform + device list - sinon.assert.calledOnce(showInputBoxStub); - - expect(cmdWithFlagSpy.getCall(0).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(1).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(2).args).to.have.same.members([ - '-t', - deviceName - ]); - - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - - expect(successInfoMessageSpy.callCount).to.equal(1); - expect( - successInfoMessageSpy.calledWith( - isAndroid - ? nls.localize('lightning_lwc_android_start', deviceName) - : nls.localize('lightning_lwc_ios_start', deviceName) - ) - ); - } - - it('Picks an app from app pick list for Android apps', async () => { - await doAppListQuickPickTest(true, pickedApp, false); - }); - - it('Picks an app from app pick list for iOS apps', async () => { - await doAppListQuickPickTest(false, pickedApp, false); - }); - - it('Picks browser from app pick list for Android apps', async () => { - await doAppListQuickPickTest(true, 'browser', true); - }); - - it('Picks browser from app pick list for iOS apps', async () => { - await doAppListQuickPickTest(false, 'browser', true); - }); - - async function doAppListQuickPickTest( - isAndroid: Boolean, - selectedApp: vscode.QuickPickItem | 'browser', - lwcLocationIsDirectory: boolean - ) { - const targetApp = - selectedApp === 'browser' ? 'browser' : selectedApp.detail; - - devServiceStub.isServerHandlerRegistered.returns(true); - if (lwcLocationIsDirectory) { - mockFileExists(mockLwcFileDirectory); - } else { - mockFileExists(mockLwcFilePath); - } - - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return lwcLocationIsDirectory; - } - } as fs.Stats); - sinon.stub(fs, 'readFileSync').returns(appConfigFileJson); - - getConfigurationStub.returns(new MockWorkspace(false)); - getGlobalStoreStub.returns(new MockMemento()); - showQuickPickStub - .onFirstCall() - .resolves(isAndroid ? androidQuickPick : iOSQuickPick); - showQuickPickStub - .onSecondCall() - .resolves(isAndroid ? androidPickedDevice : iOSPickedDevice); - if (selectedApp === 'browser') { - showQuickPickStub.onThirdCall().callsFake(args => { - const items = args as vscode.QuickPickItem[]; - return Promise.resolve(items[0]); - }); - } else { - showQuickPickStub.onThirdCall().resolves(selectedApp); - } - commandOutputStub.returns( - Promise.resolve(isAndroid ? androidDeviceListJson : iOSDeviceListJson) - ); - - await lwcPreview( - lwcLocationIsDirectory ? mockLwcFileDirectoryUri : mockLwcFilePathUri - ); - - if (isAndroid) { - mockExecution.stdoutSubject.next(androidSuccessString); - } else { - mockExecution.processExitSubject.next(0); - } - - sinon.assert.calledThrice(showQuickPickStub); // platform + device list + app list - - const platform = isAndroid ? PlatformName.Android : PlatformName.iOS; - const deviceName = isAndroid - ? androidPickedDevice.name - : iOSPickedDevice.name; - const projectRootDir = mockLwcFileDirectoryUri.fsPath; - const configFile = path.join(projectRootDir, 'mobile-apps.json'); - - expect(cmdWithFlagSpy.getCall(0).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(1).args).to.have.same.members([ - '-p', - platform - ]); - expect(cmdWithFlagSpy.getCall(2).args).to.have.same.members([ - '-t', - deviceName - ]); - expect(cmdWithFlagSpy.getCall(3).args).to.have.same.members([ - '-n', - 'c/foo' - ]); - expect(cmdWithFlagSpy.getCall(4).args).to.have.same.members([ - '-a', - targetApp - ]); - expect(cmdWithFlagSpy.getCall(5).args).to.have.same.members([ - '-d', - projectRootDir - ]); - - if (selectedApp === 'browser') { - expect(cmdWithFlagSpy.getCall(6).args).to.have.same.members([ - '--loglevel', - 'warn' - ]); - } else { - expect(cmdWithFlagSpy.getCall(6).args).to.have.same.members([ - '-f', - configFile - ]); - expect(cmdWithFlagSpy.getCall(7).args).to.have.same.members([ - '--loglevel', - 'warn' - ]); - } - - sinon.assert.calledTwice(mobileExecutorStub); // device list + preview - - expect(successInfoMessageSpy.callCount).to.equal(1); - expect( - successInfoMessageSpy.calledWith( - isAndroid - ? nls.localize('lightning_lwc_android_start', deviceName) - : nls.localize('lightning_lwc_ios_start', deviceName) - ) - ); - } - - it('Cancels Preview if user cancels platform selection', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - devServiceStub.getBaseUrl.returns(DEV_SERVER_DEFAULT_BASE_URL); - devServiceStub.getComponentPreviewUrl.returns( - 'http://localhost:3333/preview/c/foo' - ); - getConfigurationStub.returns(new MockWorkspace(false)); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - showQuickPickStub.resolves(undefined); - - await lwcPreview(mockLwcFilePathUri); - - sinon.assert.calledOnce(showQuickPickStub); // platform - sinon.assert.notCalled(cmdWithFlagSpy); - expect( - showWarningMessageSpy.calledWith( - nls.localize('lightning_lwc_operation_cancelled') - ) - ); - }); - - it('Cancels Preview if user cancels selecting target device', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - devServiceStub.getBaseUrl.returns(DEV_SERVER_DEFAULT_BASE_URL); - devServiceStub.getComponentPreviewUrl.returns( - 'http://localhost:3333/preview/c/foo' - ); - getConfigurationStub.returns(new MockWorkspace(false)); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - showQuickPickStub.onFirstCall().resolves(androidQuickPick); - showQuickPickStub.onSecondCall().resolves(undefined); - - await lwcPreview(mockLwcFilePathUri); - - sinon.assert.calledOnce(showQuickPickStub); // platform - sinon.assert.calledOnce(cmdWithFlagSpy); // device list - expect( - showWarningMessageSpy.calledWith( - nls.localize('lightning_lwc_operation_cancelled') - ) - ); - }); - - it('Cancels Preview if user cancels selecting target app', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - devServiceStub.getBaseUrl.returns(DEV_SERVER_DEFAULT_BASE_URL); - devServiceStub.getComponentPreviewUrl.returns( - 'http://localhost:3333/preview/c/foo' - ); - getConfigurationStub.returns(new MockWorkspace(false)); - existsSyncStub.returns(true); - lstatSyncStub.returns({ - isDirectory() { - return false; - } - } as fs.Stats); - showQuickPickStub.onFirstCall().resolves(androidQuickPick); - showQuickPickStub.onSecondCall().resolves(androidPickedDevice); - showQuickPickStub.onThirdCall().resolves(undefined); - - await lwcPreview(mockLwcFilePathUri); - - sinon.assert.calledOnce(showQuickPickStub); // platform + device list - sinon.assert.calledOnce(cmdWithFlagSpy); // device list - expect( - showWarningMessageSpy.calledWith( - nls.localize('lightning_lwc_operation_cancelled') - ) - ); - }); - - it('Directory Level Up', async () => { - expect( - directoryLevelUp(path.normalize('/my/path')) === path.normalize('/my') - ).to.be.true; - expect(directoryLevelUp(path.normalize('/my')) === path.normalize('/')).to - .be.true; - expect(directoryLevelUp(path.normalize('/')) === undefined).to.be.true; - }); - - it('Project Root Directory', async () => { - lstatSyncStub.returns({ - isDirectory() { - return true; - } - } as fs.Stats); - - // returns undefined for invalid path - expect( - getProjectRootDirectory(path.normalize('/invalidpath')) === undefined - ).to.be.true; - - // returns undefined when path is valid but sfdx-project.json not found - existsSyncStub.callsFake( - fsPath => path.normalize(fsPath as string) === path.normalize('/my/path') - ); - - // returns correct path when path is valid and sfdx-project.json is found - existsSyncStub.reset(); - existsSyncStub.callsFake( - fsPath => - path.normalize(fsPath as string) === path.normalize('/my/path') || - path.normalize(fsPath as string) === - path.normalize('/my/sfdx-project.json') - ); - expect( - getProjectRootDirectory(path.normalize('/my/path')) === - path.normalize('/my') - ).to.be.true; - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcStart.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcStart.test.ts deleted file mode 100644 index b24b0cb85a..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcStart.test.ts +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { SfCommandlet } from '@salesforce/salesforcedx-utils-vscode'; -import { - CliCommandExecutor, - Command, - CommandExecution -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import { Subject } from 'rxjs/Subject'; -import * as sinon from 'sinon'; -import { SinonSandbox, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { DEV_SERVER_DEFAULT_BASE_URL } from '../../../src/commands/commandConstants'; -import * as commandUtils from '../../../src/commands/commandUtils'; -import { - errorHints, - lightningLwcStart, - LightningLwcStartExecutor -} from '../../../src/commands/lightningLwcStart'; -import { nls } from '../../../src/messages'; -import { DevServerService } from '../../../src/service/devServerService'; -import { - CancellationToken, - CliCommandExecution, - ChannelService, - notificationService -} from '@salesforce/salesforcedx-utils-vscode'; - -class FakeExecution implements CommandExecution { - public command: Command; - public processExitSubject: Subject; - public processErrorSubject: Subject; - public stdoutSubject: Subject; - public stderrSubject: Subject; - private readonly childProcessPid: any; - - constructor(command: Command) { - this.command = command; - this.processExitSubject = new Subject(); - this.processErrorSubject = new Subject(); - this.stdoutSubject = new Subject(); - this.stderrSubject = new Subject(); - this.childProcessPid = ''; - } - - public killExecution(signal?: string): Promise { - return Promise.resolve(); - } -} - -describe('lightningLwcStart', () => { - describe('LightningLwcStartExecutor', () => { - describe('build', () => { - it('returns a command with the correct params', () => { - const executor = new LightningLwcStartExecutor(); - const command = executor.build(); - expect(command.toCommand()).to.equal(`sf force:lightning:lwc:start`); - }); - - it('returns a command with the correct description', () => { - const executor = new LightningLwcStartExecutor(); - const command = executor.build(); - expect(command.description).to.equal( - nls.localize('lightning_lwc_start_text') - ); - }); - - it('returns a command with the correct logName', () => { - const executor = new LightningLwcStartExecutor(); - const command = executor.build(); - expect(command.logName).to.equal('lightning_lwc_start'); - }); - }); - - describe('execute', () => { - let sandbox: SinonSandbox; - let appendLineStub: SinonStub; - let notificationServiceStubs: any; - let devServiceStub: any; - let openBrowserStub: SinonStub<[string], Thenable>; - let cliCommandExecutorStub: SinonStub< - [(CancellationToken | undefined)?], - CliCommandExecution | FakeExecution - >; - - beforeEach(() => { - sandbox = sinon.createSandbox(); - - openBrowserStub = sandbox.stub(commandUtils, 'openBrowser'); - - devServiceStub = sinon.createStubInstance(DevServerService); - sandbox.stub(DevServerService, 'instance').get(() => devServiceStub); - - cliCommandExecutorStub = sandbox.stub( - CliCommandExecutor.prototype, - 'execute' - ); - - notificationServiceStubs = {}; - - appendLineStub = sandbox.stub( - ChannelService.prototype, - 'appendLine' as any - ); - - notificationServiceStubs.reportExecutionErrorStub = sandbox.stub( - notificationService, - 'reportExecutionError' - ); - notificationServiceStubs.showErrorMessageStub = sandbox.stub( - notificationService, - 'showErrorMessage' - ); - notificationServiceStubs.showWarningMessageStub = sandbox.stub( - notificationService, - 'showWarningMessage' - ); - notificationServiceStubs.showSuccessfulExecutionStub = sandbox - .stub(notificationService, 'showSuccessfulExecution') - .returns(Promise.resolve()); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('calls execute on the CliCommandExecutor', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - - executor.execute({ type: 'CONTINUE', data: {} }); - - sinon.assert.calledOnce(cliCommandExecutorStub); - }); - - it('registers the server with DevServerService', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - - executor.execute({ type: 'CONTINUE', data: {} }); - - sinon.assert.calledOnce(devServiceStub.registerServerHandler); - }); - - it('shows the success message once server is started', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - - executor.execute({ type: 'CONTINUE', data: {} }); - - fakeExecution.stdoutSubject.next('foo'); - fakeExecution.stdoutSubject.next('bar'); - sinon.assert.notCalled( - notificationServiceStubs.showSuccessfulExecutionStub - ); - - fakeExecution.stdoutSubject.next('Server up'); - sinon.assert.calledOnce( - notificationServiceStubs.showSuccessfulExecutionStub - ); - }); - - it('shows the error message if server start up failed', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - - executor.execute({ type: 'CONTINUE', data: {} }); - - fakeExecution.stderrSubject.next(errorHints.SERVER_STARTUP_FALIED); - sinon.assert.notCalled( - notificationServiceStubs.showSuccessfulExecutionStub - ); - - sinon.assert.calledTwice(notificationServiceStubs.showErrorMessageStub); - sinon.assert.calledWith( - notificationServiceStubs.showErrorMessageStub, - sinon.match( - nls.localize( - 'command_failure', - nls.localize(`lightning_lwc_start_text`) - ) - ) - ); - - sinon.assert.calledOnce(appendLineStub); - sinon.assert.calledWith( - appendLineStub, - sinon.match(nls.localize('lightning_lwc_start_failed')) - ); - }); - - it('opens the browser once server is started', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - devServiceStub.getBaseUrl.returns('http://localhost:3333'); - - executor.execute({ type: 'CONTINUE', data: {} }); - fakeExecution.stdoutSubject.next('Server up on http://localhost:3333'); - - sinon.assert.calledWith( - devServiceStub.setBaseUrlFromDevServerUpMessage, - sinon.match('Server up on http://localhost:3333') - ); - sinon.assert.calledOnce(openBrowserStub); - sinon.assert.calledWith( - openBrowserStub, - sinon.match(DEV_SERVER_DEFAULT_BASE_URL) - ); - }); - - it('opens the browser at the correct port once server is started', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - devServiceStub.getBaseUrl.returns('http://localhost:3332'); - - executor.execute({ type: 'CONTINUE', data: {} }); - fakeExecution.stdoutSubject.next( - 'Some details here\n Server up on http://localhost:3332 something\n More details here' - ); - - sinon.assert.calledWith( - devServiceStub.setBaseUrlFromDevServerUpMessage, - sinon.match( - 'Some details here\n Server up on http://localhost:3332 something\n More details here' - ) - ); - sinon.assert.calledOnce(openBrowserStub); - sinon.assert.calledWith( - openBrowserStub, - sinon.match('http://localhost:3332') - ); - }); - - it('opens the browser with default url when Server up message contains no url', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - devServiceStub.getBaseUrl.returns(DEV_SERVER_DEFAULT_BASE_URL); - - executor.execute({ type: 'CONTINUE', data: {} }); - fakeExecution.stdoutSubject.next( - 'Some details here\n Server up on -no valid url here- \n More details here' - ); - - sinon.assert.neverCalledWith( - devServiceStub.setBaseUrlFromDevServerUpMessage, - sinon.match('http://localhost:3333') - ); - sinon.assert.calledOnce(openBrowserStub); - sinon.assert.calledWith( - openBrowserStub, - sinon.match('http://localhost:3333') - ); - }); - - it('shows an error when the plugin is not installed', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - - executor.execute({ type: 'CONTINUE', data: {} }); - fakeExecution.stdoutSubject.next('foo'); - fakeExecution.processExitSubject.next(127); - - const commandName = nls.localize(`lightning_lwc_start_text`); - - sinon.assert.calledTwice(notificationServiceStubs.showErrorMessageStub); - sinon.assert.calledWith( - notificationServiceStubs.showErrorMessageStub, - sinon.match(nls.localize('command_failure', commandName)) - ); - - sinon.assert.calledOnce(appendLineStub); - sinon.assert.calledWith( - appendLineStub, - sinon.match(nls.localize('lightning_lwc_start_not_found')) - ); - }); - - it('shows an error when the address is already in use', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - - executor.execute({ type: 'CONTINUE', data: {} }); - fakeExecution.processExitSubject.next(98); - - const commandName = nls.localize(`lightning_lwc_start_text`); - - sinon.assert.calledTwice(notificationServiceStubs.showErrorMessageStub); - sinon.assert.calledWith( - notificationServiceStubs.showErrorMessageStub, - sinon.match(nls.localize('command_failure', commandName)) - ); - - sinon.assert.calledOnce(appendLineStub); - sinon.assert.calledWith( - appendLineStub, - sinon.match(nls.localize('lightning_lwc_start_addr_in_use')) - ); - }); - - it('shows an error when scratch org is inactive', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - - executor.execute({ type: 'CONTINUE', data: {} }); - fakeExecution.stderrSubject.next(errorHints.INACTIVE_SCRATCH_ORG); - fakeExecution.processExitSubject.next(1); - - const commandName = nls.localize(`lightning_lwc_start_text`); - - sinon.assert.calledTwice(notificationServiceStubs.showErrorMessageStub); - sinon.assert.calledWith( - notificationServiceStubs.showErrorMessageStub, - sinon.match(nls.localize('command_failure', commandName)) - ); - - sinon.assert.calledOnce(appendLineStub); - sinon.assert.calledWith( - appendLineStub, - sinon.match(nls.localize('lightning_lwc_inactive_scratch_org')) - ); - }); - - it('shows no error when server is stopping', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - - executor.execute({ type: 'CONTINUE', data: {} }); - fakeExecution.stdoutSubject.next('Server up'); - fakeExecution.processExitSubject.next(0); - - sinon.assert.notCalled(notificationServiceStubs.showErrorMessageStub); - sinon.assert.notCalled(appendLineStub); - }); - - it('shows an error message when the process exists before server startup', () => { - const executor = new LightningLwcStartExecutor(); - const fakeExecution = new FakeExecution(executor.build()); - cliCommandExecutorStub.returns(fakeExecution); - - executor.execute({ type: 'CONTINUE', data: {} }); - fakeExecution.stdoutSubject.next('foo'); - fakeExecution.processExitSubject.next(0); - - const commandName = nls.localize(`lightning_lwc_start_text`); - - sinon.assert.calledTwice(notificationServiceStubs.showErrorMessageStub); - sinon.assert.calledWith( - notificationServiceStubs.showErrorMessageStub, - sinon.match(nls.localize('command_failure', commandName)) - ); - - sinon.assert.calledOnce(appendLineStub); - sinon.assert.calledWith( - appendLineStub, - sinon.match(nls.localize('lightning_lwc_start_failed')) - ); - }); - }); - }); - - describe('lightningLwcStart function', () => { - let sandbox: SinonSandbox; - let showWarningStub: SinonStub< - [string, ...string[]], - Thenable - >; - let devServiceStub: any; - let commandletStub: SinonStub<[], Promise>; - - beforeEach(() => { - sandbox = sinon.createSandbox(); - - devServiceStub = sinon.createStubInstance(DevServerService); - sandbox.stub(DevServerService, 'instance').get(() => devServiceStub); - - sandbox.stub(commandUtils, 'openBrowser'); - commandletStub = sandbox.stub(SfCommandlet.prototype, 'run'); - showWarningStub = sandbox.stub(notificationService, 'showWarningMessage'); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('calls run on the commandlet', async () => { - await lightningLwcStart(); - sinon.assert.calledOnce(commandletStub); - }); - - it('shows a warning message when the server is already running', async () => { - devServiceStub.isServerHandlerRegistered.returns(true); - showWarningStub.resolves(); - - await lightningLwcStart(); - - sinon.assert.calledOnce(showWarningStub); - sinon.assert.calledWith( - showWarningStub, - nls.localize('lightning_lwc_start_already_running') - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcStop.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcStop.test.ts deleted file mode 100644 index bd24ab8c15..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/commands/lightningLwcStop.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { lightningLwcStop } from '../../../src/commands/lightningLwcStop'; -import { DevServerService } from '../../../src/service/devServerService'; -import { nls } from '../../../src/messages'; -import { - ChannelService, - notificationService -} from '@salesforce/salesforcedx-utils-vscode'; - -describe('lightningLwcStop', () => { - let sandbox: sinon.SinonSandbox; - let devService: DevServerService; - let appendLineStub: sinon.SinonStub; - let notificationServiceStubs: { - [key: string]: any; - }; - - beforeEach(() => { - sandbox = sinon.createSandbox(); - devService = new DevServerService(); - sandbox.stub(DevServerService, 'instance').get(() => devService); - - notificationServiceStubs = {}; - - appendLineStub = sandbox.stub( - ChannelService.prototype, - 'appendLine' as any - ); - notificationServiceStubs.showSuccessfulExecutionStub = sandbox - .stub(notificationService, 'showSuccessfulExecution') - .returns(Promise.resolve()); - notificationServiceStubs.showErrorMessageStub = sandbox.stub( - notificationService, - 'showErrorMessage' - ); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('calls stopServer when a server is already running', async () => { - const stopStub = sinon.stub(); - devService.registerServerHandler({ - stop: stopStub - }); - - await lightningLwcStop(); - sinon.assert.calledOnce(stopStub); - }); - - it('shows successful server stop', async () => { - let devServiceStub = sinon.createStubInstance(DevServerService); - devServiceStub.isServerHandlerRegistered.returns(true); - sandbox.stub(DevServerService, 'instance').get(() => devServiceStub); - - await lightningLwcStop(); - - sinon.assert.notCalled(notificationServiceStubs.showErrorMessageStub); - - sinon.assert.calledOnce(appendLineStub); - sinon.assert.calledWith( - appendLineStub, - sinon.match(nls.localize('lightning_lwc_stop_in_progress')) - ); - - sinon.assert.calledOnce( - notificationServiceStubs.showSuccessfulExecutionStub - ); - sinon.assert.calledWith( - notificationServiceStubs.showSuccessfulExecutionStub, - sinon.match(nls.localize('lightning_lwc_stop_text')) - ); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/hover.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/hover.test.ts deleted file mode 100644 index 85d80c0c5c..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/hover.test.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import { - Hover, - Position, - MarkdownString, - commands, - window, - workspace -} from 'vscode'; -import { LanguageClient } from 'vscode-languageclient'; -import { createLanguageClient } from '../../src/languageClient'; -import { before } from 'mocha'; - -describe('LWC Hovers', () => { - let lwcDir = path.join( - workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'default', - 'lwc' - ); - - let client: LanguageClient; - - before(async function() { - this.timeout(10000); - // creating a new client so that we can wait on its ready status before the - // tests begin. set the timeout at the suite level to give the client some time - // to get ready - client = createLanguageClient( - path.join( - __dirname, - '..', - '..', - '..', - '..', - '..', - 'node_modules', - '@salesforce', - 'lwc-language-server', - 'lib', - 'server.js' - ) - ); - client.start(); - await client.onReady(); - }); - - afterEach(async () => { - await commands.executeCommand('workbench.action.closeActiveEditor'); - }); - - after(() => client.stop()); - - it('Should provide additional details when hovering over a LWC tag', async () => { - const doc = await workspace.openTextDocument( - path.join(lwcDir, 'hello', 'hello.html') - ); - const editor = await window.showTextDocument(doc); - - // hover over the 'lightning-card' tag - const position = new Position(1, 14); - - const hoverInstances = (await commands.executeCommand( - 'vscode.executeHoverProvider', - editor.document.uri, - position - )) as Hover[]; - - expect(hoverInstances).to.have.lengthOf.at.least(1); - - const content = findContentFromInstances(hoverInstances, 'Cards apply a'); - - expect(content).not.to.be.undefined; - expect(content).not.to.be.null; - - expect(content!.value).to.include('Attributes'); - expect(content!.value).to.include('View in Component Library'); - }); - - it('Should provide additional details when hovering over a LWC attribute', async () => { - const doc = await workspace.openTextDocument( - path.join(lwcDir, 'hello', 'hello.html') - ); - const editor = await window.showTextDocument(doc); - - // hover over the 'title' attribute - const position = new Position(1, 22); - - const hoverInstances = (await commands.executeCommand( - 'vscode.executeHoverProvider', - editor.document.uri, - position - )) as Hover[]; - - expect(hoverInstances).to.have.lengthOf.at.least(1); - - const content = findContentFromInstances(hoverInstances, 'The title can'); - - expect(content).not.to.be.undefined; - expect(content).not.to.be.null; - - expect(content!.value).to.include('title'); - expect(content!.value).to.include( - 'The title can include text, and is displayed in the header.\nTo include additional markup or another component, use the title slot.' - ); - }); -}); - -/** Helper to find the expected hover content - * - * @param instances - hover instances - * @param expectedContent - content that is being searched for - * @returns the first content which includes the expected value || undefined - */ -function findContentFromInstances(instances: Hover[], expectedContent: string) { - for (const instance of instances) { - // type assertion to prevent using a deprecated type - const contents = instance!.contents as MarkdownString[]; - - const content = contents.find(content => - content.value.includes(expectedContent) - ); - - // return the first found match - if (content) { - return content; - } - } -} diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/index.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/index.ts deleted file mode 100644 index 8ba268a332..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// tslint:disable-next-line:no-var-requires -const testRunner = require('@salesforce/salesforcedx-test-utils-vscode/out/src/testrunner'); -import { join, normalize } from 'path'; -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure( - { - ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results - fullTrace: true, - slow: 0 - }, - normalize(join(__dirname, '..', '..', '..')) -); - -module.exports = testRunner; diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/intellisense.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/intellisense.test.ts deleted file mode 100644 index 6735e3e2ca..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/intellisense.test.ts +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { assert, expect } from 'chai'; -import * as path from 'path'; -import { - CompletionItem, - CompletionItemKind, - CompletionList, - Extension, - Position, - Selection, - TextDocument, - TextEditor, - Uri, - commands, - extensions, - window, - workspace -} from 'vscode'; - -describe('LWC Intellisense Integration Tests', () => { - let lwcExtension: Extension; - - before(async () => { - lwcExtension = extensions.getExtension( - 'salesforce.salesforcedx-vscode-lwc' - ) as Extension; - await lwcExtension.activate(); - }); - - it('LWC Extension Activation', async () => { - expect(lwcExtension.isActive); - }); - - describe('LWC JS Intellisense Test Suite', function() { - // Time taken to execute the command to fetch actualcompletion list, varies with different environment and system. - // tslint:disable-next-line:no-invalid-this - this.timeout(10000); - let doc: TextDocument; - let editor: TextEditor; - let text: string; - let startPosition: Position; - let endPosition: Position; - let selection: Selection; - const lwcDir = path.join( - workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'default', - 'lwc' - ); - const docUri = Uri.file(path.join(lwcDir, 'hello', 'hello.js')); - - beforeEach(async () => { - doc = await workspace.openTextDocument(docUri); - editor = await window.showTextDocument(doc); - startPosition = new Position(1, 0); - // To provide valid arguments to selection in afterEach, setting default value of endPosition same as startPosition. - endPosition = new Position(1, 0); - }); - - afterEach(() => { - selection = new Selection(startPosition, endPosition); - // We need to clear the editor's line or the input text will change and test will fail. - editor.edit(editBuilder => { - editBuilder.delete(selection); - }); - }); - - it('LWC JS Module Import Intellisense', async () => { - // We have to have some text or we'll just get generic completions - text = "import {} from 'c"; - endPosition = new Position( - startPosition.line, - startPosition.character + text.length - ); - await editor.edit(editBuilder => { - editBuilder.insert(startPosition, text); - }); - const items = [ - { - label: 'c/helloBinding', - kind: CompletionItemKind.Folder - }, - { - label: 'c/hello', - kind: CompletionItemKind.Folder - } - ]; - await testCompletion(docUri, endPosition, items); - }); - - it('LWC JS @Salesforce Import Intellisense', async () => { - text = "import {} from '@sales"; - endPosition = new Position( - startPosition.line, - startPosition.character + text.length - ); - await editor.edit(editBuilder => { - editBuilder.insert(startPosition, text); - }); - // Keeping a salesforce module, a local folder and dependency module in the expected completion list - const items = [ - { - label: '@salesforce/dev-config', - kind: CompletionItemKind.Module - }, - { - label: 'c/viewSource', - kind: CompletionItemKind.Folder - }, - { - label: '@commitlint/cli', - kind: CompletionItemKind.Module - } - ]; - await testCompletion(docUri, endPosition, items); - }); - - it('LWC JS Lightning Import Intellisense', async () => { - text = "import {} from 'li"; - endPosition = new Position( - startPosition.line, - startPosition.character + text.length - ); - await editor.edit(editBuilder => { - editBuilder.insert(startPosition, text); - }); - const items = [ - { - label: 'c/viewSource', - kind: CompletionItemKind.Folder - }, - { - label: 'c/demoLwcComponent', - kind: CompletionItemKind.Folder - } - ]; - await testCompletion(docUri, endPosition, items); - }); - }); - - describe('LWC MarkUp Intellisense Test Suite', function() { - let doc: TextDocument; - let editor: TextEditor; - let text: string; - let startPosition: Position; - let endPosition: Position; - let selection: Selection; - const lwcDir = path.join( - workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'default', - 'lwc' - ); - const docUri = Uri.file(path.join(lwcDir, 'hello', 'hello.html')); - - beforeEach(async () => { - doc = await workspace.openTextDocument(docUri); - editor = await window.showTextDocument(doc); - startPosition = new Position(5, 0); - endPosition = new Position(5, 0); - }); - - afterEach(() => { - selection = new Selection(startPosition, endPosition); - editor.edit(editBuilder => { - editBuilder.delete(selection); - }); - }); - - /** - * Test that lwc markup intellisense includes standard lwc tags and custom lwc tags - */ - it('LWC Markup Intellisense', async () => { - text = ' { - editBuilder.insert(startPosition, text); - }); - const items = [ - { - label: 'lightning-accordion', - kind: CompletionItemKind.Property - }, - { - label: 'c-hello-binding', - kind: CompletionItemKind.Property - } - ]; - - // NOTE: Because the completion providers always returns all possible results and then VSCode - // does the filtering based on what is typed, we have no good way of testing what vscode is - // actually displaying to the user based on what we typed - // TODO - investigate why this only happens on markup - await testCompletion(docUri, endPosition, items); - }); - }); -}); - -async function testCompletion( - docUri: Uri, - position: Position, - expectedCompletionList: CompletionItem[] -) { - // Simulate triggering a completion - const actualCompletionList = ((await commands.executeCommand( - 'vscode.executeCompletionItemProvider', - docUri, - position - )) as CompletionList).items; - - actualCompletionList.sort(); - expectedCompletionList.sort(); - - expectedCompletionList.forEach(expectedItem => { - const actualItem = actualCompletionList.find(obj => { - if (obj.label) { - return obj.label === expectedItem.label; - } - return false; - }); - - assert.isDefined( - actualItem, - "Couldn't find expected completion item '" + expectedItem.label + "'" - ); - assert.equal( - actualItem!.label, - expectedItem.label, - 'Expected completion item to have label: ' + expectedItem.label - ); - assert.equal( - actualItem!.kind, - expectedItem.kind, - "Expected completion item'" + - expectedItem.label + - "' to have type: " + - expectedItem.kind - ); - }); -} diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/jsconfig.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/jsconfig.test.ts deleted file mode 100644 index daac7793db..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/jsconfig.test.ts +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import { Position, window, workspace, WorkspaceEdit } from 'vscode'; -import URI from 'vscode-uri'; - -const CONFIG_FILENAME = 'jsconfig.json'; -const TEST_COMPONENT_NAME = 'testComponent'; -const CREATE_COMPONENT_NAME = 'createComponent'; - -// Skiping these tests due to ongoing flappiness due to a busy filesystem in CI. -// Example failure -// Unknown (FileSystemError) (FileSystemError): Error: EBUSY: resource busy or locked, rmdir 'd:\a\salesforcedx-vscode\salesforcedx-vscode\packages\system-tests\assets\lwc-recipes\force-app\main\default\lwc\testComponent' -describe.skip('jsconfig Test Suite', () => { - const lwcDir = path.join( - workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'default', - 'lwc' - ); - - const configPath = path.join(lwcDir, CONFIG_FILENAME); - let config: object; - - afterEach(async () => { - if (fs.existsSync(path.join(lwcDir, TEST_COMPONENT_NAME))) { - await workspace.fs.delete( - URI.file(path.join(lwcDir, TEST_COMPONENT_NAME)), - { recursive: true } - ); - await waitForConfigUpdate(configPath); - } - - if (fs.existsSync(path.join(lwcDir, CREATE_COMPONENT_NAME))) { - await workspace.fs.delete( - URI.file(path.join(lwcDir, CREATE_COMPONENT_NAME)), - { recursive: true } - ); - await waitForConfigUpdate(configPath); - } - }); - - // This was moved due to a failing race condition in CircleCI Tests - // causing a flapping test and sporadic build failures. Do not move. - beforeEach(async () => { - await createComponent(TEST_COMPONENT_NAME, lwcDir); - await waitForConfigUpdate(configPath); - config = await parseConfig(configPath); - }); - - it('Should keep a generic c/* field in jsconfig after creating a new component', async () => { - await createComponent(CREATE_COMPONENT_NAME, lwcDir); - - const didUpdate = await waitForConfigUpdate(configPath); - expect(didUpdate, 'config should not be updated').to.be.false; - - const newConfig = await parseConfig(configPath); - expect(config).to.eql(newConfig); - expect(newConfig.paths).have.own.property(`c/*`); - }); - - it('Should not update jsconfig.json when a component is saved', async () => { - const document = await workspace.openTextDocument( - path.join(lwcDir, TEST_COMPONENT_NAME, `${TEST_COMPONENT_NAME}.js`) - ); - - await document.save(); - - const didUpdate = await waitForConfigUpdate(configPath); - expect(didUpdate, 'config should not be updated').to.be.false; - - const newConfig = await parseConfig(configPath); - expect(config).to.eql(newConfig); - }); - - it('Should not update jsconfig.json on keystrokes in a component file', async () => { - const document = await workspace.openTextDocument( - path.join(lwcDir, TEST_COMPONENT_NAME, `${TEST_COMPONENT_NAME}.js`) - ); - const editor = await window.showTextDocument(document); - - await editor.edit(editBuilder => { - editBuilder.insert(new Position(0, 0), 'foo'); - }); - - const didUpdate = await waitForConfigUpdate(configPath); - expect(didUpdate, 'config should not be updated').to.be.false; - - const newConfig = await parseConfig(configPath); - expect(config).to.eql(newConfig); - }); -}); - -/** - * Helper to read and parse jsconfig.json - * - * @param configPath - path to jsconfig.json - */ -async function parseConfig(configPath: string) { - return JSON.parse( - (await workspace.fs.readFile(URI.file(configPath))).toString() - ); -} - -/** - * Helper to wait for jsconfig.json updates - * - * @param configPath - path to jsconfig.json - * @returns value representing whether the config updated or the wait timed out - */ -function waitForConfigUpdate(configPath: string): Promise { - return new Promise(resolve => { - const watcher = workspace.createFileSystemWatcher( - configPath, - true, - false, - true - ); - let timer: ReturnType; - - watcher.onDidChange(() => { - watcher.dispose(); - clearTimeout(timer); - resolve(true); - }); - - timer = setTimeout(() => { - watcher.dispose(); - resolve(false); - }, 500); - }); -} - -/** - * Helper to create a LWC component - * Ideally, this should be replaced with invoking `sf.lightning.generate.lwc` - * - * @param name - name of the new component - * @param lwcDir - path for where to create the component - */ -async function createComponent(name: string, lwcDir: string) { - await workspace.fs.createDirectory(URI.file(path.join(lwcDir, name))); - - const htmlEdit = new WorkspaceEdit(); - const jsEdit = new WorkspaceEdit(); - const xmlEdit = new WorkspaceEdit(); - - htmlEdit.createFile(URI.file(path.join(lwcDir, name, `${name}.html`))); - jsEdit.createFile(URI.file(path.join(lwcDir, name, `${name}.js`))); - xmlEdit.createFile(URI.file(path.join(lwcDir, name, `${name}-meta.xml`))); - - await workspace.applyEdit(htmlEdit); - await workspace.applyEdit(jsEdit); - await workspace.applyEdit(xmlEdit); - - const encoder = new TextEncoder(); - - await workspace.fs.writeFile( - URI.file(path.join(lwcDir, name, `${name}.html`)), - encoder.encode(``) - ); - - await workspace.fs.writeFile( - URI.file(path.join(lwcDir, name, `${name}.js`)), - encoder.encode( - `import { LightningElement } from 'lwc'; -export default class ${name} extends LightningElement {}` - ) - ); - - await workspace.fs.writeFile( - URI.file(path.join(lwcDir, name, `${name}-meta.xml`)), - encoder.encode(` - - 46.0 - false - `) - ); -} diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/metaSupport/MockRhExtension.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/metaSupport/MockRhExtension.ts deleted file mode 100644 index 8f40033f0a..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/metaSupport/MockRhExtension.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { Extension, ExtensionKind, extensions, Uri } from 'vscode'; -import * as path from 'path'; - -export class MockRedhatExtension implements Extension { - public extensionKind = ExtensionKind.Workspace; - constructor(version: string) { - this.id = 'redhat.vscode-xml'; - this.extensionPath = path.join('extension', 'local', 'path'); - this.isActive = true; - this.packageJSON = { - name: 'vscode-xml', - displayName: 'XML', - description: 'XML Language Support by Red Hat', - version: version, - author: 'Red Hat', - publisher: 'redhat' - }; - this.api = new MockRhApi(this.extensionPath); - } - public extensionUri = Uri.parse('file://test'); - public id: string; - public extensionPath: string; - public isActive: boolean; - public packageJSON: any; - public api: any; - - public activate(): Thenable { - return Promise.resolve(this.api); - } - public exports: any; -} - -class MockRhApi { - public extentionPath: string; - public listOfCatalogs: string[]; - public listOfAssociations: Array<{ systemId: string; pattern: string }>; - constructor(extensionPath: string) { - this.extentionPath = extensionPath; - this.listOfCatalogs = []; - this.listOfAssociations = []; - } - public addXMLCatalogs(catalogs: string[]) { - catalogs.forEach(catalog => { - this.listOfCatalogs.push(catalog); - }); - } - public isReady() { - return true; - } - public addXMLFileAssociations( - associations: Array<{ systemId: string; pattern: string }> - ) { - associations.forEach(associate => { - this.listOfAssociations.push({ - systemId: path.join(associate.systemId), - pattern: associate.pattern - }); - }); - } -} diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/metaSupport/metaSupport.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/metaSupport/metaSupport.test.ts deleted file mode 100644 index 4db26773a4..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/metaSupport/metaSupport.test.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { extensions } from 'vscode'; -import { nls } from '../../../src/messages'; -import { MockRedhatExtension } from './MockRhExtension'; -import { metaSupport } from '../../../src/metasupport'; -import { strict as assert } from 'assert'; -import * as sinon from 'sinon'; -import * as path from 'path'; -import { ChannelService } from '@salesforce/salesforcedx-utils-vscode'; - -let sandbox = sinon.createSandbox(); -let mockRhExtension: any; -let rhExtension: any; -let appendLineSpy: sinon.SinonSpy; - -describe('MetaSupport: Extension version supported', () => { - beforeEach(() => { - appendLineSpy = sinon.spy(ChannelService.prototype, 'appendLine'); - }); - - afterEach(() => { - sandbox.restore(); - appendLineSpy.restore(); - }); - - it('Should post error message if XML extension is a minor version too old', async () => { - mockRhExtension = sandbox - .stub(extensions, 'getExtension') - .returns(new MockRedhatExtension('0.13.0')); - await metaSupport.getMetaSupport(); - expect(appendLineSpy).to.have.calledOnceWith( - nls.localize('lightning_lwc_deprecated_redhat_extension') - ); - }); - - it('Should post error message if XML extension is a patch version too old', async () => { - mockRhExtension = sandbox - .stub(extensions, 'getExtension') - .returns(new MockRedhatExtension('0.13.2')); - await metaSupport.getMetaSupport(); - expect(appendLineSpy).to.have.calledOnceWith( - nls.localize('lightning_lwc_deprecated_redhat_extension') - ); - }); - - it('Should post error message if XML extension is 0.15.0', async () => { - mockRhExtension = sandbox - .stub(extensions, 'getExtension') - .returns(new MockRedhatExtension('0.15.0')); - await metaSupport.getMetaSupport(); - expect(appendLineSpy).to.have.calledOnceWith( - nls.localize('lightning_lwc_redhat_extension_regression') - ); - }); -}); - -describe('MetaSupport: Extension not found', () => { - beforeEach(() => { - mockRhExtension = sandbox - .stub(extensions, 'getExtension') - .returns(undefined); - appendLineSpy = sinon.spy(ChannelService.prototype, 'appendLine'); - }); - - afterEach(() => { - sandbox.restore(); - appendLineSpy.restore(); - }); - - it('Should provide information to install XML plugin if not found', async () => { - await metaSupport.getMetaSupport(); - expect(appendLineSpy).to.have.calledOnceWith( - nls.localize('lightning_lwc_no_redhat_extension_found') - ); - }); -}); - -['0.14.0', '0.16.0', '1.0.0'].forEach(rhExtensionVersion => { - describe(`MetaSupport: Extension v${rhExtensionVersion} function`, () => { - beforeEach(() => { - rhExtension = new MockRedhatExtension(rhExtensionVersion); - mockRhExtension = sandbox - .stub(extensions, 'getExtension') - .returns(rhExtension); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('Should pass correct catalog path to XML extension', async () => { - await metaSupport.getMetaSupport(); - - const catalogPaths = [ - path.join( - 'extension', - 'local', - 'path', - 'resources', - 'static', - 'js-meta-home.xml' - ) - ]; - assert.strictEqual(rhExtension.api.listOfCatalogs[0], catalogPaths[0]); - }); - - it('Should pass correct file association path to XML extension', async () => { - await metaSupport.getMetaSupport(); - - const systemId = path.join( - 'extension', - 'local', - 'path', - 'resources', - 'static', - 'js-meta.xsd' - ); - const pattern = '**/*js-meta.xml'; - - assert.strictEqual( - rhExtension.api.listOfAssociations[0]['systemId'], - systemId - ); - assert.strictEqual( - rhExtension.api.listOfAssociations[0]['pattern'], - pattern - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/navigation.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/navigation.test.ts deleted file mode 100644 index 530447dcd4..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/navigation.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import { Location, Position, commands, window, workspace } from 'vscode'; -import URI from 'vscode-uri'; - -describe('LWC Definition Linking', () => { - const lwcDir = path.join( - workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'default', - 'lwc' - ); - - afterEach(async () => { - await commands.executeCommand('workbench.action.closeActiveEditor'); - }); - - it('Should provide navigation to a selected LWC tag', async () => { - // select the 'c-view-source' tag - return testDefinitionNavigation( - path.join(lwcDir, 'hello', 'hello.html'), - path.join(lwcDir, 'viewSource', 'viewSource.js'), - new Position(6, 16) - ); - }); -}); - -/** Helper to test the definition provider - * - * @param startLocation - starting location - * @param endLocation - expected definition location given the position - * @param position - position to initiate the definition lookup - */ -async function testDefinitionNavigation( - startLocation: string, - endLocation: string, - position: Position -) { - const doc = await workspace.openTextDocument(startLocation); - const editor = await window.showTextDocument(doc); - - const locations = (await commands.executeCommand( - 'vscode.executeDefinitionProvider', - editor.document.uri, - position - )) as Location[]; - - // allows a users to pick between the html, js or css files in a component to navigate to - expect(locations).to.have.lengthOf(3); - - const locationUris = locations.map(location => { - return location.uri.toString(); - }); - const expectedURI = URI.file(endLocation); - // The list should contain the js, css, and html file, but order is not guarenteed. - expect(locationUris.indexOf(expectedURI.toString())).to.not.equal(-1); -} diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestDebugAction.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestDebugAction.test.ts deleted file mode 100644 index cc59b6ab78..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestDebugAction.test.ts +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import { assert, SinonStub, stub } from 'sinon'; -import * as uuid from 'uuid'; -import * as vscode from 'vscode'; -import URI from 'vscode-uri'; -import { telemetryService } from '../../../../src/telemetry'; -import { - lwcTestCaseDebug, - lwcTestDebugActiveTextEditorTest, - lwcTestFileDebug, - getDebugConfiguration, - handleDidStartDebugSession, - handleDidTerminateDebugSession -} from '../../../../src/testSupport/commands/lwcTestDebugAction'; -import { workspace } from '../../../../src/testSupport/workspace'; -import { - TestCaseInfo, - TestInfoKind, - TestType -} from '../../../../src/testSupport/types'; -import { LWC_TEST_DEBUG_LOG_NAME } from '../../../../src/testSupport/types/constants'; -import { - createMockTestFileInfo, - mockActiveTextEditorUri, - mockTestResultWatcher, - unmockActiveTextEditorUri, - unmockTestResultWatcher -} from '../mocks'; -import { InputBuffer } from 'uuid/interfaces'; -import { projectPaths } from '@salesforce/salesforcedx-utils-vscode'; - -describe('LWC Test Debug - Code Action', () => { - let uuidStub: SinonStub< - [({ random: InputBuffer } | { rng(): InputBuffer } | undefined)?], - string - >; - let debugStub: SinonStub< - [ - vscode.WorkspaceFolder | undefined, - string | vscode.DebugConfiguration, - (vscode.DebugSession | vscode.DebugSessionOptions | undefined)? - ], - Thenable - >; - let getLwcTestRunnerExecutableStub: SinonStub< - [string], - fs.PathLike | undefined - >; - let processHrtimeStub: SinonStub< - [([number, number] | undefined)?], - [number, number] - >; - let telemetryStub: SinonStub< - [(string | undefined)?, ([number, number] | undefined)?, any?, any?], - void - >; - const mockUuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'; - beforeEach(() => { - uuidStub = stub(uuid, 'v4'); - debugStub = stub(vscode.debug, 'startDebugging'); - processHrtimeStub = stub(process, 'hrtime'); - telemetryStub = stub(telemetryService, 'sendCommandEvent'); - getLwcTestRunnerExecutableStub = stub( - workspace, - 'getLwcTestRunnerExecutable' - ); - uuidStub.returns(mockUuid); - debugStub.returns(Promise.resolve()); - }); - - afterEach(() => { - uuidStub.restore(); - debugStub.restore(); - processHrtimeStub.restore(); - telemetryStub.restore(); - getLwcTestRunnerExecutableStub.restore(); - }); - - const root = /^win32/.test(process.platform) ? 'C:\\' : '/var'; - const salesforceProjectPath = path.join( - root, - 'project', - 'mockSalesforceProject' - ); - const lwcTestExecutablePath = path.join( - salesforceProjectPath, - 'node_modules', - '.bin', - 'lwc-jest' - ); - const testRelativePath = path.join( - 'force-app', - 'main', - 'default', - 'lwc', - 'mockComponent', - '__tests__', - 'mockTest.test.js' - ); - const testFsPath = path.join(salesforceProjectPath, testRelativePath); - const testName = 'mockTestName'; - const testUri = URI.file(testFsPath); - const testExecutionInfo: TestCaseInfo = { - kind: TestInfoKind.TEST_CASE, - testType: TestType.LWC, - testUri, - testName - }; - - describe('Debug Configuration', () => { - const command = lwcTestExecutablePath; - const args = [ - '--debug', - '--', - '--runTestsByPath', - /^win32/.test(process.platform) ? testRelativePath : testFsPath, - '--testNamePattern', - 'mockTestName' - ]; - const cwd = salesforceProjectPath; - - it('Should generate debug configuration for single test case', () => { - const debugConfiguration = getDebugConfiguration(command, args, cwd); - expect(debugConfiguration).to.deep.equal({ - sfDebugSessionId: mockUuid, - type: 'node', - request: 'launch', - name: 'Debug LWC test(s)', - cwd: salesforceProjectPath, - runtimeExecutable: lwcTestExecutablePath, - args, - resolveSourceMapLocations: ['**', '!**/node_modules/**'], - console: 'integratedTerminal', - internalConsoleOptions: 'openOnSessionStart', - port: 9229, - disableOptimisticBPs: true - }); - }); - - it('Should send telemetry for debug test case', async () => { - getLwcTestRunnerExecutableStub.returns(lwcTestExecutablePath); - const mockExecutionTime: [number, number] = [123, 456]; - processHrtimeStub.returns(mockExecutionTime); - const debugConfiguration = getDebugConfiguration(command, args, cwd); - await lwcTestCaseDebug({ - testExecutionInfo - }); - const mockDebugSession: vscode.DebugSession = { - id: 'mockId', - type: 'node', - name: debugConfiguration.name, - workspaceFolder: debugConfiguration.cwd, - configuration: debugConfiguration, - customRequest: (cmd: string) => Promise.resolve(), - getDebugProtocolBreakpoint: breakpoint => Promise.resolve(undefined) - }; - handleDidStartDebugSession(mockDebugSession); - handleDidTerminateDebugSession(mockDebugSession); - assert.calledOnce(telemetryStub); - assert.calledWith( - telemetryStub, - LWC_TEST_DEBUG_LOG_NAME, - mockExecutionTime, - { - workspaceType: 'SFDX' - } - ); - }); - }); - - describe('Debug Test File', () => { - beforeEach(() => { - getLwcTestRunnerExecutableStub.returns(lwcTestExecutablePath); - mockTestResultWatcher(); - }); - afterEach(() => { - unmockTestResultWatcher(); - }); - - const mockTestFileInfo = createMockTestFileInfo(); - it('Should debug test file', async () => { - await lwcTestFileDebug({ - testExecutionInfo: mockTestFileInfo - }); - const expectedCwd = vscode.workspace.workspaceFolders![0].uri.fsPath; - const expectedArgTwo = { - args: [ - '--', - '--json', - '--outputFile', - path.join( - projectPaths.lwcTestResultsFolder(), - `test-result-${mockUuid}.json` - ), - '--testLocationInResults', - '--runTestsByPath', - /^win32/.test(process.platform) - ? path.relative(expectedCwd, mockTestFileInfo.testUri.fsPath) - : mockTestFileInfo.testUri.fsPath - ], - resolveSourceMapLocations: ['**', '!**/node_modules/**'], - console: 'integratedTerminal', - cwd: expectedCwd, - disableOptimisticBPs: true, - internalConsoleOptions: 'openOnSessionStart', - name: 'Debug LWC test(s)', - port: 9229, - request: 'launch', - runtimeExecutable: lwcTestExecutablePath, - sfDebugSessionId: mockUuid, - type: 'node' - }; - - expect(getLwcTestRunnerExecutableStub.getCalls().length).to.equal(1); - expect(debugStub.getCalls().length).to.equal(1); - expect(debugStub.getCall(0).args[0]).to.equal( - vscode.workspace.workspaceFolders![0] - ); - expect(debugStub.getCall(0).args[1]).to.deep.equal(expectedArgTwo); - assert.calledWith( - debugStub, - vscode.workspace.workspaceFolders![0], - expectedArgTwo - ); - }); - - it('Should debug active text editor test file', async () => { - mockActiveTextEditorUri(mockTestFileInfo.testUri); - await lwcTestDebugActiveTextEditorTest(); - const expectedCwd = vscode.workspace.workspaceFolders![0].uri.fsPath; - expect(getLwcTestRunnerExecutableStub.getCalls().length).to.equal(1); - assert.calledWith(debugStub, vscode.workspace.workspaceFolders![0], { - args: [ - '--', - '--json', - '--outputFile', - path.join( - projectPaths.lwcTestResultsFolder(), - `test-result-${mockUuid}.json` - ), - '--testLocationInResults', - '--runTestsByPath', - /^win32/.test(process.platform) - ? path.relative(expectedCwd, mockTestFileInfo.testUri.fsPath) - : mockTestFileInfo.testUri.fsPath - ], - resolveSourceMapLocations: ['**', '!**/node_modules/**'], - console: 'integratedTerminal', - cwd: expectedCwd, - disableOptimisticBPs: true, - internalConsoleOptions: 'openOnSessionStart', - name: 'Debug LWC test(s)', - port: 9229, - request: 'launch', - runtimeExecutable: lwcTestExecutablePath, - sfDebugSessionId: mockUuid, - type: 'node' - }); - unmockActiveTextEditorUri(); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestRunAction.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestRunAction.test.ts deleted file mode 100644 index a1cbdbc298..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestRunAction.test.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import * as path from 'path'; -import { assert, match, SinonStub, stub } from 'sinon'; -import * as uuid from 'uuid'; -import * as vscode from 'vscode'; -import { telemetryService } from '../../../../src/telemetry'; -import { - lwcTestRun, - lwcTestRunActiveTextEditorTest -} from '../../../../src/testSupport/commands/lwcTestRunAction'; -import { workspace } from '../../../../src/testSupport/workspace'; -import { LWC_TEST_RUN_LOG_NAME } from '../../../../src/testSupport/types/constants'; -import { - createMockTestFileInfo, - mockActiveTextEditorUri, - mockGetLwcTestRunnerExecutable, - mockSfTaskExecute, - mockTestResultWatcher, - unmockActiveTextEditorUri, - unmockGetLwcTestRunnerExecutable, - unmockSfTaskExecute, - unmockTestResultWatcher -} from '../mocks'; -import { InputBuffer } from 'uuid/interfaces'; -import { projectPaths } from '@salesforce/salesforcedx-utils-vscode'; - -describe('LWC Test Run - Code Action', () => { - describe('Telemetry for running tests', () => { - let telemetryStub: SinonStub< - [(string | undefined)?, ([number, number] | undefined)?, any?, any?], - void - >; - let processHrtimeStub: SinonStub< - [([number, number] | undefined)?], - [number, number] - >; - beforeEach(() => { - telemetryStub = stub(telemetryService, 'sendCommandEvent'); - processHrtimeStub = stub(process, 'hrtime'); - mockSfTaskExecute(true); - mockGetLwcTestRunnerExecutable(); - }); - - afterEach(() => { - telemetryStub.restore(); - processHrtimeStub.restore(); - unmockGetLwcTestRunnerExecutable(); - unmockSfTaskExecute(); - }); - - it('Should send telemetry for running tests', async () => { - const testExecutionInfo = createMockTestFileInfo(); - const mockExecutionTime: [number, number] = [123, 456]; - processHrtimeStub.returns(mockExecutionTime); - await lwcTestRun(testExecutionInfo); - assert.calledOnce(telemetryStub); - assert.calledWith( - telemetryStub, - LWC_TEST_RUN_LOG_NAME, - mockExecutionTime, - { - workspaceType: 'SFDX' - } - ); - - processHrtimeStub.restore(); - }); - }); - - describe('Run Test File', () => { - let uuidStub: SinonStub< - [({ random: InputBuffer } | { rng(): InputBuffer } | undefined)?], - string - >; - let executeTaskStub: SinonStub< - [vscode.Task], - Thenable - >; - const mockUuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'; - beforeEach(() => { - mockGetLwcTestRunnerExecutable(); - mockTestResultWatcher(); - uuidStub = stub(uuid, 'v4'); - uuidStub.returns(mockUuid); - executeTaskStub = stub(vscode.tasks, 'executeTask'); - executeTaskStub.returns(Promise.resolve()); - }); - afterEach(() => { - unmockGetLwcTestRunnerExecutable(); - unmockTestResultWatcher(); - uuidStub.restore(); - executeTaskStub.restore(); - }); - - const mockTestFileInfo = createMockTestFileInfo(); - it('Should run active text editor test file', async () => { - mockActiveTextEditorUri(mockTestFileInfo.testUri); - await lwcTestRunActiveTextEditorTest(); - - const expectedCwd = vscode.workspace.workspaceFolders![0].uri.fsPath; - const expectedOptions = /^win32/.test(process.platform) - ? { - executable: 'cmd.exe', - shellArgs: ['/d', '/c'] - } - : undefined; - const lwcTestRunnerExecutable = - workspace.getLwcTestRunnerExecutable(expectedCwd); - assert.calledOnce(executeTaskStub); - assert.calledWith( - executeTaskStub, - match.has('execution', match.has('command', lwcTestRunnerExecutable)) - ); - assert.calledWith( - executeTaskStub, - match.has( - 'execution', - match.has('args', [ - '--', - '--json', - '--outputFile', - path.join( - projectPaths.lwcTestResultsFolder(), - `test-result-${mockUuid}.json` - ), - '--testLocationInResults', - '--runTestsByPath', - /^win32/.test(process.platform) - ? path.relative(expectedCwd, mockTestFileInfo.testUri.fsPath) - : mockTestFileInfo.testUri.fsPath - ]) - ) - ); - assert.calledWith( - executeTaskStub, - match.has('execution', match.has('options', expectedOptions)) - ); - unmockActiveTextEditorUri(); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestWatchAction.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestWatchAction.test.ts deleted file mode 100644 index f479286678..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/commands/lwcTestWatchAction.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { - lwcTestStartWatching, - lwcTestStartWatchingCurrentFile, - lwcTestStopWatching, - lwcTestStopWatchingAllTests, - lwcTestStopWatchingCurrentFile -} from '../../../../src/testSupport/commands/lwcTestWatchAction'; -import { testWatcher } from '../../../../src/testSupport/testRunner/testWatcher'; -import { - createMockTestFileInfo, - mockActiveTextEditorUri, - mockGetLwcTestRunnerExecutable, - mockSfTaskExecute, - unmockActiveTextEditorUri, - unmockGetLwcTestRunnerExecutable, - unmockSfTaskExecute -} from '../mocks'; - -describe('LWC Test Watch Action', () => { - beforeEach(() => { - mockGetLwcTestRunnerExecutable(); - mockSfTaskExecute(); - }); - afterEach(() => { - unmockGetLwcTestRunnerExecutable(); - unmockSfTaskExecute(); - testWatcher.stopWatchingAllTests(); - }); - - const mockTestFileInfo = createMockTestFileInfo(); - - it('Should start watching tests', async () => { - await lwcTestStartWatching({ testExecutionInfo: mockTestFileInfo }); - expect(testWatcher.isWatchingTest(mockTestFileInfo.testUri)).to.equal(true); - }); - - it('Should start and stop watching tests', async () => { - await lwcTestStartWatching({ testExecutionInfo: mockTestFileInfo }); - expect(testWatcher.isWatchingTest(mockTestFileInfo.testUri)).to.equal(true); - await lwcTestStopWatching({ testExecutionInfo: mockTestFileInfo }); - expect(testWatcher.isWatchingTest(mockTestFileInfo.testUri)).to.equal( - false - ); - }); - - it('Should stop watching all tests', async () => { - const mockTestFileInfo2 = createMockTestFileInfo('mockTest2.test.js'); - await lwcTestStartWatching({ testExecutionInfo: mockTestFileInfo }); - await lwcTestStartWatching({ testExecutionInfo: mockTestFileInfo2 }); - expect(testWatcher.isWatchingTest(mockTestFileInfo.testUri)).to.equal(true); - expect(testWatcher.isWatchingTest(mockTestFileInfo2.testUri)).to.equal( - true - ); - lwcTestStopWatchingAllTests(); - expect(testWatcher.isWatchingTest(mockTestFileInfo.testUri)).to.equal( - false - ); - expect(testWatcher.isWatchingTest(mockTestFileInfo2.testUri)).to.equal( - false - ); - }); - - it('Stop watching all tests should not throw if no tests are being watched', async () => { - expect(lwcTestStopWatchingAllTests).to.not.throw(); - }); - - it('Should start and stop watching current file', async () => { - mockActiveTextEditorUri(mockTestFileInfo.testUri); - await lwcTestStartWatchingCurrentFile(); - expect(testWatcher.isWatchingTest(mockTestFileInfo.testUri)).to.equal(true); - await lwcTestStopWatchingCurrentFile(); - expect(testWatcher.isWatchingTest(mockTestFileInfo.testUri)).to.equal( - false - ); - unmockActiveTextEditorUri(); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/index.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/index.ts deleted file mode 100644 index 519490e23a..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/index.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { shared as lspCommon } from '@salesforce/lightning-lsp-common'; -import * as pathUtils from '@salesforce/salesforcedx-utils-vscode'; -import * as fs from 'fs'; -import * as path from 'path'; -import * as which from 'which'; -import { SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import URI from 'vscode-uri'; -import { SfTask } from '../../../../src/testSupport/testRunner/taskService'; -import { testResultsWatcher } from '../../../../src/testSupport/testRunner/testResultsWatcher'; -import { - TestFileInfo, - TestInfoKind, - TestType -} from '../../../../src/testSupport/types'; -import { - mockPreviewJavaScriptDebugger, - unmockPreviewJavaScriptDebugger -} from './vscodeConfiguration'; -import { projectPaths } from '@salesforce/salesforcedx-utils-vscode'; - -export { mockPreviewJavaScriptDebugger, unmockPreviewJavaScriptDebugger }; - -let existsSyncStub: SinonStub<[fs.PathLike], boolean>; -let whichSyncStub: SinonStub<[string], fs.PathLike>; -let sfTaskExecuteStub: SinonStub<[], Promise>; -let activeTextEditorStub: SinonStub; -let getTempFolderStub: SinonStub<[string, string], string>; -let watchTestResultsStub: SinonStub<[string], void>; -export function createMockTestFileInfo(mockTestFile = 'mockTest.test.js') { - const mockDirectory = path.join( - vscode.workspace.workspaceFolders![0].uri.fsPath, - 'force-app', - 'main', - 'lwc', - 'mockComponent', - '__tests__' - ); - - const mockTestFilePath = path.join(mockDirectory, mockTestFile); - const testExecutionInfo: TestFileInfo = { - kind: TestInfoKind.TEST_FILE, - testType: TestType.LWC, - testUri: URI.file(mockTestFilePath) - }; - return testExecutionInfo; -} - -export function mockGetLwcTestRunnerExecutable( - mockWorkspaceType: lspCommon.WorkspaceType = lspCommon.WorkspaceType.SFDX -) { - if (mockWorkspaceType === lspCommon.WorkspaceType.SFDX) { - existsSyncStub = stub(fs, 'existsSync'); - existsSyncStub.returns(true); - } - if ( - mockWorkspaceType === lspCommon.WorkspaceType.CORE_ALL || - mockWorkspaceType === lspCommon.WorkspaceType.CORE_PARTIAL - ) { - whichSyncStub = stub(which, 'sync'); - whichSyncStub.returns(path.join('/bin', 'lwc-test')); - existsSyncStub = stub(fs, 'existsSync'); - existsSyncStub.returns(true); - } -} - -export function unmockGetLwcTestRunnerExecutable() { - if (existsSyncStub) { - existsSyncStub.restore(); - } - if (whichSyncStub) { - whichSyncStub.restore(); - } -} - -export function mockSfTaskExecute(immediate?: boolean) { - sfTaskExecuteStub = stub(SfTask.prototype, 'execute'); - sfTaskExecuteStub.callsFake(async function (this: SfTask): Promise { - if (immediate) { - this.notifyEndTask(); - return this; - } - const task = this; - return Promise.resolve().then(() => { - setTimeout(() => { - task.notifyEndTask(); - }, 0); - return task; - }); - }); -} - -export function unmockSfTaskExecute() { - sfTaskExecuteStub.restore(); -} - -/** - * Mock active text editor with provided mock test uri - * @param testUri mock test uri - */ -export function mockActiveTextEditorUri(testUri: vscode.Uri) { - const mockActiveTextEditor = { - document: { - uri: testUri, - languageId: 'javascript' - } - }; - activeTextEditorStub = stub(vscode.window, 'activeTextEditor').get(() => { - return mockActiveTextEditor; - }); -} - -export function unmockActiveTextEditorUri() { - activeTextEditorStub.restore(); -} - -/** - * Mock test result watcher's get temp folder and watch test results methods - */ -export function mockTestResultWatcher() { - getTempFolderStub = stub(pathUtils, 'getTestResultsFolder'); - getTempFolderStub.callsFake((testType: string) => { - return path.join(projectPaths.testResultsFolder(), testType); - }); - watchTestResultsStub = stub(testResultsWatcher, 'watchTestResults'); - watchTestResultsStub.callsFake(() => {}); -} - -export function unmockTestResultWatcher() { - getTempFolderStub.restore(); - watchTestResultsStub.restore(); -} diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/testResultsMocks.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/testResultsMocks.ts deleted file mode 100644 index 835384712c..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/testResultsMocks.ts +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// Test Results mocks for: -// packages/system-tests/assets/sfdx-simple/force-app/main/default/lwc/demoLwcComponent/__tests__/demoLwcComponent.test.js -import { LwcJestTestResults } from '../../../../src/testSupport/types'; - -// Test Results for the test file -export const testFileResult = { - numFailedTestSuites: 1, - numFailedTests: 1, - numPassedTestSuites: 0, - numPassedTests: 1, - numPendingTestSuites: 0, - numPendingTests: 0, - numRuntimeErrorTestSuites: 0, - numTodoTests: 0, - numTotalTestSuites: 1, - numTotalTests: 2, - openHandles: [], - snapshot: { - added: 0, - didUpdate: false, - failure: false, - filesAdded: 0, - filesRemoved: 0, - filesRemovedList: [], - filesUnmatched: 0, - filesUpdated: 0, - matched: 0, - total: 0, - unchecked: 0, - uncheckedKeysByFile: [], - unmatched: 0, - updated: 0 - }, - startTime: 1570000000000, - success: false, - testResults: [ - { - assertionResults: [ - { - ancestorTitles: ['Demo Lwc Component'], - failureMessages: [], - fullName: 'Demo Lwc Component Displays greeting', - location: { - column: 2, - line: 12 - }, - status: 'passed', - title: 'Displays greeting' - }, - { - ancestorTitles: ['Demo Lwc Component'], - failureMessages: [ - 'Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoEqual\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // deep equality\u001b[22m\n\nExpected: \u001b[32m2\u001b[39m\nReceived: \u001b[31m1\u001b[39m\n at Object.expect (/Users/mockUser/sfdx-simple/force-app/main/default/lwc/demoLwcComponent/__tests__/demoLwcComponent.test.js:22:5)\n at Object.asyncJestTest (/Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)\n at /Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:43:12\n at new Promise ()\n at mapper (/Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:26:19)\n at /Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:73:41\n at processTicksAndRejections (internal/process/task_queues.js:93:5)' - ], - fullName: 'Demo Lwc Component Failed test', - location: { - column: 2, - line: 21 - }, - status: 'failed', - title: 'Failed test' - } - ], - endTime: 1570000005000, - name: 'REPLACE WITH INTEGRATION TEST FILE URI', - startTime: 1570000000000, - status: 'failed' - } - ] -} as LwcJestTestResults; - -// Test results for the first test case -export const testCaseSuccessResult = { - numFailedTestSuites: 0, - numFailedTests: 0, - numPassedTestSuites: 1, - numPassedTests: 1, - numPendingTestSuites: 0, - numPendingTests: 1, - numRuntimeErrorTestSuites: 0, - numTodoTests: 0, - numTotalTestSuites: 1, - numTotalTests: 2, - openHandles: [], - snapshot: { - added: 0, - didUpdate: false, - failure: false, - filesAdded: 0, - filesRemoved: 0, - filesRemovedList: [], - filesUnmatched: 0, - filesUpdated: 0, - matched: 0, - total: 0, - unchecked: 0, - uncheckedKeysByFile: [], - unmatched: 0, - updated: 0 - }, - startTime: 1570000000000, - success: true, - testResults: [ - { - assertionResults: [ - { - ancestorTitles: ['Demo Lwc Component'], - failureMessages: [], - fullName: 'Demo Lwc Component Displays greeting', - location: { column: 2, line: 12 }, - status: 'passed', - title: 'Displays greeting' - }, - { - ancestorTitles: ['Demo Lwc Component'], - failureMessages: [], - fullName: 'Demo Lwc Component Failed test', - location: { column: 2, line: 21 }, - status: 'pending', - title: 'Failed test' - } - ], - endTime: 1570000005000, - name: 'REPLACE WITH INTEGRATION TEST FILE URI', - startTime: 1570000000000, - status: 'passed' - } - ], - wasInterrupted: false -} as LwcJestTestResults; - -// Test results for the second test case -export const testCaseFailureResult = { - numFailedTestSuites: 1, - numFailedTests: 1, - numPassedTestSuites: 0, - numPassedTests: 0, - numPendingTestSuites: 0, - numPendingTests: 1, - numRuntimeErrorTestSuites: 0, - numTodoTests: 0, - numTotalTestSuites: 1, - numTotalTests: 2, - openHandles: [], - snapshot: { - added: 0, - didUpdate: false, - failure: false, - filesAdded: 0, - filesRemoved: 0, - filesRemovedList: [], - filesUnmatched: 0, - filesUpdated: 0, - matched: 0, - total: 0, - unchecked: 0, - uncheckedKeysByFile: [], - unmatched: 0, - updated: 0 - }, - startTime: 1570000000000, - success: false, - testResults: [ - { - assertionResults: [ - { - ancestorTitles: ['Demo Lwc Component'], - failureMessages: [], - fullName: 'Demo Lwc Component Displays greeting', - location: { column: 2, line: 12 }, - status: 'pending', - title: 'Displays greeting' - }, - { - ancestorTitles: ['Demo Lwc Component'], - failureMessages: [ - 'Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoEqual\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // deep equality\u001b[22m\n\nExpected: \u001b[32m2\u001b[39m\nReceived: \u001b[31m1\u001b[39m\n at Object.expect (/Users/mockUser/sfdx-simple/force-app/main/default/lwc/demoLwcComponent/__tests__/demoLwcComponent.test.js:22:5)\n at Object.asyncJestTest (/Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)\n at /Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:43:12\n at new Promise ()\n at mapper (/Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:26:19)\n at /Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:73:41' - ], - fullName: 'Demo Lwc Component Failed test', - location: { column: 2, line: 21 }, - status: 'failed', - title: 'Failed test' - } - ], - endTime: 1570000005000, - name: 'REPLACE WITH INTEGRATION TEST FILE URI', - startTime: 1570000000000, - status: 'failed' - } - ], - wasInterrupted: false -} as LwcJestTestResults; diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/vscodeConfiguration.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/vscodeConfiguration.ts deleted file mode 100644 index efcc1bb4fc..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/mocks/vscodeConfiguration.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { - workspace, - Uri, - WorkspaceConfiguration, - TextDocument, - WorkspaceFolder -} from 'vscode'; -import { SinonStub, stub } from 'sinon'; - -let getConfigurationStub: SinonStub< - [ - string?, - ( - | Uri - | TextDocument - | WorkspaceFolder - | { uri?: Uri | undefined; languageId: string } - | null - | undefined - )? - ], - WorkspaceConfiguration ->; -const mockBaseConfiguration = { - has(section: string) { - return true; - }, - inspect(section: string) { - return undefined; - }, - async update(section: string, value: any) {} -}; -const mockDebugConfigurationJson: { [index: string]: any } = {}; -const mockDebugConfiguration: WorkspaceConfiguration = { - ...mockBaseConfiguration, - get(section: string) { - return mockDebugConfigurationJson[section]; - } -}; - -/** - * Mock "debug.javascript.usePreview" value - * @param enabled is configuration enabled - */ -export function mockPreviewJavaScriptDebugger(enabled?: boolean) { - getConfigurationStub = stub(workspace, 'getConfiguration'); - mockDebugConfigurationJson['javascript.usePreview'] = enabled; - getConfigurationStub.returns(mockDebugConfiguration); -} - -export function unmockPreviewJavaScriptDebugger() { - getConfigurationStub.restore(); -} diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testExplorer/testNode.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testExplorer/testNode.test.ts deleted file mode 100644 index 59af8277f4..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testExplorer/testNode.test.ts +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import * as path from 'path'; -import * as vscode from 'vscode'; -import URI from 'vscode-uri'; -import { nls } from '../../../../src/messages'; -import { - SfTestGroupNode, - SfTestNode, - sortTestNodeByLabel -} from '../../../../src/testSupport/testExplorer/testNode'; -import { - TestCaseInfo, - TestFileInfo, - TestInfoKind, - TestResultStatus, - TestType -} from '../../../../src/testSupport/types'; - -describe('Sf Test Node', () => { - const mockDirectory = /^win32/.test(process.platform) - ? `C:\\Users\\tester` - : `/Users/tester`; - const mockTestFile = 'mockTest.test.js'; - const mockTestFilePath = path.join(mockDirectory, mockTestFile); - describe('Should set correct values for test nodes', () => { - it('Should set correct values for SfTestGroupNode', () => { - const testExecutionInfo: TestFileInfo = { - kind: TestInfoKind.TEST_FILE, - testType: TestType.LWC, - testUri: URI.file(mockTestFilePath) - }; - const mockLabel = 'mockTest'; - const groupNode = new SfTestGroupNode(mockLabel, testExecutionInfo); - const expectedCollpasibleState = - vscode.TreeItemCollapsibleState.Collapsed; - const expectedContextValue = 'lwcTestGroup'; - const expectedCommand = { - command: 'sf.lightning.lwc.test.navigateToTest', - title: nls.localize('lightning_lwc_test_navigate_to_test'), - arguments: [groupNode] - }; - const expectedDescription = mockLabel; - expect(groupNode.collapsibleState).to.equal(expectedCollpasibleState); - expect(groupNode.command).to.deep.equal(expectedCommand); - expect(groupNode.description).equal(expectedDescription); - expect(groupNode.contextValue).equal(expectedContextValue); - }); - - it('Should set correct values for SfTestNode', () => { - const testExecutionInfo: TestCaseInfo = { - kind: TestInfoKind.TEST_CASE, - testType: TestType.LWC, - testUri: URI.file(mockTestFilePath), - testName: 'mockTestName' - }; - const mockLabel = 'mockTestName'; - const testNode = new SfTestNode(mockLabel, testExecutionInfo); - const expectedCollpasibleState = vscode.TreeItemCollapsibleState.None; - const expectedContextValue = 'lwcTest'; - const expectedCommand = { - command: 'sf.lightning.lwc.test.navigateToTest', - title: nls.localize('lightning_lwc_test_navigate_to_test'), - arguments: [testNode] - }; - const expectedDescription = mockLabel; - expect(testNode.collapsibleState).to.equal(expectedCollpasibleState); - expect(testNode.command).to.deep.equal(expectedCommand); - expect(testNode.description).equal(expectedDescription); - expect(testNode.contextValue).equal(expectedContextValue); - }); - }); - - describe('Should set correct icon paths for test nodes', () => { - const testExecutionInfo: TestCaseInfo = { - kind: TestInfoKind.TEST_CASE, - testType: TestType.LWC, - testUri: URI.file(mockTestFilePath), - testName: 'mockTest' - }; - - it('Should set correct icon paths for tests not run', () => { - testExecutionInfo.testResult = undefined; - const mockLabel = 'mockTest'; - const groupNode = new SfTestNode(mockLabel, testExecutionInfo); - expect( - groupNode.iconPath.dark.toString().endsWith('testNotRun.svg') - ).to.equal(true); - expect( - groupNode.iconPath.light.toString().endsWith('testNotRun.svg') - ).to.equal(true); - }); - - it('Should set correct icon paths for passed tests', () => { - testExecutionInfo.testResult = { status: TestResultStatus.PASSED }; - const mockLabel = 'mockTest'; - const groupNode = new SfTestNode(mockLabel, testExecutionInfo); - expect( - groupNode.iconPath.dark.toString().endsWith('testPass.svg') - ).to.equal(true); - expect( - groupNode.iconPath.light.toString().endsWith('testPass.svg') - ).to.equal(true); - }); - - it('Should set correct icon paths for failed tests', () => { - testExecutionInfo.testResult = { status: TestResultStatus.FAILED }; - const mockLabel = 'mockTest'; - const groupNode = new SfTestNode(mockLabel, testExecutionInfo); - expect( - groupNode.iconPath.dark.toString().endsWith('testFail.svg') - ).to.equal(true); - expect( - groupNode.iconPath.light.toString().endsWith('testFail.svg') - ).to.equal(true); - }); - - it('Should set correct icon paths for skipped tests', () => { - testExecutionInfo.testResult = { status: TestResultStatus.SKIPPED }; - const mockLabel = 'mockTest'; - const groupNode = new SfTestNode(mockLabel, testExecutionInfo); - expect( - groupNode.iconPath.dark.toString().endsWith('testSkip.svg') - ).to.equal(true); - expect( - groupNode.iconPath.light.toString().endsWith('testSkip.svg') - ).to.equal(true); - }); - - it('Should set correct icon paths for tests with unknown results', () => { - testExecutionInfo.testResult = { - status: TestResultStatus.UNKNOWN - }; - const mockLabel = 'mockTest'; - const groupNode = new SfTestNode(mockLabel, testExecutionInfo); - expect( - groupNode.iconPath.dark.toString().endsWith('testNotRun.svg') - ).to.equal(true); - expect( - groupNode.iconPath.light.toString().endsWith('testNotRun.svg') - ).to.equal(true); - }); - }); - - describe('Should sort test nodes by label', () => { - const testExecutionInfo: TestFileInfo = { - kind: TestInfoKind.TEST_FILE, - testType: TestType.LWC, - testUri: URI.file(mockDirectory) - }; - - it('Comparator should return -1 when first node does not have label', () => { - const groupNode1 = new SfTestGroupNode('file1', testExecutionInfo); - const groupNode2 = new SfTestGroupNode('file2', testExecutionInfo); - groupNode1.label = undefined; - groupNode2.label = 'mock'; - expect(sortTestNodeByLabel(groupNode1, groupNode2)).to.equal(-1); - }); - it('Comparator should return 1 when second node does not have label', () => { - const groupNode1 = new SfTestGroupNode('file1', testExecutionInfo); - const groupNode2 = new SfTestGroupNode('file2', testExecutionInfo); - groupNode1.label = 'mock'; - groupNode2.label = undefined; - expect(sortTestNodeByLabel(groupNode1, groupNode2)).to.equal(1); - }); - it('Comparator should compare alphabetically', () => { - const groupNode1 = new SfTestGroupNode('file1', testExecutionInfo); - const groupNode2 = new SfTestGroupNode('file2', testExecutionInfo); - groupNode1.label = 'apple'; - groupNode2.label = 'cheese'; - expect(sortTestNodeByLabel(groupNode1, groupNode2)).to.equal(-1); - groupNode1.label = 'dog'; - groupNode2.label = 'cat'; - expect(sortTestNodeByLabel(groupNode1, groupNode2)).to.equal(1); - groupNode1.label = 'equal'; - groupNode2.label = 'equal'; - expect(sortTestNodeByLabel(groupNode1, groupNode2)).to.equal(0); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testExplorer/testOutlineProvider.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testExplorer/testOutlineProvider.test.ts deleted file mode 100644 index f2ccd7393a..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testExplorer/testOutlineProvider.test.ts +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { assert, match, SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import URI from 'vscode-uri'; -import { nls } from '../../../../src/messages'; -import { lwcTestNavigateToTest } from '../../../../src/testSupport/commands/lwcTestNavigateToTest'; -import { lwcTestRefreshTestExplorer } from '../../../../src/testSupport/commands/lwcTestRefreshTestExplorer'; -import { - lwcTestCaseRun, - lwcTestFileRun, - lwcTestRunAllTests -} from '../../../../src/testSupport/commands/lwcTestRunAction'; -import { - SfTestGroupNode, - SfTestNode -} from '../../../../src/testSupport/testExplorer/testNode'; -import { SfTestOutlineProvider } from '../../../../src/testSupport/testExplorer/testOutlineProvider'; -import { lwcTestIndexer } from '../../../../src/testSupport/testIndexer'; -import { SfTask } from '../../../../src/testSupport/testRunner/taskService'; -import { - TestExecutionInfo, - TestInfoKind, - TestResultStatus, - TestType, - TestFileInfo -} from '../../../../src/testSupport/types'; -import { - mockGetLwcTestRunnerExecutable, - mockSfTaskExecute, - unmockGetLwcTestRunnerExecutable, - unmockSfTaskExecute -} from '../mocks'; -import { - testCaseFailureResult, - testCaseSuccessResult, - testFileResult -} from '../mocks/testResultsMocks'; - -describe('LWC Test Outline Provider', () => { - describe('Should load exiting test files into test explorer view Unit Tests', () => { - let findAllTestFileInfoStub: SinonStub<[], Promise>; - beforeEach(() => { - findAllTestFileInfoStub = stub(lwcTestIndexer, 'findAllTestFileInfo'); - }); - afterEach(() => { - findAllTestFileInfoStub.restore(); - }); - - const mockFilePaths = Array.from({ length: 3 }, (array, i) => { - return /^win32/.test(process.platform) - ? `C:\\Users\\tester\\mockTest${i + 1}.test.js` - : `/Users/tester/mockTest${i + 1}.test.js`; - }); - const outlineProvder = new SfTestOutlineProvider(); - it('Should provide test group nodes', async () => { - const mockAllTestFileInfo = mockFilePaths.map(mockFilePath => ({ - kind: TestInfoKind.TEST_FILE, - testType: TestType.LWC, - testUri: URI.file(mockFilePath) - })); - // @ts-ignore - findAllTestFileInfoStub.returns(Promise.resolve(mockAllTestFileInfo)); - const nodes = await outlineProvder.getChildren(); - expect(nodes.length).to.equal(3); - expect(nodes.map(node => node.label)).to.eql([ - 'mockTest1', - 'mockTest2', - 'mockTest3' - ]); - }); - - it('Should sort test group nodes by label', async () => { - const mockAllTestFileInfo = [...mockFilePaths] - .reverse() - .map(mockFilePath => ({ - kind: TestInfoKind.TEST_FILE, - testType: TestType.LWC, - testUri: URI.file(mockFilePath) - })); - // @ts-ignore - findAllTestFileInfoStub.returns(Promise.resolve(mockAllTestFileInfo)); - const nodes = await outlineProvder.getChildren(); - expect(nodes.length).to.equal(3); - expect(nodes.map(node => node.label)).to.eql([ - 'mockTest1', - 'mockTest2', - 'mockTest3' - ]); - }); - - it('Should provide no nodes if no tests found', async () => { - findAllTestFileInfoStub.returns(Promise.resolve([])); - const nodes = await outlineProvder.getChildren(); - expect(nodes).to.eql([]); - }); - }); - - // These tests have been super flakey in CI. skipping - describe.skip('Test Explorer Integration Tests', () => { - let lwcTests: URI[]; - let lwcTestUri: URI; - let outlineProvder: SfTestOutlineProvider; - let actualFileNodes: SfTestGroupNode[]; - let actualFileNode: SfTestGroupNode; - let actualTestCaseNodes: SfTestNode[]; - before(async () => { - lwcTests = await vscode.workspace.findFiles( - new vscode.RelativePattern( - vscode.workspace.workspaceFolders![0], - '**/lwc/**/demoLwcComponent.test.js' - ) - ); - lwcTestUri = lwcTests[0]; - // Replace with integration test file uri - testFileResult.testResults[0].name = lwcTestUri.fsPath; - testCaseSuccessResult.testResults[0].name = lwcTestUri.fsPath; - testCaseFailureResult.testResults[0].name = lwcTestUri.fsPath; - outlineProvder = new SfTestOutlineProvider(); - actualFileNodes = await outlineProvder.getChildren(); - actualFileNode = actualFileNodes.find( - node => node.description === 'demoLwcComponent' - )!; - actualTestCaseNodes = await outlineProvder.getChildren(actualFileNode); - }); - - let activeTextEditorStub: SinonStub; - let showTextDocumentStub: SinonStub< - [vscode.Uri, (vscode.TextDocumentShowOptions | undefined)?], - Thenable - >; - let revealRangeStub: SinonStub< - [vscode.Range, (vscode.TextEditorRevealType | undefined)?], - void - >; - const mockActiveTextEditor = { - document: { - lineAt: (line: number) => {} - }, - revealRange: ( - range: vscode.Range, - revealType?: vscode.TextEditorRevealType - ) => {} - }; - beforeEach(() => { - mockGetLwcTestRunnerExecutable(); - mockSfTaskExecute(); - showTextDocumentStub = stub(vscode.window, 'showTextDocument'); - showTextDocumentStub.callsFake(() => Promise.resolve()); - activeTextEditorStub = stub(vscode.window, 'activeTextEditor').get(() => { - return mockActiveTextEditor; - }); - revealRangeStub = stub( - vscode.window.activeTextEditor as vscode.TextEditor, - 'revealRange' - ); - }); - afterEach(() => { - unmockGetLwcTestRunnerExecutable(); - unmockSfTaskExecute(); - showTextDocumentStub.restore(); - activeTextEditorStub.restore(); - revealRangeStub.restore(); - }); - - it('Should provide test file nodes and test cases nodes', async () => { - const expectedFileNode = { - label: 'demoLwcComponent', - description: 'demoLwcComponent', - collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, - contextValue: 'lwcTestGroup', - command: { - command: 'sf.lightning.lwc.test.navigateToTest', - title: nls.localize('lightning_lwc_test_navigate_to_test'), - arguments: [actualFileNode] - } - }; - assert.match(actualFileNode, expectedFileNode); - - const expectedTestCaseNodes = [ - { - label: 'Displays greeting', - description: 'Displays greeting', - collapsibleState: vscode.TreeItemCollapsibleState.None, - contextValue: 'lwcTest', - command: { - command: 'sf.lightning.lwc.test.navigateToTest', - title: nls.localize('lightning_lwc_test_navigate_to_test'), - arguments: [actualTestCaseNodes[0]] - } - }, - { - label: 'Failed test', - description: 'Failed test', - collapsibleState: vscode.TreeItemCollapsibleState.None, - contextValue: 'lwcTest', - command: { - command: 'sf.lightning.lwc.test.navigateToTest', - title: nls.localize('lightning_lwc_test_navigate_to_test'), - arguments: [actualTestCaseNodes[1]] - } - } - ]; - expect(actualTestCaseNodes.length).to.equal(2); - assert.match(actualTestCaseNodes[0], expectedTestCaseNodes[0]); - assert.match(actualTestCaseNodes[1], expectedTestCaseNodes[1]); - }); - - it('Should run all tests', async () => { - const commandResult = (await lwcTestRunAllTests()) as SfTask; - commandResult.onDidEnd(() => { - lwcTestIndexer.updateTestResults(testFileResult); - }); - return new Promise(resolve => { - const handleDidChangeTreeData = outlineProvder.onDidChangeTreeData( - async () => { - actualFileNodes = await outlineProvder.getChildren(); - actualTestCaseNodes = - await outlineProvder.getChildren(actualFileNode); - expect( - actualFileNode.testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.FAILED); - expect( - actualTestCaseNodes[0].testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.PASSED); - expect( - actualTestCaseNodes[1].testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.FAILED); - handleDidChangeTreeData.dispose(); - resolve(); - } - ); - }); - }); - - it('Should run tests from test file nodes', async () => { - const commandResult = (await lwcTestFileRun( - actualFileNode as { - testExecutionInfo: TestExecutionInfo; - } - )) as SfTask; - commandResult.onDidEnd(() => { - lwcTestIndexer.updateTestResults(testFileResult); - }); - return new Promise(resolve => { - const handleDidChangeTreeData = outlineProvder.onDidChangeTreeData( - async () => { - actualFileNodes = await outlineProvder.getChildren(); - actualTestCaseNodes = - await outlineProvder.getChildren(actualFileNode); - expect( - actualFileNode.testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.FAILED); - expect( - actualTestCaseNodes[0].testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.PASSED); - expect( - actualTestCaseNodes[1].testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.FAILED); - handleDidChangeTreeData.dispose(); - resolve(); - } - ); - }); - }); - - it('Should navigate to test file from test file nodes', () => { - lwcTestNavigateToTest(actualFileNode); - assert.calledOnce(showTextDocumentStub); - assert.calledOnce(revealRangeStub); - assert.calledWith( - revealRangeStub, - match( - new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)) - ) - ); - }); - - it('Should navigate to test case from test case nodes', () => { - lwcTestNavigateToTest(actualTestCaseNodes[0]); - assert.calledOnce(showTextDocumentStub); - assert.calledOnce(revealRangeStub); - assert.calledWith( - revealRangeStub, - match( - new vscode.Range( - new vscode.Position(11, 6), - new vscode.Position(11, 23) - ) - ) - ); - }); - - it('Should run test from a successful test case node', async () => { - const commandResult = (await lwcTestCaseRun( - actualFileNode as { - testExecutionInfo: TestExecutionInfo; - } - )) as SfTask; - commandResult.onDidEnd(() => { - lwcTestIndexer.updateTestResults(testCaseSuccessResult); - }); - return new Promise(resolve => { - const handleDidChangeTreeData = outlineProvder.onDidChangeTreeData( - async () => { - actualFileNodes = await outlineProvder.getChildren(); - actualTestCaseNodes = - await outlineProvder.getChildren(actualFileNode); - expect( - actualFileNode.testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.PASSED); - expect( - actualTestCaseNodes[0].testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.PASSED); - expect( - actualTestCaseNodes[1].testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.SKIPPED); - handleDidChangeTreeData.dispose(); - resolve(); - } - ); - }); - }); - - it('Should run test from a failed test case node and generates diagnostics for the test uri', async () => { - const commandResult = (await lwcTestCaseRun( - actualFileNode as { - testExecutionInfo: TestExecutionInfo; - } - )) as SfTask; - commandResult.onDidEnd(() => { - lwcTestIndexer.updateTestResults(testCaseFailureResult); - }); - return new Promise(resolve => { - const handleDidChangeTreeData = outlineProvder.onDidChangeTreeData( - async () => { - actualFileNodes = await outlineProvder.getChildren(); - actualTestCaseNodes = - await outlineProvder.getChildren(actualFileNode); - expect( - actualFileNode.testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.FAILED); - expect( - actualTestCaseNodes[0].testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.SKIPPED); - expect( - actualTestCaseNodes[1].testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.FAILED); - - const expectedErrorMessageBeginning = `Error: expect(received).toEqual(expected) // deep equality\n\nExpected: 2\nReceived: 1\n`; - expect( - vscode.languages - .getDiagnostics(lwcTestUri)[0] - .message.startsWith(expectedErrorMessageBeginning) - ).to.equal(true); - handleDidChangeTreeData.dispose(); - resolve(); - } - ); - }); - }); - - it('Should refresh test explorer', async function () { - this.timeout(10000); - lwcTestIndexer.updateTestResults(testCaseSuccessResult); - - actualFileNodes = await outlineProvder.getChildren(); - actualFileNode = actualFileNodes.find( - node => node.description === 'demoLwcComponent' - )!; - actualTestCaseNodes = await outlineProvder.getChildren(actualFileNode); - - expect( - actualTestCaseNodes[0].testExecutionInfo!.testResult!.status - ).to.equal(TestResultStatus.PASSED); - lwcTestRefreshTestExplorer(); - - actualFileNodes = await outlineProvder.getChildren(); - actualFileNode = actualFileNodes.find( - node => node.description === 'demoLwcComponent' - )!; - actualTestCaseNodes = await outlineProvder.getChildren(actualFileNode); - - expect(actualFileNode.testExecutionInfo!.testResult).to.equal(undefined); - expect(actualTestCaseNodes[0].testExecutionInfo!.testResult).to.equal( - undefined - ); - expect(actualTestCaseNodes[1].testExecutionInfo!.testResult).to.equal( - undefined - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testIndexer/jestUtils.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testIndexer/jestUtils.test.ts deleted file mode 100644 index 9664df9659..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testIndexer/jestUtils.test.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { ParsedNodeTypes } from 'jest-editor-support'; -import { - extractPositionFromFailureMessage, - IExtendedParseResults, - populateAncestorTitles, - sanitizeFailureMessage -} from '../../../../src/testSupport/testIndexer/jestUtils'; - -describe('Jest Utils', () => { - const mockFsPath = - '/Users/mockUser/sfdx-simple/force-app/main/default/lwc/demoLwcComponent/__tests__/demoLwcComponent.test.js'; - const mockFailureMessage = - 'Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoEqual\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // deep equality\u001b[22m\n\nExpected: \u001b[32m2\u001b[39m\nReceived: \u001b[31m1\u001b[39m\n at Object.expect (/Users/mockUser/sfdx-simple/force-app/main/default/lwc/demoLwcComponent/__tests__/demoLwcComponent.test.js:22:5)\n at Object.asyncJestTest (/Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)\n at /Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:43:12\n at new Promise ()\n at mapper (/Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:26:19)\n at /Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:73:41\n at processTicksAndRejections (internal/process/task_queues.js:93:5)'; - - it('Should populate ancestor titles', () => { - const parseResults = { - root: { - name: 'a', - type: ParsedNodeTypes.root, - children: [ - { - name: 'b', - type: ParsedNodeTypes.describe, - children: [ - { - name: 'c', - type: ParsedNodeTypes.describe, - children: [ - { - name: 'd', - type: ParsedNodeTypes.it, - children: [ - { - name: 'e1', - type: ParsedNodeTypes.expect - }, - { - name: 'e2', - type: ParsedNodeTypes.expect - } - ] - } - ] - } - ] - } - ] - } - }; - const expectedExtendedParseResults = Object.assign({}, parseResults, { - itBlocksWithAncestorTitles: [ - Object.assign( - {}, - parseResults.root.children[0].children[0].children[0], - { - ancestorTitles: ['a', 'b', 'c'] - } - ) - ] - }); - const extendedParseResults = populateAncestorTitles( - parseResults as IExtendedParseResults - ); - expect(extendedParseResults).to.eql(expectedExtendedParseResults); - }); - - it('Should extract position from failure message', () => { - const position = extractPositionFromFailureMessage( - mockFsPath, - mockFailureMessage - ); - expect(position!.line).to.equal(21); - expect(position!.character).to.equal(4); - }); - - it('Should sanitize failure message', () => { - const sanitizedMessage = sanitizeFailureMessage(mockFailureMessage); - const expectedSanitizedMessage = - 'Error: expect(received).toEqual(expected) // deep equality\n\nExpected: 2\nReceived: 1\n at Object.expect (/Users/mockUser/sfdx-simple/force-app/main/default/lwc/demoLwcComponent/__tests__/demoLwcComponent.test.js:22:5)\n at Object.asyncJestTest (/Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)\n at /Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:43:12\n at new Promise ()\n at mapper (/Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:26:19)\n at /Users/mockUser/sfdx-simple/node_modules/jest-jasmine2/build/queueRunner.js:73:41\n at processTicksAndRejections (internal/process/task_queues.js:93:5)'; - expect(sanitizedMessage).to.equal(expectedSanitizedMessage); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testIndexer/lwcTestIndexer.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testIndexer/lwcTestIndexer.test.ts deleted file mode 100644 index e1523a1005..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testIndexer/lwcTestIndexer.test.ts +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as jestTestSupport from 'jest-editor-support'; -import { SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import URI from 'vscode-uri'; -import { lwcTestIndexer } from '../../../../src/testSupport/testIndexer'; - -import { - TestFileInfo, - TestInfoKind, - TestResultStatus, - TestType -} from '../../../../src/testSupport/types'; - -describe('LWC Test Indexer', function() { - this.timeout(30000); - let lwcTests: URI[]; - let existingTestFileCount: number; - - before(async () => { - lwcTests = await vscode.workspace.findFiles( - new vscode.RelativePattern( - vscode.workspace.workspaceFolders![0], - '**/lwc/**/*.test.js' - ) - ); - - existingTestFileCount = lwcTests.length; - }); - - describe('Test Indexer File Watcher', () => { - let onDidCreateEventEmitter: vscode.EventEmitter; - let onDidChangeEventEmitter: vscode.EventEmitter; - let onDidDeleteEventEmitter: vscode.EventEmitter; - let readFileStub: SinonStub; - let mockFileSystemWatcher; - - let createFileSystemWatcherStub: SinonStub< - [ - vscode.GlobPattern, - (boolean | undefined)?, - (boolean | undefined)?, - (boolean | undefined)? - ], - vscode.FileSystemWatcher - >; - let parseStub: SinonStub< - [string, (string | undefined)?, (boolean | undefined)?], - jestTestSupport.IParseResults - >; - beforeEach(async () => { - createFileSystemWatcherStub = stub( - vscode.workspace, - 'createFileSystemWatcher' - ); - onDidCreateEventEmitter = new vscode.EventEmitter(); - onDidChangeEventEmitter = new vscode.EventEmitter(); - onDidDeleteEventEmitter = new vscode.EventEmitter(); - mockFileSystemWatcher = { - onDidCreate: onDidCreateEventEmitter.event, - onDidChange: onDidChangeEventEmitter.event, - onDidDelete: onDidDeleteEventEmitter.event - }; - createFileSystemWatcherStub.returns( - mockFileSystemWatcher as vscode.FileSystemWatcher - ); - - const mockFile = `it('mockTestCase1', () => {})\nit('mockTestCase2', () => {})\n`; - readFileStub = stub(fs, 'readFileSync'); - readFileStub.callsFake(fileName => { - return mockFile; - }); - - await lwcTestIndexer.configureAndIndex(); - lwcTestIndexer.resetIndex(); - }); - afterEach(() => { - onDidCreateEventEmitter.dispose(); - onDidChangeEventEmitter.dispose(); - onDidDeleteEventEmitter.dispose(); - createFileSystemWatcherStub.restore(); - readFileStub.restore(); - }); - - function assertTestCasesMatch( - actualTestFileInfo: TestFileInfo | undefined, - expectedFilePath: string - ) { - const expectedTestCases = [ - { - testFsPath: expectedFilePath, - testName: 'mockTestCase1' - }, - { - testFsPath: expectedFilePath, - testName: 'mockTestCase2' - } - ]; - expect( - actualTestFileInfo!.testCasesInfo!.map(testCaseInfo => { - const { testName, testUri } = testCaseInfo; - return { - testFsPath: testUri.fsPath, - testName - }; - }) - ).to.eql(expectedTestCases); - } - - it('should update index on test file create', async () => { - let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - expect(allTestFileInfo.length).to.equal(existingTestFileCount); - - const mockFilePath = /^win32/.test(process.platform) - ? 'C:\\Users\\tester\\mockNewFile.test.js' - : '/Users/tester/mockNewFile.test.js'; - const mockFileUri = URI.file(mockFilePath); - return new Promise(resolve => { - const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex( - async () => { - allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - expect(allTestFileInfo.length).to.equal(existingTestFileCount + 1); - - const createdTestFileInfo = allTestFileInfo.find( - (testFileInfo: TestFileInfo) => { - return testFileInfo.testUri.fsPath === mockFileUri.fsPath; - } - ); - expect(createdTestFileInfo!.kind).to.equal(TestInfoKind.TEST_FILE); - expect(createdTestFileInfo!.testType).to.equal(TestType.LWC); - expect(createdTestFileInfo!.testLocation!.uri.fsPath).to.equal( - mockFileUri.fsPath - ); - expect( - createdTestFileInfo!.testLocation!.range.start.line - ).to.equal(0); - expect( - createdTestFileInfo!.testLocation!.range.start.character - ).to.equal(0); - expect(createdTestFileInfo!.testLocation!.range.end.line).to.equal( - 0 - ); - expect( - createdTestFileInfo!.testLocation!.range.end.character - ).to.equal(0); - - assertTestCasesMatch(createdTestFileInfo, mockFileUri.fsPath); - handleDidUpdateTestIndex.dispose(); - resolve(); - } - ); - onDidCreateEventEmitter.fire(mockFileUri); - }); - }); - - it('should update index on test file change', async () => { - const testFileUriToChange = lwcTests[0]; - let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - expect(allTestFileInfo.length).to.equal(existingTestFileCount); - return new Promise(resolve => { - const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex( - async () => { - allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - const changedTestFileInfo = allTestFileInfo.find( - (testFileInfo: TestFileInfo) => { - return ( - testFileInfo.testUri.fsPath === testFileUriToChange.fsPath - ); - } - ); - assertTestCasesMatch( - changedTestFileInfo, - testFileUriToChange.fsPath - ); - handleDidUpdateTestIndex.dispose(); - resolve(); - } - ); - onDidChangeEventEmitter.fire(testFileUriToChange); - }); - }); - - it('should update index on test file change when parsing has an error', async () => { - // Mock parsing error - readFileStub.callsFake(fileName => { - throw new Error(); - }); - const testFileUriToChange = lwcTests[0]; - let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - expect(allTestFileInfo.length).to.equal(existingTestFileCount); - return new Promise(resolve => { - const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex( - async () => { - allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - const changedTestFileInfo = allTestFileInfo.find( - (testFileInfo: TestFileInfo) => { - return ( - testFileInfo.testUri.fsPath === testFileUriToChange.fsPath - ); - } - ); - // If there's a parsing error, expect empty test cases info - expect(changedTestFileInfo!.testCasesInfo).to.eql([]); - handleDidUpdateTestIndex.dispose(); - resolve(); - } - ); - onDidChangeEventEmitter.fire(testFileUriToChange); - }); - }); - - it('should update index on test file change and merge existing test results if possible', async () => { - const testFileUriToChange = lwcTests[0]; - let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - expect(allTestFileInfo.length).to.equal(existingTestFileCount); - - // Mock raw test results on test file info - // This could be test results generated from previous runs, - // we are making sure that it will get merged in test cases info when test file changes. - const testFileInfoToChange = allTestFileInfo.find( - (testFileInfo: TestFileInfo) => { - return testFileInfo.testUri.fsPath === testFileUriToChange.fsPath; - } - ); - testFileInfoToChange!.rawTestResults = [ - { - title: 'mockTestCase1', - ancestorTitles: [], - status: TestResultStatus.PASSED - }, - { - title: 'mockTestCase2', - ancestorTitles: [], - status: TestResultStatus.FAILED - } - ]; - - return new Promise(resolve => { - // Set up test file change handler - const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex( - async () => { - allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - const changedTestFileInfo = allTestFileInfo.find( - (testFileInfo: TestFileInfo) => { - return ( - testFileInfo.testUri.fsPath === testFileUriToChange.fsPath - ); - } - ); - - // Assert that raw test results status is merged into test cases info - const expectedTestCases = [ - { - testFsPath: testFileUriToChange.fsPath, - testName: 'mockTestCase1', - testResult: { - status: TestResultStatus.PASSED - } - }, - { - testFsPath: testFileUriToChange.fsPath, - testName: 'mockTestCase2', - testResult: { - status: TestResultStatus.FAILED - } - } - ]; - expect( - changedTestFileInfo!.testCasesInfo!.map(testCaseInfo => { - const { testName, testResult, testUri } = testCaseInfo; - return { - testFsPath: testUri.fsPath, - testName, - testResult - }; - }) - ).to.eql(expectedTestCases); - - // Restore - handleDidUpdateTestIndex.dispose(); - testFileInfoToChange!.rawTestResults = undefined; - resolve(); - } - ); - // Changing the file - onDidChangeEventEmitter.fire(testFileUriToChange); - }); - }); - - it('should update index on test file delete', async () => { - let allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - expect(allTestFileInfo.length).to.equal(existingTestFileCount); - const testFileUriToDelete = lwcTests[0]; - return new Promise(resolve => { - const handleDidUpdateTestIndex = lwcTestIndexer.onDidUpdateTestIndex( - async () => { - allTestFileInfo = await lwcTestIndexer.findAllTestFileInfo(); - expect(allTestFileInfo.length).to.equal(existingTestFileCount - 1); - - const deletedTestFileInfo = allTestFileInfo.find( - (testFileInfo: TestFileInfo) => { - return ( - testFileInfo.testUri.fsPath === testFileUriToDelete.fsPath - ); - } - ); - expect(deletedTestFileInfo).to.be.an('undefined'); - handleDidUpdateTestIndex.dispose(); - resolve(); - } - ); - onDidDeleteEventEmitter.fire(testFileUriToDelete); - }); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/index.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/index.test.ts deleted file mode 100644 index 2de01b43f8..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/index.test.ts +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import * as pathUtils from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as path from 'path'; -import { SinonStub, stub } from 'sinon'; -import * as uuid from 'uuid'; -import * as vscode from 'vscode'; -import URI from 'vscode-uri'; -import { - TestCaseInfo, - TestInfoKind, - TestType -} from '../../../../src/testSupport/types'; - -import { - TestRunner, - TestRunType -} from '../../../../src/testSupport/testRunner'; -import { InputBuffer } from 'uuid/interfaces'; -import { projectPaths } from '@salesforce/salesforcedx-utils-vscode'; - -describe('LWC Test Runner', () => { - describe('Jest Execution Info Unit Tests', () => { - let uuidStub: SinonStub< - [({ random: InputBuffer } | { rng(): InputBuffer } | undefined)?], - string - >; - let getTempFolderStub: SinonStub<[string, string], string>; - beforeEach(() => { - uuidStub = stub(uuid, 'v4'); - const mockUuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'; - uuidStub.returns(mockUuid); - getTempFolderStub = stub(pathUtils, 'getTestResultsFolder'); - getTempFolderStub.callsFake((testType: string) => { - return path.join(projectPaths.testResultsFolder(), testType); - }); - }); - afterEach(() => { - uuidStub.restore(); - getTempFolderStub.restore(); - }); - - const root = /^win32/.test(process.platform) ? 'C:\\' : '/var'; - const salesforceProjectPath = path.join( - root, - 'project', - 'mockSalesforceProject' - ); - const testFsPath = path.join( - salesforceProjectPath, - 'force-app', - 'main', - 'default', - 'lwc', - 'mockComponent', - '__tests__', - 'mockTest.test.js' - ); - const mockWorkspaceFolder = { uri: URI.file(salesforceProjectPath) }; - it('Should get jest execution info for test case', () => { - const testName = 'mockTestName'; - const testUri = URI.file(testFsPath); - const testExecutionInfo: TestCaseInfo = { - kind: TestInfoKind.TEST_CASE, - testType: TestType.LWC, - testUri, - testName - }; - const jestExecutionInfo = new TestRunner( - testExecutionInfo, - TestRunType.RUN - ).getJestExecutionInfo(mockWorkspaceFolder as vscode.WorkspaceFolder); - if (/^win32/.test(process.platform)) { - expect(jestExecutionInfo!.jestArgs).to.eql([ - '--json', - '--outputFile', - 'c:\\project\\mockSalesforceProject\\.sfdx\\tools\\testresults\\lwc\\test-result-aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.json', - '--testLocationInResults', - '--runTestsByPath', - 'force-app\\main\\default\\lwc\\mockComponent\\__tests__\\mockTest.test.js', - '--testNamePattern', - 'mockTestName' - ]); - } else { - expect(jestExecutionInfo!.jestArgs).to.eql([ - '--json', - '--outputFile', - '/var/project/mockSalesforceProject/.sfdx/tools/testresults/lwc/test-result-aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.json', - '--testLocationInResults', - '--runTestsByPath', - '/var/project/mockSalesforceProject/force-app/main/default/lwc/mockComponent/__tests__/mockTest.test.js', - '--testNamePattern', - 'mockTestName' - ]); - } - }); - - it('Should get jest execution info for test case with special characters', () => { - const testName = 'Mock Test Name (+.*)'; - const testUri = URI.file(testFsPath); - const testExecutionInfo: TestCaseInfo = { - kind: TestInfoKind.TEST_CASE, - testType: TestType.LWC, - testUri, - testName - }; - const jestExecutionInfo = new TestRunner( - testExecutionInfo, - TestRunType.RUN - ).getJestExecutionInfo(mockWorkspaceFolder as vscode.WorkspaceFolder); - const escapedMockTestName = 'Mock Test Name \\(\\+\\.\\*\\)'; - if (/^win32/.test(process.platform)) { - expect(jestExecutionInfo!.jestArgs).to.eql([ - '--json', - '--outputFile', - 'c:\\project\\mockSalesforceProject\\.sfdx\\tools\\testresults\\lwc\\test-result-aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.json', - '--testLocationInResults', - '--runTestsByPath', - 'force-app\\main\\default\\lwc\\mockComponent\\__tests__\\mockTest.test.js', - '--testNamePattern', - `${escapedMockTestName}` - ]); - } else { - expect(jestExecutionInfo!.jestArgs).to.eql([ - '--json', - '--outputFile', - '/var/project/mockSalesforceProject/.sfdx/tools/testresults/lwc/test-result-aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.json', - '--testLocationInResults', - '--runTestsByPath', - '/var/project/mockSalesforceProject/force-app/main/default/lwc/mockComponent/__tests__/mockTest.test.js', - '--testNamePattern', - `${escapedMockTestName}` - ]); - } - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/taskService.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/taskService.test.ts deleted file mode 100644 index 6d3ac6ae74..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/taskService.test.ts +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { assert, SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import { taskService } from '../../../../src/testSupport/testRunner/taskService'; -import { nls } from '../../../../src/messages'; -import { ChannelService } from '@salesforce/salesforcedx-utils-vscode'; - -describe('Task Service Unit Tests', () => { - let executeTaskStub: SinonStub< - [vscode.Task], - Thenable - >; - let onDidStartTaskStub: SinonStub< - [ - (e: vscode.TaskStartEvent) => any, - any?, - (vscode.Disposable[] | undefined)? - ], - vscode.Disposable - >; - let onDidEndTaskStub: SinonStub< - [(e: vscode.TaskEndEvent) => any, any?, (vscode.Disposable[] | undefined)?], - vscode.Disposable - >; - let onDidStartTaskEmitter: vscode.EventEmitter; - let onDidEndTaskEmitter: vscode.EventEmitter; - let channelServiceAppendLineStub: SinonStub; - let taskServiceRegistration: vscode.Disposable; - beforeEach(() => { - executeTaskStub = stub(vscode.tasks, 'executeTask'); - executeTaskStub.returns(Promise.resolve()); - onDidStartTaskEmitter = new vscode.EventEmitter(); - onDidEndTaskEmitter = new vscode.EventEmitter(); - onDidStartTaskStub = stub(vscode.tasks, 'onDidStartTask'); - onDidStartTaskStub.callsFake(onDidStartTaskEmitter.event); - onDidEndTaskStub = stub(vscode.tasks, 'onDidEndTask'); - onDidEndTaskStub.callsFake(onDidEndTaskEmitter.event); - channelServiceAppendLineStub = stub( - ChannelService.prototype, - 'appendLine' as any - ); - taskServiceRegistration = taskService.registerTaskService({} as any); - }); - afterEach(() => { - executeTaskStub.restore(); - onDidStartTaskEmitter.dispose(); - onDidEndTaskEmitter.dispose(); - onDidStartTaskStub.restore(); - onDidEndTaskStub.restore(); - channelServiceAppendLineStub.restore(); - taskServiceRegistration.dispose(); - }); - - const mockVscodeTask: vscode.Task = { - name: 'mockTaskName', - source: 'SFDX', - isBackground: false, - presentationOptions: { - clear: true - }, - problemMatchers: [], - runOptions: {}, - definition: { - type: 'sfLwcTest' - }, - scope: undefined - }; - - describe('Create Tasks', () => { - it('Should output a message about default shell is cmd.exe in Windows', () => { - const isWin32 = /^win32/.test(process.platform); - const mockTaskId = 'mockTask1'; - const mockTaskName = 'mockTaskName'; - taskService.createTask( - mockTaskId, - mockTaskName, - vscode.workspace.workspaceFolders![0], - 'mockCommand', - [] - ); - if (isWin32) { - assert.calledOnce(channelServiceAppendLineStub); - assert.calledWith( - channelServiceAppendLineStub, - nls.localize('task_windows_command_prompt_messaging') - ); - } else { - assert.notCalled(channelServiceAppendLineStub); - } - }); - }); - - describe('Notifies starts and end task events', () => { - it('Should notify start task', async () => { - const mockTaskId = 'mockTask1'; - const mockTaskName = 'mockTaskName'; - const sfTask = taskService.createTask( - mockTaskId, - mockTaskName, - vscode.workspace.workspaceFolders![0], - 'mockCommand', - [] - ); - return new Promise(async resolve => { - sfTask.onDidStart(startedTask => { - expect(startedTask).to.equal(sfTask); - resolve(); - }); - await sfTask.execute(); - onDidStartTaskEmitter.fire({ - execution: { - task: { - ...mockVscodeTask, - ...{ definition: { type: 'sfLwcTest', sfTaskId: mockTaskId } } - }, - terminate: () => {} - } - }); - }); - }); - - it('Should notify end task', async () => { - const mockTaskId = 'mockTask2'; - const mockTaskName = 'mockTaskName'; - const sfTask = taskService.createTask( - mockTaskId, - mockTaskName, - vscode.workspace.workspaceFolders![0], - 'mockCommand', - [] - ); - return new Promise(async resolve => { - sfTask.onDidEnd(endedTask => { - expect(endedTask).to.equal(sfTask); - resolve(); - }); - await sfTask.execute(); - onDidEndTaskEmitter.fire({ - execution: { - task: { - ...mockVscodeTask, - ...{ definition: { type: 'sfLwcTest', sfTaskId: mockTaskId } } - }, - terminate: () => {} - } - }); - }); - }); - - it('Should dispose task on finishing execution', async () => { - const mockTaskId = 'mockTask3'; - const mockTaskName = 'mockTaskName'; - const sfTask = taskService.createTask( - mockTaskId, - mockTaskName, - vscode.workspace.workspaceFolders![0], - 'mockCommand', - [] - ); - const disposeStub = stub(sfTask, 'dispose'); - return new Promise(async resolve => { - sfTask.onDidEnd(endedTask => { - expect(endedTask).to.equal(sfTask); - process.nextTick(() => { - assert.calledOnce(disposeStub); - disposeStub.restore(); - resolve(); - }); - }); - await sfTask.execute(); - onDidEndTaskEmitter.fire({ - execution: { - task: { - ...mockVscodeTask, - ...{ definition: { type: 'sfLwcTest', sfTaskId: mockTaskId } } - }, - terminate: () => {} - } - }); - }); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/testWatcher.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/testWatcher.test.ts deleted file mode 100644 index 94d23f5cb4..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/testRunner/testWatcher.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { assert, SinonStub, stub } from 'sinon'; -import { telemetryService } from '../../../../src/telemetry'; -import { testWatcher } from '../../../../src/testSupport/testRunner/testWatcher'; -import { LWC_TEST_WATCH_LOG_NAME } from '../../../../src/testSupport/types/constants'; -import { - createMockTestFileInfo, - mockGetLwcTestRunnerExecutable, - mockSfTaskExecute, - unmockGetLwcTestRunnerExecutable, - unmockSfTaskExecute -} from '../mocks'; -import { expect } from 'chai'; - -describe('Test Watcher', () => { - describe('Telemetry for watching tests', () => { - let telemetryStub: SinonStub< - [(string | undefined)?, ([number, number] | undefined)?, any?, any?], - void - >; - let processHrtimeStub: SinonStub< - [([number, number] | undefined)?], - [number, number] - >; - beforeEach(() => { - telemetryStub = stub(telemetryService, 'sendCommandEvent'); - processHrtimeStub = stub(process, 'hrtime'); - mockSfTaskExecute(true); - mockGetLwcTestRunnerExecutable(); - }); - afterEach(() => { - processHrtimeStub.restore(); - telemetryStub.restore(); - unmockSfTaskExecute(); - unmockGetLwcTestRunnerExecutable(); - }); - - it('Should remove test from tests being watched on ending watch task', async () => { - const testExecutionInfo = createMockTestFileInfo(); - const task = await testWatcher.watchTest(testExecutionInfo); - expect(testWatcher.isWatchingTest(testExecutionInfo.testUri)).to.equal( - true - ); - // For test purpose, simulate ending watch task by notifyEndTask - task!.notifyEndTask(); - expect(testWatcher.isWatchingTest(testExecutionInfo.testUri)).to.equal( - false - ); - - // Terminate and clean up task - task!.terminate(); - }); - - it('Should send telemetry for watching tests', async () => { - const testExecutionInfo = createMockTestFileInfo(); - const mockExecutionTime: [number, number] = [123, 456]; - processHrtimeStub.returns(mockExecutionTime); - await testWatcher.watchTest(testExecutionInfo); - assert.calledOnce(telemetryStub); - assert.calledWith( - telemetryStub, - LWC_TEST_WATCH_LOG_NAME, - mockExecutionTime, - { - workspaceType: 'SFDX' - } - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/getCliArgsFromJestArgs.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/getCliArgsFromJestArgs.test.ts deleted file mode 100644 index 7e018f859e..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/getCliArgsFromJestArgs.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { workspace } from '../../../../src/testSupport/workspace'; -import { TestRunType } from '../../../../src/testSupport/testRunner/testRunner'; -import { - mockPreviewJavaScriptDebugger, - unmockPreviewJavaScriptDebugger -} from '../mocks'; - -describe('getCliArgsFromJestArgs Unit Tests', () => { - const mockJestArgs = [ - '--json', - '--outputFile', - 'test-result.json', - '--testLocationInResults', - '--runTestsByPath', - 'mockTestPath' - ]; - - afterEach(() => { - unmockPreviewJavaScriptDebugger(); - }); - - it('Should return Cli args for run mode', () => { - mockPreviewJavaScriptDebugger(true); - const cliArgs = workspace.getCliArgsFromJestArgs( - mockJestArgs, - TestRunType.RUN - ); - const expectedCliArgs = ['--', ...mockJestArgs]; - expect(cliArgs).to.eql(expectedCliArgs); - }); - - it('Should return Cli args for watch mode', () => { - mockPreviewJavaScriptDebugger(true); - const cliArgs = workspace.getCliArgsFromJestArgs( - mockJestArgs, - TestRunType.WATCH - ); - const expectedCliArgs = ['--', ...mockJestArgs]; - expect(cliArgs).to.eql(expectedCliArgs); - }); - - it('Should return Cli args for debug mode if not using preview JavaScript debugger', () => { - mockPreviewJavaScriptDebugger(false); - const cliArgs = workspace.getCliArgsFromJestArgs( - mockJestArgs, - TestRunType.DEBUG - ); - const expectedCliArgs = ['--debug', '--', ...mockJestArgs]; - expect(cliArgs).to.eql(expectedCliArgs); - }); - - it('Should return Cli args for debug mode if preview JavaScript debugger setting is not available', () => { - mockPreviewJavaScriptDebugger(undefined); - const cliArgs = workspace.getCliArgsFromJestArgs( - mockJestArgs, - TestRunType.DEBUG - ); - const expectedCliArgs = ['--', ...mockJestArgs]; - expect(cliArgs).to.eql(expectedCliArgs); - }); - - it('Should return Cli args for debug mode if using preview JavaScript debugger', () => { - mockPreviewJavaScriptDebugger(true); - const cliArgs = workspace.getCliArgsFromJestArgs( - mockJestArgs, - TestRunType.DEBUG - ); - const expectedCliArgs = ['--', ...mockJestArgs]; - expect(cliArgs).to.eql(expectedCliArgs); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/getLwcTestRunnerExecutable.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/getLwcTestRunnerExecutable.test.ts deleted file mode 100644 index b3ae606236..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/getLwcTestRunnerExecutable.test.ts +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { shared as lspCommon } from '@salesforce/lightning-lsp-common'; -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import * as vscode from 'vscode'; -import { assert, SinonSpy, SinonStub, spy, stub } from 'sinon'; -import * as which from 'which'; -import { nls } from '../../../../src/messages'; -import { telemetryService } from '../../../../src/telemetry'; -import { - workspace, - workspaceService -} from '../../../../src/testSupport/workspace'; - -describe('getLwcTestRunnerExecutable Unit Tests', () => { - let existsSyncStub: SinonStub<[fs.PathLike], boolean>; - let whichSyncStub: SinonStub<[string], fs.PathLike>; - let notificationStub: SinonSpy< - [string, vscode.MessageOptions, ...vscode.MessageItem[]], - Thenable - >; - let telemetryStub: SinonStub<[string, string], void>; - let getCurrentWorkspaceTypeStub: SinonStub<[], lspCommon.WorkspaceType>; - beforeEach(() => { - existsSyncStub = stub(fs, 'existsSync'); - notificationStub = spy(vscode.window, 'showErrorMessage'); - telemetryStub = stub(telemetryService, 'sendException'); - getCurrentWorkspaceTypeStub = stub( - workspaceService, - 'getCurrentWorkspaceType' - ); - }); - - afterEach(() => { - existsSyncStub.restore(); - notificationStub.restore(); - telemetryStub.restore(); - getCurrentWorkspaceTypeStub.restore(); - }); - - const root = /^win32/.test(process.platform) ? 'C:\\' : '/var'; - describe('SFDX Workspace', () => { - const salesforceProjectPath = path.join( - root, - 'project', - 'mockSalesforceProject' - ); - beforeEach(() => { - getCurrentWorkspaceTypeStub.returns(lspCommon.WorkspaceType.SFDX); - }); - - it('Should return LWC Test Runner Path when LWC Test Runner is installed and not display error message', () => { - existsSyncStub.returns(true); - const lwcTestRunnerExecutable = workspace.getLwcTestRunnerExecutable( - salesforceProjectPath - ); - expect(lwcTestRunnerExecutable).to.equal( - path.join(salesforceProjectPath, 'node_modules', '.bin', 'lwc-jest') - ); - assert.notCalled(notificationStub); - assert.notCalled(telemetryStub); - }); - - it('Should display error message when LWC Jest Test Runner is not installed', () => { - existsSyncStub.returns(false); - workspace.getLwcTestRunnerExecutable(salesforceProjectPath); - assert.calledOnce(notificationStub); - // @ts-ignore - assert.calledWith( - notificationStub, - nls.localize('no_lwc_jest_found_text') - ); - assert.calledOnce(telemetryStub); - assert.calledWith( - telemetryStub, - 'lwc_test_no_lwc_jest_found', - nls.localize('no_lwc_jest_found_text') - ); - }); - }); - - describe('Internal Dev Workspace', () => { - const projectPath = path.join(root, 'project', 'mockProject'); - const mockLwcTestRunnerPath = path.join('/bin', 'lwc-test'); - beforeEach(() => { - getCurrentWorkspaceTypeStub.returns(lspCommon.WorkspaceType.CORE_PARTIAL); - whichSyncStub = stub(which, 'sync'); - whichSyncStub.returns(mockLwcTestRunnerPath); - }); - - afterEach(() => { - whichSyncStub.restore(); - }); - - it('Should return LWC Test Runner Path when LWC Test Runner is installed and not display error message', () => { - existsSyncStub.returns(true); - const lwcTestRunnerExecutable = - workspace.getLwcTestRunnerExecutable(projectPath); - expect(lwcTestRunnerExecutable).to.equal(mockLwcTestRunnerPath); - assert.notCalled(notificationStub); - assert.notCalled(telemetryStub); - }); - - it('Should display error message when LWC Jest Test Runner is not installed', () => { - existsSyncStub.returns(false); - workspace.getLwcTestRunnerExecutable(projectPath); - assert.calledOnce(notificationStub); - // @ts-ignore - assert.calledWith( - notificationStub, - nls.localize('no_lwc_testrunner_found_text') - ); - assert.calledOnce(telemetryStub); - assert.calledWith( - telemetryStub, - 'lwc_test_no_lwc_testrunner_found', - nls.localize('no_lwc_testrunner_found_text') - ); - }); - }); - - describe('Unsupported Workspace', () => { - const projectPath = path.join(root, 'project', 'mockProject'); - it('Should send exception in unsupported workspace', () => { - getCurrentWorkspaceTypeStub.returns(lspCommon.WorkspaceType.UNKNOWN); - workspace.getLwcTestRunnerExecutable(projectPath); - assert.calledOnce(telemetryStub); - assert.calledWith( - telemetryStub, - 'lwc_test_no_lwc_testrunner_found', - 'Unsupported workspace' - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/workspaceService.test.ts b/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/workspaceService.test.ts deleted file mode 100644 index 1c5849d4e2..0000000000 --- a/packages/salesforcedx-vscode-lwc/test/vscode-integration/testSupport/workspace/workspaceService.test.ts +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { shared as lspCommon } from '@salesforce/lightning-lsp-common'; -import { expect } from 'chai'; -import { assert, SinonStub, stub } from 'sinon'; -import * as vscode from 'vscode'; -import { workspaceService } from '../../../../src/testSupport/workspace/workspaceService'; - -describe('Workspace Service Unit Tests', () => { - let originalWorkspaceType: lspCommon.WorkspaceType; - let executeCommandStub: SinonStub<[string, ...any[]], Thenable>; - beforeEach(() => { - originalWorkspaceType = workspaceService.getCurrentWorkspaceType(); - executeCommandStub = stub(vscode.commands, 'executeCommand'); - }); - - afterEach(() => { - workspaceService.setCurrentWorkspaceType(originalWorkspaceType); - executeCommandStub.restore(); - }); - - describe('SFDX workspace', () => { - beforeEach(() => { - workspaceService.register({} as any, lspCommon.WorkspaceType.SFDX); - }); - - it('isSFDXWorkspace should return true', () => { - expect( - workspaceService.isSFDXWorkspace(lspCommon.WorkspaceType.SFDX) - ).to.equal(true); - }); - - it('isCoreWorkspace should return false', () => { - expect( - workspaceService.isCoreWorkspace(lspCommon.WorkspaceType.SFDX) - ).to.equal(false); - }); - - it('getCurrentWorkspaceType should return correctly', () => { - expect(workspaceService.getCurrentWorkspaceType()).to.equal( - lspCommon.WorkspaceType.SFDX - ); - }); - - it('getCurrentWorkspaceTypeForTelemetry should return correctly', () => { - expect(workspaceService.getCurrentWorkspaceTypeForTelemetry()).to.equal( - 'SFDX' - ); - }); - - it('should set sf:internal_dev to false', () => { - assert.calledOnce(executeCommandStub); - assert.calledWith( - executeCommandStub, - 'setContext', - 'sf:internal_dev', - false - ); - }); - }); - - describe('Core all workspace', () => { - beforeEach(() => { - workspaceService.register({} as any, lspCommon.WorkspaceType.CORE_ALL); - }); - - it('isSFDXWorkspace should return false', () => { - expect( - workspaceService.isSFDXWorkspace(lspCommon.WorkspaceType.CORE_ALL) - ).to.equal(false); - }); - - it('isCoreWorkspace should return true', () => { - expect( - workspaceService.isCoreWorkspace(lspCommon.WorkspaceType.CORE_ALL) - ).to.equal(true); - }); - - it('getCurrentWorkspaceType should return correctly', () => { - expect(workspaceService.getCurrentWorkspaceType()).to.equal( - lspCommon.WorkspaceType.CORE_ALL - ); - }); - - it('getCurrentWorkspaceTypeForTelemetry should return correctly', () => { - expect(workspaceService.getCurrentWorkspaceTypeForTelemetry()).to.equal( - 'CORE_ALL' - ); - }); - - it('should set sf:internal_dev to true', () => { - assert.calledOnce(executeCommandStub); - assert.calledWith( - executeCommandStub, - 'setContext', - 'sf:internal_dev', - true - ); - }); - }); - - describe('Core partial workspace', () => { - beforeEach(() => { - workspaceService.register( - {} as any, - lspCommon.WorkspaceType.CORE_PARTIAL - ); - }); - - it('isSFDXWorkspace should return false', () => { - expect( - workspaceService.isSFDXWorkspace(lspCommon.WorkspaceType.CORE_PARTIAL) - ).to.equal(false); - }); - - it('isCoreWorkspace should return true', () => { - expect( - workspaceService.isCoreWorkspace(lspCommon.WorkspaceType.CORE_PARTIAL) - ).to.equal(true); - }); - - it('getCurrentWorkspaceType should return correctly', () => { - expect(workspaceService.getCurrentWorkspaceType()).to.equal( - lspCommon.WorkspaceType.CORE_PARTIAL - ); - }); - - it('getCurrentWorkspaceTypeForTelemetry should return correctly', () => { - expect(workspaceService.getCurrentWorkspaceTypeForTelemetry()).to.equal( - 'CORE_PARTIAL' - ); - }); - - it('should set sf:internal_dev to true', () => { - assert.calledOnce(executeCommandStub); - assert.calledWith( - executeCommandStub, - 'setContext', - 'sf:internal_dev', - true - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/client/client.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/client/client.test.ts deleted file mode 100644 index 30e9ad5381..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/client/client.test.ts +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import { stubInterface } from '@salesforce/ts-sinon'; - -import { - extensions, - languages, - TextEditor, - Uri, - window, - workspace, - WorkspaceConfiguration, - commands -} from 'vscode'; -import { clearDiagnostics } from '../../../src/lspClient/client'; -import { stubMockConnection } from '../testUtilities'; -import { - SOQL_CONFIGURATION_NAME, - SOQL_VALIDATION_CONFIG -} from '../../../src/constants'; -import { Connection } from '@salesforce/core'; - -// eslint-disable-next-line @typescript-eslint/no-inferrable-types -async function sleep(ms: number = 0) { - return new Promise(resolve => { - setTimeout(resolve, ms); - }); -} - -function waitUntil(predicate: () => boolean, tries = 5, msecsPerTry = 50) { - return new Promise(async resolve => { - while (!predicate() && tries > 0) { - await sleep(msecsPerTry); - tries--; - } - resolve(); - }); -} - -describe('SOQL language client', () => { - let sandbox: sinon.SinonSandbox; - let soqlFileUri: Uri; - let textEditor: TextEditor; - let mockConnection: Connection; - let soqlExtension: any; - - beforeEach(async () => { - sandbox = sinon.createSandbox(); - mockConnection = stubMockConnection(sandbox); - soqlExtension = extensions.getExtension( - 'salesforce.salesforcedx-vscode-soql' - )!; - await soqlExtension.activate(); - clearDiagnostics(); - }); - - afterEach(async () => { - sandbox.restore(); - await commands.executeCommand('workbench.action.closeActiveEditor'); - try { - await workspace.fs.delete(soqlFileUri); - } catch (ignored) {} - }); - - it('should show diagnostics for syntax error', async () => { - soqlFileUri = await writeSOQLFile( - 'testSyntaxError', - `SELECT Id - FRM Account - ` - ); - await window.showTextDocument(soqlFileUri); - - const diagnostics = languages.getDiagnostics(soqlFileUri); - - expect(diagnostics) - .to.be.an('array') - .to.have.lengthOf(1); - expect(diagnostics[0].message).to.equal(`missing 'from' at 'Account'`); - }); - - it('should show diagnostics for syntax error only if file is open', async () => { - soqlFileUri = await writeSOQLFile( - 'testSyntaxError', - `SELECT Id - FRM Account - ` - ); - await window.showTextDocument(soqlFileUri); - - const diagnostics = languages.getDiagnostics(soqlFileUri); - expect(diagnostics) - .to.be.an('array') - .to.have.lengthOf(1); - expect(diagnostics[0].message).to.equal(`missing 'from' at 'Account'`); - - await commands.executeCommand('workbench.action.closeOtherEditors'); - await commands.executeCommand('workbench.action.closeActiveEditor'); - - // NOTE: deleting the file should NOT be necessary to trigger the clearing of Diagnostics, - // and it reality, it isn't. However, for some reason, during automated tests - // the 'workbench.action.close*Editor' commands don't seem to fire the `onDidClose()` callback - // on the language server side - await workspace.fs.delete(soqlFileUri); - await waitUntil( - () => languages.getDiagnostics(soqlFileUri).length === 0, - 10, - 300 - ); - - const fileDiags = languages.getDiagnostics(soqlFileUri); - - expect(fileDiags) - .to.be.an('array') - .to.have.lengthOf(0); - }); - - xit('should not create diagnostics based off of remote query validation by default', async () => { - soqlFileUri = await writeSOQLFile( - 'testSemanticErrors_remoteRunDefault', - 'SELECT Ids FROM Account' - ); - stubSOQLExtensionConfiguration( - sandbox, - { - // [SOQL_VALIDATION_CONFIG]: undefined - }, - soqlExtension - ); - - const querySpy = sandbox.stub(mockConnection, 'query'); - textEditor = await window.showTextDocument(soqlFileUri); - - await sleep(100); - - expect(querySpy.notCalled).to.be.true; - const diagnostics = languages.getDiagnostics(soqlFileUri); - expect(diagnostics) - .to.be.an('array') - .to.have.lengthOf(0); - }); - - xit('should not create diagnostics based off of remote query validation when disabled', async () => { - soqlFileUri = await writeSOQLFile( - 'testSemanticErrors_remoteRunDisabled', - 'SELECT Ids FROM Account' - ); - - stubSOQLExtensionConfiguration( - sandbox, - { - [SOQL_VALIDATION_CONFIG]: false - }, - soqlExtension - ); - - const serverError = `SELECT Ids FROM ACCOUNT\nERROR at Row:1:Column:8\nSome error at 'Ids'`; - const querySpy = sandbox.stub(mockConnection, 'query').throws({ - name: 'INVALID_FIELD', - errorCode: 'INVALID_FIELD', - message: serverError - }); - await window.showTextDocument(soqlFileUri); - - await sleep(100); - - expect(querySpy.notCalled).to.be.true; - const diagnostics = languages.getDiagnostics(soqlFileUri); - expect(diagnostics) - .to.be.an('array') - .to.have.lengthOf(0); - }); - - xit('should create diagnostics based off of remote query validation when Enabled', async () => { - soqlFileUri = await writeSOQLFile( - 'testSemanticErrors_remoteRunEnabled', - 'SELECT Ids FROM Account' - ); - - stubSOQLExtensionConfiguration( - sandbox, - { - [SOQL_VALIDATION_CONFIG]: true - }, - soqlExtension - ); - - const serverError = `SELECT Ids FROM ACCOUNT\nERROR at Row:1:Column:8\nSome error at 'Ids'`; - const expectedError = `SELECT Ids FROM ACCOUNT\nError:\nSome error at 'Ids'`; - - sandbox.stub(mockConnection, 'query').throws({ - name: 'INVALID_FIELD', - errorCode: 'INVALID_FIELD', - message: serverError - }); - - await window.showTextDocument(soqlFileUri); - - await waitUntil(() => { - return languages.getDiagnostics(soqlFileUri).length > 0; - }); - const diagnostics = languages.getDiagnostics(soqlFileUri); - expect(diagnostics) - .to.be.an('array') - .to.have.lengthOf(1); - expect(diagnostics[0].message).to.equal(expectedError); - expect(diagnostics[0].range.start.line).to.equal(0, 'range start line'); - expect(diagnostics[0].range.start.character).to.equal( - 7, - 'range start char' - ); - expect(diagnostics[0].range.end.line).to.equal(0, 'range end line'); - expect(diagnostics[0].range.end.character).to.equal(10, 'range end char'); - }); -}); - -function generateRandomInt() { - return Math.floor(Math.random() * Math.floor(Number.MAX_SAFE_INTEGER)); -} - -async function writeSOQLFile(baseName: string, content: string): Promise { - const fileName = `${baseName}_${generateRandomInt()}.soql`; - const workspacePath = workspace.workspaceFolders![0].uri.fsPath; - const encoder = new TextEncoder(); - const fileUri = Uri.file(path.join(workspacePath, fileName)); - await workspace.fs.writeFile(fileUri, encoder.encode(content)); - - return fileUri; -} - -function stubSOQLExtensionConfiguration( - sandbox: sinon.SinonSandbox, - configValues: { [key: string]: any }, - extension: any -) { - // const mockConfiguration = stubInterface(sandbox, { - // get: (key: string) => configValues[key] - // }); - const mockConfiguration = undefined; - - expect( - Object.keys(extension.packageJSON.contributes.configuration.properties) - ).to.contain(SOQL_CONFIGURATION_NAME + '.' + SOQL_VALIDATION_CONFIG); - sandbox.stub(workspace, 'getConfiguration').returns(mockConfiguration); -} diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/client/completion.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/client/completion.test.ts deleted file mode 100644 index 4bfbffdc1a..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/client/completion.test.ts +++ /dev/null @@ -1,641 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { Connection } from '@salesforce/core'; -import * as path from 'path'; -import * as fsExtra from 'fs-extra'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; - -import { CompletionItem, CompletionItemKind } from 'vscode'; -import { extensions, Position, Uri, workspace, commands } from 'vscode'; -import { - stubMockConnection, - spyChannelService, - stubFailingMockConnection -} from '../testUtilities'; - -let doc: vscode.TextDocument; -let soqlFileUri: Uri; -let workspacePath: string; -let sandbox: sinon.SinonSandbox; -let mockConnection: Connection; - -const aggregateFunctionItems = [ - { label: 'AVG(...)', kind: CompletionItemKind.Function }, - { label: 'MAX(...)', kind: CompletionItemKind.Function }, - { label: 'MIN(...)', kind: CompletionItemKind.Function }, - { label: 'SUM(...)', kind: CompletionItemKind.Function }, - { label: 'COUNT(...)', kind: CompletionItemKind.Function }, - { label: 'COUNT_DISTINCT(...)', kind: CompletionItemKind.Function } -]; - -const userFieldItems = [ - { label: 'Id', kind: CompletionItemKind.Field, detail: 'id' }, - { - label: 'Name', - kind: CompletionItemKind.Field, - detail: 'string' - }, - { - label: 'AccountId', - kind: CompletionItemKind.Field, - detail: 'reference' - }, - { - label: 'Account', - kind: CompletionItemKind.Class, - insertText: 'Account.', - detail: 'Ref. to Account' - }, - { label: 'IsDeleted', kind: 4, detail: 'boolean' } -]; - -// Register special provider to handle "embedded-soql" scheme. -// This is the case when working on SOQL blocks inside Apex. In this situation, -// SOQL LSP reads sobject metadata from the workspace's filesystem instead of -// using jsforce lib (which invokes the remote SF remote API). -workspace.registerTextDocumentContentProvider('embedded-soql', { - provideTextDocumentContent: (uri: Uri) => { - const originalUri = uri.path.replace(/^\//, '').replace(/.soql$/, ''); - return workspace.fs - .readFile(Uri.parse(originalUri)) - .then(content => content.toLocaleString()); - } -}); -const configDir = '.sfdx'; - -describe('Should do completion', async () => { - before(() => { - // Populate filesystem with sobject's metadata. This is for the embedded-soql case - const workspaceDir = path.normalize( - __dirname + `/../../../../../system-tests/assets/sfdx-simple/${configDir}` - ); - const targetDir = path.join(workspaceDir, 'tools', 'soqlMetadata'); - const soqlMetadataDir = path.normalize( - __dirname + '/../../../../test/vscode-integration/soqlMetadata/' - ); - - if (fsExtra.existsSync(targetDir)) { - console.log('Removing existing ' + targetDir); - fsExtra.removeSync(targetDir); - } - fsExtra.mkdirSync(targetDir, { recursive: true }); - console.log('Copying ' + soqlMetadataDir + ' to ' + targetDir); - fsExtra.copySync(soqlMetadataDir, targetDir, { recursive: true }); - const files = fsExtra.readdirSync(targetDir); - console.log('Copied ' + files.length + ' files'); - }); - - beforeEach(async () => { - workspacePath = workspace.workspaceFolders![0].uri.fsPath; - soqlFileUri = Uri.file( - path.join(workspacePath, `test_${generateRandomInt()}.soql`) - ); - sandbox = sinon.createSandbox(); - mockConnection = stubMockConnection(sandbox); - }); - - afterEach(async () => { - sandbox.restore(); - commands.executeCommand('workbench.action.closeActiveEditor'); - await workspace.fs.delete(soqlFileUri); - }); - - testCompletion('|', [ - { - label: 'SELECT', - kind: CompletionItemKind.Keyword - }, - { - label: 'SELECT ... FROM ...', - kind: CompletionItemKind.Snippet, - insertText: 'SELECT $2 FROM $1' - } - ]); - - testCompletion('SELECT id FROM |', [ - { label: 'Account', kind: CompletionItemKind.Class }, - { label: 'User', kind: CompletionItemKind.Class } - ]); - - // Test the case of "embedded-soql" scheme: - // SOQL LSP should read sobject metadata from the workspace's filesystem instead of - // using jsforce lib (which invokes the remote SF remote API). - // See test data at `packages/system-tests/assets/sfdx-simple/.sfdx/tools/soqlMetadata` - testCompletion( - 'SELECT id FROM |', - [ - { label: 'Account', kind: CompletionItemKind.Class }, - { label: 'Attachment', kind: CompletionItemKind.Class }, - { label: 'Case', kind: CompletionItemKind.Class }, - { label: 'Contact', kind: CompletionItemKind.Class }, - { label: 'Contract', kind: CompletionItemKind.Class }, - { label: 'Lead', kind: CompletionItemKind.Class }, - { label: 'Note', kind: CompletionItemKind.Class }, - { label: 'Opportunity', kind: CompletionItemKind.Class }, - { label: 'Order', kind: CompletionItemKind.Class }, - { label: 'Pricebook2', kind: CompletionItemKind.Class }, - { label: 'PricebookEntry', kind: CompletionItemKind.Class }, - { label: 'Product2', kind: CompletionItemKind.Class }, - { label: 'RecordType', kind: CompletionItemKind.Class }, - { label: 'Report', kind: CompletionItemKind.Class }, - { label: 'Task', kind: CompletionItemKind.Class }, - { label: 'User', kind: CompletionItemKind.Class } - ], - { embeddedSoql: true } - ); - - testCompletion('SELECT | FROM Account', [ - { label: 'Id', kind: CompletionItemKind.Field, detail: 'id' }, - { - label: 'Name', - kind: CompletionItemKind.Field, - detail: 'string' - }, - { label: 'Description', kind: 4, detail: 'textarea' }, - { label: 'CreatedDate', kind: 4, detail: 'datetime' }, - { label: 'BillingCity', kind: 4, detail: 'string' }, - { label: 'IsDeleted', kind: 4, detail: 'boolean' }, - { label: 'LastActivityDate', kind: 4, detail: 'date' }, - ...aggregateFunctionItems, - { - label: '(SELECT ... FROM ...)', - kind: CompletionItemKind.Snippet, - insertText: '(SELECT $2 FROM $1)' - }, - { label: 'COUNT()', kind: CompletionItemKind.Keyword }, - { label: 'TYPEOF', kind: CompletionItemKind.Keyword } - ]); - - // Test the case of "embedded-soql" scheme: - // SOQL LSP should read sobject metadata from the workspace's filesystem instead of - // using jsforce lib (which invokes the remote SF remote API). - // See test data at same path as soqlMetadataDir - testCompletion( - 'SELECT | FROM Account', - [ - { label: 'Id', kind: CompletionItemKind.Field, detail: 'id' }, - { - label: 'Name', - kind: CompletionItemKind.Field, - detail: 'string' - }, - { label: 'Description', kind: 4, detail: 'textarea' }, - { label: 'CreatedDate', kind: 4, detail: 'datetime' }, - { label: 'BillingCity', kind: 4, detail: 'string' }, - { label: 'IsDeleted', kind: 4, detail: 'boolean' }, - { label: 'LastActivityDate', kind: 4, detail: 'date' }, - { label: 'Website', kind: 4, detail: 'url' }, - { label: 'SystemModstamp', kind: 4, detail: 'datetime' }, - { label: 'ShippingPostalCode', kind: 4, detail: 'string' }, - ...aggregateFunctionItems, - { - label: '(SELECT ... FROM ...)', - kind: CompletionItemKind.Snippet, - insertText: '(SELECT $2 FROM $1)' - }, - { label: 'COUNT()', kind: CompletionItemKind.Keyword }, - { label: 'TYPEOF', kind: CompletionItemKind.Keyword } - ], - { embeddedSoql: true, allowExtraCompletionItems: true } - ); - - testCompletion('SELECT | FROM User', [ - ...userFieldItems, - ...aggregateFunctionItems, - { - label: '(SELECT ... FROM ...)', - kind: CompletionItemKind.Snippet, - insertText: '(SELECT $2 FROM $1)' - }, - { label: 'COUNT()', kind: CompletionItemKind.Keyword }, - { label: 'TYPEOF', kind: CompletionItemKind.Keyword } - ]); - - testCompletion('SELECT Id FROM Account WHERE |', [ - { label: 'Id', kind: CompletionItemKind.Field, detail: 'id' }, - { - label: 'Name', - kind: CompletionItemKind.Field, - detail: 'string' - }, - { label: 'Description', kind: 4, detail: 'textarea' }, - { label: 'CreatedDate', kind: 4, detail: 'datetime' }, - { label: 'BillingCity', kind: 4, detail: 'string' }, - { label: 'IsDeleted', kind: 4, detail: 'boolean' }, - { label: 'LastActivityDate', kind: 4, detail: 'date' }, - { label: 'NOT', kind: CompletionItemKind.Keyword } - ]); - - const basicOperators = ['IN (', 'NOT IN (', '=', '!=', '<>']; - const relativeOperators = ['<', '<=', '>', '>=']; - const idOperators = basicOperators; - const stringOperators = [...basicOperators, ...relativeOperators, 'LIKE']; - testCompletion( - 'SELECT Id FROM Account WHERE Id |', - idOperators.map(operator => ({ - label: operator, - kind: CompletionItemKind.Keyword - })) - ); - testCompletion( - 'SELECT Id FROM Account WHERE Name |', - stringOperators.map(operator => ({ - label: operator, - kind: CompletionItemKind.Keyword - })) - ); - - // Account.Name is not Nillable - testCompletion('SELECT Id FROM Account WHERE Name = |', [ - { label: 'abc123', kind: CompletionItemKind.Snippet } - ]); - - // Account.BillingCity IS Nillable - testCompletion('SELECT Id FROM Account WHERE BillingCity = |', [ - { - label: 'NULL', - kind: CompletionItemKind.Keyword - }, - { label: 'abc123', kind: CompletionItemKind.Snippet } - ]); - // Account.BillingCity IS Nillable, however, some operators never accept NULL - testCompletion('SELECT Id FROM Account WHERE BillingCity < |', [ - { label: 'abc123', kind: CompletionItemKind.Snippet } - ]); - testCompletion('SELECT Id FROM Account WHERE BillingCity <= |', [ - { label: 'abc123', kind: CompletionItemKind.Snippet } - ]); - testCompletion('SELECT Id FROM Account WHERE BillingCity > |', [ - { label: 'abc123', kind: CompletionItemKind.Snippet } - ]); - testCompletion('SELECT Id FROM Account WHERE BillingCity >= |', [ - { label: 'abc123', kind: CompletionItemKind.Snippet } - ]); - testCompletion('SELECT Id FROM Account WHERE BillingCity LIKE |', [ - { label: 'abc123', kind: CompletionItemKind.Snippet } - ]); - - testCompletion( - 'SELECT Id FROM Account WHERE IsDeleted = |', - ['TRUE', 'FALSE'].map(booleanValue => ({ - label: booleanValue, - kind: CompletionItemKind.Value - })) - ); - testCompletion('SELECT Channel FROM QuickText WHERE Channel = |', [ - { - label: 'NULL', - kind: CompletionItemKind.Keyword - }, - ...['Email', 'Portal', 'Phone'].map(booleanValue => ({ - label: booleanValue, - kind: CompletionItemKind.Value - })) - ]); - // NOTE: NULL not supported in INCLUDES/EXCLUDES list - testCompletion('SELECT Channel FROM QuickText WHERE Channel INCLUDES(|', [ - ...['Email', 'Portal', 'Phone'].map(booleanValue => ({ - label: booleanValue, - kind: CompletionItemKind.Value - })) - ]); - - testCompletion( - 'SELECT Id FROM Account WHERE CreatedDate < |', - [ - { - label: 'YYYY-MM-DDThh:mm:ssZ', - kind: CompletionItemKind.Snippet - }, - { - label: 'YESTERDAY', - kind: CompletionItemKind.Value - }, - { - label: 'LAST_90_DAYS', - kind: CompletionItemKind.Value - }, - { - label: 'LAST_N_DAYS:n', - kind: CompletionItemKind.Snippet - } - ], - { allowExtraCompletionItems: true } - ); - testCompletion( - 'SELECT Id FROM Account WHERE LastActivityDate < |', - [ - { - label: 'YYYY-MM-DD', - kind: CompletionItemKind.Snippet - }, - { - label: 'YESTERDAY', - kind: CompletionItemKind.Value - }, - { - label: 'LAST_90_DAYS', - kind: CompletionItemKind.Value - }, - { - label: 'LAST_N_DAYS:n', - kind: CompletionItemKind.Snippet - } - ], - { allowExtraCompletionItems: true } - ); - - testCompletion('SELECT Id, COUNT(Name) FROM Account GROUP BY |', [ - // NOTE: CreatedDate and Description are NOT groupable, so we DON'T them: - { label: '★ Id', kind: CompletionItemKind.Field, detail: 'id' }, - { - label: 'Name', - kind: CompletionItemKind.Field, - detail: 'string' - }, - { label: 'BillingCity', kind: CompletionItemKind.Field, detail: 'string' }, - { label: 'IsDeleted', kind: CompletionItemKind.Field, detail: 'boolean' }, - { - label: 'LastActivityDate', - kind: CompletionItemKind.Field, - detail: 'date' - }, - { label: 'CUBE', kind: CompletionItemKind.Keyword }, - { label: 'ROLLUP', kind: CompletionItemKind.Keyword } - ]); - - testCompletion('SELECT Id FROM Account ORDER BY |', [ - // NOTE: Description is NOT sorteable, so we DON'T expect it: - { label: 'Id', kind: CompletionItemKind.Field, detail: 'id' }, - { - label: 'CreatedDate', - kind: CompletionItemKind.Field, - detail: 'datetime' - }, - { - label: 'Name', - kind: CompletionItemKind.Field, - detail: 'string' - }, - { label: 'BillingCity', kind: CompletionItemKind.Field, detail: 'string' }, - { label: 'IsDeleted', kind: CompletionItemKind.Field, detail: 'boolean' }, - { - label: 'LastActivityDate', - kind: CompletionItemKind.Field, - detail: 'date' - } - ]); - - testCompletion('SELECT Id, (SELECT FROM |) FROM Account', [ - { label: 'Users', kind: CompletionItemKind.Class, detail: 'User' } - ]); - testCompletion('SELECT Id, (SELECT | FROM Users) FROM Account', [ - ...userFieldItems, - { label: 'TYPEOF', kind: CompletionItemKind.Keyword } - ]); - - testCompletion( - 'SELECT Id, (SELECT Name FROM Users ORDER BY |) FROM Account', - [ - // only sortable fields of User: - { label: 'Id', kind: CompletionItemKind.Field, detail: 'id' }, - { - label: 'Name', - kind: CompletionItemKind.Field, - detail: 'string' - }, - { label: 'IsDeleted', kind: 4, detail: 'boolean' } - ] - ); - - // Semi-join - testCompletion('SELECT Id FROM Account WHERE Id IN (SELECT | FROM User)', [ - { label: 'Id', kind: CompletionItemKind.Field, detail: 'id' }, - { - label: 'AccountId', - kind: CompletionItemKind.Field, - detail: 'reference' - } - ]); -}); - -describe('Should not do completion on metadata errors', async () => { - const workspaceDir = path.normalize( - __dirname + `/../../../../../system-tests/assets/sfdx-simple/${configDir}` - ); - const soqlMetadataDir = path.join(workspaceDir, 'tools', 'soqlMetadata'); - - before(() => { - if (fsExtra.existsSync(soqlMetadataDir)) { - console.log('Removing existing ' + soqlMetadataDir); - fsExtra.removeSync(soqlMetadataDir); - } - }); - - beforeEach(async () => { - workspacePath = workspace.workspaceFolders![0].uri.fsPath; - soqlFileUri = Uri.file( - path.join(workspacePath, `test_${generateRandomInt()}.soql`) - ); - sandbox = sinon.createSandbox(); - mockConnection = stubFailingMockConnection(sandbox); - }); - - afterEach(async () => { - sandbox.restore(); - commands.executeCommand('workbench.action.closeActiveEditor'); - await workspace.fs.delete(soqlFileUri); - }); - - testCompletion('SELECT Id FROM |', [], { - expectChannelMsg: - 'ERROR: We can’t retrieve ' + - 'the objects in the org. Make sure that you’re connected to an authorized org ' + - 'and have permissions to view the objects in the org.' - }); - testCompletion('SELECT Id FROM |', [], { - embeddedSoql: true, - expectChannelMsg: - 'ERROR: We can’t retrieve list of objects. ' + - 'Expected JSON files in directory: ' + - soqlMetadataDir + - '.' - }); - testCompletion( - 'SELECT | FROM Account', - [ - ...aggregateFunctionItems, - { - label: '(SELECT ... FROM ...)', - kind: CompletionItemKind.Snippet, - insertText: '(SELECT $2 FROM $1)' - }, - { label: 'COUNT()', kind: CompletionItemKind.Keyword }, - { label: 'TYPEOF', kind: CompletionItemKind.Keyword } - ], - { - expectChannelMsg: - 'ERROR: We can’t retrieve the fields for Account. Make sure that you’re connected ' + - 'to an authorized org and have permissions to view the object and fields.' - } - ); - - testCompletion( - 'SELECT | FROM Account', - [ - ...aggregateFunctionItems, - { - label: '(SELECT ... FROM ...)', - kind: CompletionItemKind.Snippet, - insertText: '(SELECT $2 FROM $1)' - }, - { label: 'COUNT()', kind: CompletionItemKind.Keyword }, - { label: 'TYPEOF', kind: CompletionItemKind.Keyword } - ], - { - embeddedSoql: true, - expectChannelMsg: - 'ERROR: We can’t retrieve the fields for Account. ' + - 'Expected metadata file at: ' + - path.join(soqlMetadataDir, '*', 'Account.json.') - // [soqlMetadataDir, '*', 'Account.json.'].join(path.sep) - } - ); -}); - -const shouldIgnoreCompletionItem = (i: CompletionItem) => - i.kind !== CompletionItemKind.Text; - -function testCompletion( - soqlTextWithCursorMarker: string, - expectedCompletionItems: CompletionItem[], - options: { - cursorChar?: string; - expectChannelMsg?: string; - allowExtraCompletionItems?: boolean; - embeddedSoql?: boolean; - only?: boolean; - skip?: boolean; - } = {} -) { - const { cursorChar = '|', expectChannelMsg } = options; - - const itFn = options.skip ? xit : options.only ? it.only : it; - - itFn(soqlTextWithCursorMarker, async () => { - const position = await prepareSOQLFileAndGetCursorPosition( - soqlTextWithCursorMarker, - soqlFileUri, - cursorChar - ); - - const channelServiceSpy = spyChannelService(sandbox); - const docUri = options.embeddedSoql - ? Uri.parse( - `embedded-soql://soql/${encodeURIComponent( - soqlFileUri.toString() - )}.soql` - ) - : soqlFileUri; - - let passed = false; - for (let tries = 3; !passed && tries > 0; tries--) { - try { - const actualCompletionItems = ( - (await vscode.commands.executeCommand( - 'vscode.executeCompletionItemProvider', - docUri, - position - )) as vscode.CompletionList - ).items; - - const pickMainItemKeys = (item: CompletionItem) => ({ - label: item.label, - kind: item.kind, - detail: item.detail - }); - const simplifiedActualCompletionItems = actualCompletionItems - .filter(shouldIgnoreCompletionItem) - .map(pickMainItemKeys); - const simplifiedExpectedCompletionItems = - expectedCompletionItems.map(pickMainItemKeys); - - if (options.allowExtraCompletionItems) { - expect(simplifiedActualCompletionItems).to.include.deep.members( - simplifiedExpectedCompletionItems - ); - } else { - expect(simplifiedActualCompletionItems).to.have.deep.members( - simplifiedExpectedCompletionItems - ); - } - - if (expectChannelMsg) { - expect(channelServiceSpy.called).to.equal(true); - console.log(channelServiceSpy.getCalls()); - expect(channelServiceSpy.lastCall.args[0].toLowerCase()).to.equal( - expectChannelMsg.toLowerCase() - ); - } - - passed = true; - } catch (failure) { - if (tries === 1) { - console.log(failure); - throw failure; - } else { - // give it a bit of time before trying again - channelServiceSpy.resetHistory(); - await sleep(100); - } - } - } - }); -} - -async function sleep(ms: number) { - return new Promise(resolve => setTimeout(resolve, ms)); -} - -export async function activate(docUri: vscode.Uri) { - const ext = extensions.getExtension('salesforce.salesforcedx-vscode-soql')!; - await ext.activate(); - try { - doc = await vscode.workspace.openTextDocument(docUri); - await vscode.window.showTextDocument(doc); - } catch (e) { - console.error(e); - } -} - -async function prepareSOQLFileAndGetCursorPosition( - soqlTextWithCursorMarker: string, - fileUri: vscode.Uri, - cursorChar: string = '|' -): Promise { - const position = getCursorPosition(soqlTextWithCursorMarker, cursorChar); - const soqlText = soqlTextWithCursorMarker.replace(cursorChar, ''); - - const encoder = new TextEncoder(); - await workspace.fs.writeFile(fileUri, encoder.encode(soqlText)); - await activate(fileUri); - return position; -} - -function getCursorPosition(text: string, cursorChar: string = '|'): Position { - for (const [line, lineText] of text.split('\n').entries()) { - const column = lineText.indexOf(cursorChar); - if (column >= 0) return new Position(line, column); - } - throw new Error(`Cursor ${cursorChar} not found in ${text} !`); -} - -function generateRandomInt() { - return Math.floor(Math.random() * Math.floor(Number.MAX_SAFE_INTEGER)); -} diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/commands/soqlBuilderToggle.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/commands/soqlBuilderToggle.test.ts deleted file mode 100644 index 7adb08fb79..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/commands/soqlBuilderToggle.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { createSandbox, SinonSandbox, SinonSpy, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { soqlBuilderToggle } from '../../../src/commands'; -import { BUILDER_VIEW_TYPE, EDITOR_VIEW_TYPE } from '../../../src/constants'; -import { telemetryService } from '../../../src/telemetry'; - -describe('soqlBuilderToggle should', () => { - let sb: SinonSandbox; - let telemetryStub: SinonStub; - let executeCommandSpy: SinonSpy; - - beforeEach(() => { - sb = createSandbox(); - telemetryStub = sb.stub(telemetryService, 'sendCommandEvent') as SinonStub; - executeCommandSpy = (sb.spy( - vscode.commands, - 'executeCommand' - ) as unknown) as SinonSpy; - }); - - afterEach(async () => { - sb.restore(); - }); - - it('sends telemetry and opens builder when vscode has active text editor mode', async () => { - sb.stub(vscode.window, 'activeTextEditor').get(() => { - return {} as vscode.TextEditor; - }); - await soqlBuilderToggle({} as vscode.Uri); - - // tslint:disable-next-line:no-unused-expression - expect(telemetryStub.called).is.true; - expect(executeCommandSpy.getCall(0).args[2]).contains(BUILDER_VIEW_TYPE); - }); - - it('sends telemetry and opens text editor when vscode is soql builder mode', async () => { - sb.stub(vscode.window, 'activeTextEditor').get(() => { - return undefined; - }); - await soqlBuilderToggle({} as vscode.Uri); - - // tslint:disable-next-line:no-unused-expression - expect(telemetryStub.called).is.true; - expect(executeCommandSpy.getCall(0).args[2]).contains(EDITOR_VIEW_TYPE); - }); -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/commands/soqlFileCreate.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/commands/soqlFileCreate.test.ts deleted file mode 100644 index 6965b17f2a..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/commands/soqlFileCreate.test.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { SinonSandbox, createSandbox, SinonSpy, SinonStub } from 'sinon'; -import * as vscode from 'vscode'; -import { soqlOpenNew } from '../../../src/commands/soqlFileCreate'; -import { BUILDER_VIEW_TYPE, EDITOR_VIEW_TYPE } from '../../../src/constants'; -import { telemetryService } from '../../../src/telemetry'; - -describe('soqlOpenNew should', () => { - let sb: SinonSandbox; - let telemetryStub: SinonStub; - let executeCommandSpy: SinonSpy; - - beforeEach(() => { - sb = createSandbox(); - telemetryStub = sb.stub(telemetryService, 'sendCommandEvent') as SinonStub; - executeCommandSpy = (sb.spy( - vscode.commands, - 'executeCommand' - ) as unknown) as SinonSpy; - }); - - afterEach(async () => { - sb.restore(); - }); - - it('sends telemetry and opens editor when invoked', async () => { - await soqlOpenNew(); - - expect(telemetryStub.called).is.true; - expect(executeCommandSpy.getCall(0).args[2]).contains(BUILDER_VIEW_TYPE); - expect(executeCommandSpy.getCall(0).args[1].scheme).contains('untitled'); - }); -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/commomUtils.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/commomUtils.test.ts deleted file mode 100644 index 446bb6b807..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/commomUtils.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - getDocumentName, - trackErrorWithTelemetry -} from '../../src/commonUtils'; -import { telemetryService } from '../../src/telemetry'; -import { MockTextDocumentProvider } from './testUtilities'; - -describe('Common SOQL Builder Utilities', () => { - let mockTextDocument: vscode.TextDocument; - let docProviderDisposable: vscode.Disposable; - let sandbox: sinon.SinonSandbox; - - beforeEach(async () => { - sandbox = sinon.createSandbox(); - docProviderDisposable = vscode.workspace.registerTextDocumentContentProvider( - 'sfdc-test', - new MockTextDocumentProvider() - ); - mockTextDocument = await vscode.workspace.openTextDocument( - vscode.Uri.parse('sfdc-test:test/examples/soql/mocksoql.soql') - ); - }); - - afterEach(() => { - docProviderDisposable.dispose(); - sandbox.restore(); - }); - - it('gets the document name form path', () => { - const documentName = getDocumentName(mockTextDocument); - expect(documentName).equals('mocksoql.soql'); - }); - - it('display and track error with correct telemetry namespace', async () => { - const telemetryServiceStub = sandbox - .stub(telemetryService, 'sendException') - .resolves(); - - const errorNamespace = 'test-me'; - const errorDetails = 'this is a test error'; - await trackErrorWithTelemetry(errorNamespace, errorDetails); - - expect(telemetryServiceStub.callCount).to.equal(1); - expect(telemetryServiceStub.getCall(0).args[0]).to.equal( - `soql_error_${errorNamespace}` - ); - expect(telemetryServiceStub.getCall(0).args[1]).to.equal(errorDetails); - }); -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/htmlUtils.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/htmlUtils.test.ts deleted file mode 100644 index 211c21c922..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/htmlUtils.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import * as vscode from 'vscode'; -import { SOQL_BUILDER_UI_PATH } from '../../../src/constants'; -import { HtmlUtils } from '../../../src/editor/htmlUtils'; - -describe('html utilities', () => { - let mockWebviewPanel: vscode.WebviewPanel; - const pathToLwcDist = SOQL_BUILDER_UI_PATH; - const html = ` - ' - - `; - - beforeEach(() => { - mockWebviewPanel = vscode.window.createWebviewPanel( - 'mockWebviewPanel', - 'Mock Webview Panel', - vscode.ViewColumn.One, - { enableScripts: true } - ); - }); - it('transforms script tags appropriately', () => { - const transformedHtml = HtmlUtils.transformHtml( - html, - pathToLwcDist, - mockWebviewPanel.webview - ); - const appUri = mockWebviewPanel.webview.asWebviewUri( - vscode.Uri.file(path.join(pathToLwcDist, 'app.js')) - ); - const appZeroUri = mockWebviewPanel.webview.asWebviewUri( - vscode.Uri.file(path.join(pathToLwcDist, '0.app.js')) - ); - expect(transformedHtml).to.contain(appUri); - expect(transformedHtml).to.contain(appZeroUri); - }); - it('transforms Content-Security-Policy appropriately', () => { - const transformedHtml = HtmlUtils.transformHtml( - html, - pathToLwcDist, - mockWebviewPanel.webview - ); - expect(transformedHtml).to.contain('meta'); - expect(transformedHtml).to.contain(mockWebviewPanel.webview.cspSource); - }); -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/queryRunner.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/queryRunner.test.ts deleted file mode 100644 index b4bba6e52a..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/queryRunner.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { Connection } from '@salesforce/core'; -import * as sinon from 'sinon'; -import { QueryRunner } from '../../../src/editor/queryRunner'; -import { getMockConnection, mockQueryText } from '../testUtilities'; - -describe('Query Runner Should', () => { - let mockConnection: Connection; - let sandbox: sinon.SinonSandbox; - - beforeEach(() => { - sandbox = sinon.createSandbox(); - mockConnection = getMockConnection(sandbox); - }); - - afterEach(() => { - sandbox.restore(); - }); - - it('returns query data without attribute properties', async () => { - // @ts-ignore - const queryRunner = new QueryRunner(mockConnection); - const queryData = await queryRunner.runQuery(mockQueryText); - queryData.records.forEach((result: {}) => { - expect(result).to.not.have.key('attributes'); - }); - }); - - it('throws error with conection.query() exception', async () => { - const errorName = 'Bad Query'; - sandbox.stub(mockConnection, 'query').throws(errorName); - // @ts-ignore - const queryRunner = new QueryRunner(mockConnection); - try { - await queryRunner.runQuery(mockQueryText); - } catch (error) { - expect(error.name).equal(errorName); - } - }); - - it('strip comments before passing query to connection', async () => { - const querySpy = sandbox.spy(mockConnection, 'query'); - const soqlNoComments = 'SELECT Id\nFROM Account\n'; - const soqlWithComments = - '// Comment line 1\n//Comment line2\n' + soqlNoComments; - - const queryRunner = new QueryRunner(mockConnection); - const queryData = await queryRunner.runQuery(soqlWithComments); - queryData.records.forEach((result: {}) => { - expect(result).to.not.have.key('attributes'); - }); - - expect(querySpy.calledOnce).to.be.true; - expect(querySpy.firstCall.args[0]).to.equal(soqlNoComments); - }); - -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/soqlEditorInstance.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/soqlEditorInstance.test.ts deleted file mode 100644 index 0e052a7fff..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/soqlEditorInstance.test.ts +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import * as commonUtils from '../../../src/commonUtils'; -import { MessageType } from '../../../src/editor/soqlEditorInstance'; -import { - mockSObject, - MockTextDocumentProvider, - TestSoqlEditorInstance -} from '../testUtilities'; - -describe('SoqlEditorInstance should', () => { - let mockWebviewPanel: vscode.WebviewPanel; - let docProviderDisposable: vscode.Disposable; - let mockTextDocument: vscode.TextDocument; - let instance: TestSoqlEditorInstance; - let sandbox: sinon.SinonSandbox; - - const createMessagingWebviewContent = () => { - return ` - - - - - Messaging Webview - - - - `; - }; - - const waitForAsync = async (msec: number) => { - return new Promise(resolve => setTimeout(resolve, msec)); - }; - - beforeEach(async () => { - sandbox = sinon.createSandbox(); - docProviderDisposable = vscode.workspace.registerTextDocumentContentProvider( - 'sfdc-test', - new MockTextDocumentProvider() - ); - mockTextDocument = await vscode.workspace.openTextDocument( - vscode.Uri.parse('sfdc-test:mocksoql.soql') - ); - mockWebviewPanel = vscode.window.createWebviewPanel( - 'mockWebviewPanel', - 'Mock Webview Panel', - vscode.ViewColumn.One, - { enableScripts: true } - ); - mockWebviewPanel.webview.html = createMessagingWebviewContent(); - instance = new TestSoqlEditorInstance( - mockTextDocument, - mockWebviewPanel, - new vscode.CancellationTokenSource().token - ); - }); - afterEach(() => { - mockWebviewPanel.dispose(); - docProviderDisposable.dispose(); - sandbox.restore(); - }); - - it('post CONNECTION_CHANGED message when connection is changed', async () => { - const expected = { type: 'connection_changed' }; - const postMessageSpy = sandbox.spy(mockWebviewPanel.webview, 'postMessage'); - - instance.onConnectionChanged(); - - expect(postMessageSpy.calledWith(expected)); - }); - - it('responds to sobjects_request with a list of sobjects', async () => { - const expectedMessage = { - type: 'sobjects_response', - payload: ['A', 'B'] - }; - const postMessageSpy = sandbox.spy(mockWebviewPanel.webview, 'postMessage'); - - instance.mockReceiveEvent({ type: 'sobjects_request' }); - // above function has nested async message passing; wait a bit - await waitForAsync(50); - - expect(postMessageSpy.calledWith(expectedMessage)); - }); - - it('responds to sobject_metadata_request with SObject metadata', async () => { - const expectedMessage = { - type: 'sobject_metadata_response', - payload: mockSObject - }; - const postMessageSpy = sandbox.spy(mockWebviewPanel.webview, 'postMessage'); - - instance.mockReceiveEvent({ - type: 'sobject_metadata_request', - payload: 'A' - }); - // above function has nested async message passing; wait a bit - await waitForAsync(50); - - expect(postMessageSpy.calledWith(expectedMessage)); - }); - - it('handles query event and updates text document with soql', async () => { - const aQuery = 'select a,b,c from somewhere'; - const updateDocumentSpy = sandbox.spy(instance, 'updateTextDocument'); - instance.mockReceiveEvent({ - type: MessageType.UI_SOQL_CHANGED, - payload: aQuery - }); - expect( - updateDocumentSpy.callCount === 1, - `updateDocumentSpy callcount expected 1, but got ${updateDocumentSpy.callCount}` - ); - expect(updateDocumentSpy.getCall(0).args[1]).to.equal(aQuery); - }); - - it('muffles the postMessage once if soql statement has NOT changed', async () => { - const postMessageSpy = sandbox.spy(mockWebviewPanel.webview, 'postMessage'); - const aQuery = 'select a,b,c from somewhere'; - instance.mockReceiveEvent({ - type: MessageType.UI_SOQL_CHANGED, - payload: aQuery - }); - // attempt to update webview with unchanged soql statement - instance.updateWebview(mockTextDocument); - expect( - postMessageSpy.callCount === 0, - `postMessageSpy callcount expected 0, but got ${postMessageSpy.callCount}` - ); - // a second update with the same statement will send - instance.updateWebview(mockTextDocument); - expect( - postMessageSpy.callCount === 1, - `postMessageSpy callcount expected 1, but got ${postMessageSpy.callCount}` - ); - }); - - it('does emit if soql statement has changed', async () => { - const postMessageSpy = sandbox.spy(mockWebviewPanel.webview, 'postMessage'); - const aQuery = 'select a,b,c from somewhere'; - instance.mockReceiveEvent({ - type: MessageType.UI_SOQL_CHANGED, - payload: aQuery - }); - instance.updateTextDocument(mockTextDocument, 'select d from somewhere'); - instance.updateWebview(mockTextDocument); - expect( - postMessageSpy.callCount === 1, - `postMessageSpy callcount expected 1, but got ${postMessageSpy.callCount}` - ); - }); - - it('handles activation event and updates the webview', async () => { - const updateWebviewSpy = sandbox.spy(instance, 'updateWebview'); - instance.mockReceiveEvent({ - type: MessageType.UI_ACTIVATED - }); - expect( - updateWebviewSpy.callCount === 1, - `updateWebviewSpy callcount expected 1, but got ${updateWebviewSpy.callCount}` - ); - }); - - it('handles run query event and opens the webview and sends run_query_done to webview', async () => { - const expectedMessage = { - type: 'run_query_done' - }; - const postMessageSpy = sandbox.spy(mockWebviewPanel.webview, 'postMessage'); - - const openQueryResultsSpy = sandbox.spy(instance, 'openQueryDataView'); - instance.mockReceiveEvent({ - type: MessageType.RUN_SOQL_QUERY - }); - - expect( - openQueryResultsSpy.callCount === 1, - `openQueryResultsSpy callcount expected 1, but got ${openQueryResultsSpy.callCount}` - ); - expect(postMessageSpy.calledWith(expectedMessage)); - }); - - it('display and track error when webview.postMessage throws', async () => { - sandbox.stub(mockWebviewPanel.webview, 'postMessage').rejects(); - const trackErrorSpy = sandbox.spy(commonUtils, 'trackErrorWithTelemetry'); - - instance.sendMessageToUi('message-type', 'message-body'); - - return Promise.resolve().then(() => { - expect(trackErrorSpy.callCount).to.equal(1); - }); - }); - - it('handles telemetry events and tracks when there is unsupported syntax', async () => { - const trackErrorSpy = sandbox.spy(commonUtils, 'trackErrorWithTelemetry'); - instance.mockReceiveEvent({ - type: MessageType.UI_TELEMETRY, - payload: { unsupported: 1 } - }); - return Promise.resolve().then(() => { - expect(trackErrorSpy.callCount).to.equal(1); - expect(trackErrorSpy.getCall(0).args[0]).to.equal('syntax_unsupported'); - }); - }); - - it('handles telemetry errors and unsupported properties as numbers AND arrays', async () => { - const trackErrorSpy = sandbox.spy(commonUtils, 'trackErrorWithTelemetry'); - const telemetryEvent = { - type: MessageType.UI_TELEMETRY, - payload: { unsupported: ['WHERE 1 = 1'] } - }; - instance.mockReceiveEvent(telemetryEvent); - return Promise.resolve().then(() => { - expect(trackErrorSpy.callCount).to.equal(1); - expect(trackErrorSpy.getCall(0).args[0]).to.equal('syntax_unsupported'); - expect(trackErrorSpy.getCall(0).args[1]).contains( - telemetryEvent.payload.unsupported[0] - ); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/soqlEditorProvider.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/soqlEditorProvider.test.ts deleted file mode 100644 index 785dce951b..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/editor/soqlEditorProvider.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - * - */ diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/index.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/index.ts deleted file mode 100644 index 9db5a639ea..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -// eslint:disable-next-line: no-var-requires -const testRunner = require('@salesforce/salesforcedx-test-utils-vscode/out/src/testrunner'); -import { join, normalize } from 'path'; -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure( - { - ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results - timeout: 360000, - retries: 2, - fullTrace: true, - slow: 0 - }, - normalize(join(__dirname, '..', '..', '..')) -); - -module.exports = testRunner; diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/dataProviders/csvDataProvider.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/dataProviders/csvDataProvider.test.ts deleted file mode 100644 index 5299f87f06..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/dataProviders/csvDataProvider.test.ts +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { JsonMap } from '@salesforce/ts-types'; -import { expect } from 'chai'; -import { CsvDataProvider } from '../../../../src/queryDataView/dataProviders/csvDataProvider'; - -interface TestQuery { - queryText: string; - queryResults: JsonMap[]; - csvOutput: string[]; -} - -const attributes = { - type: 'type', - url: 'url' -}; - -const simpleQuery: TestQuery = { - queryText: 'SELECT A, B FROM C', - queryResults: [ - { - attributes, - A: 'a', - B: 'b' - }, - { - attributes, - A: 'c', - B: 'd' - } - ], - csvOutput: [ - 'A,B', - 'a,b', - 'c,d' - ] -}; -const childToParentRel: TestQuery = { - queryText: 'SELECT A, B.X FROM C', - queryResults: [ - { - attributes, - A: 'a', - B: { - attributes, - X: 'b' - } - }, - { - attributes, - A: 'c', - B: { - attributes, - X: 'd' - } - } - ], - csvOutput: [ - 'A,B.X', - 'a,b', - 'c,d' - ] -}; -const parentToChildRel: TestQuery = { - queryText: 'SELECT A, (SELECT X FROM B) FROM C', - queryResults: [ - { - attributes, - A: 'a', - B: null - }, - { - attributes, - A: 'c', - B: { - attributes, - records: [ - { - attributes, - X: 'b' - }, - { - attributes, - X: 'd' - } - ] - } - } - ], - csvOutput: [ - 'A,B.X', - 'a,', - 'c,b', - 'c,d' - ] -}; -const aggFn: TestQuery = { - queryText: 'SELECT A, MIN(B) FROM C GROUP BY A', - queryResults: [ - { - attributes, - A: 'a', - expr0: 5 - }, - { - attributes, - A: 'c', - expr0: 10 - } - ], - csvOutput: [ - 'A,MIN(B)', - 'a,5', - 'c,10' - ] -}; -const alias: TestQuery = { - queryText: 'SELECT A, MIN(B) min FROM C GROUP BY A', - queryResults: [ - { - attributes, - A: 'a', - min: 5 - }, - { - attributes, - A: 'c', - min: 10 - } - ], - csvOutput: [ - 'A,min', - 'a,5', - 'c,10' - ] -}; - -describe('CsvDataProvider', () => { - it('should output appropriate CSV for simple selections in a query', () => { - testQuery(simpleQuery); - }); - it('should output appropriate CSV for child to parent relationship queries', () => { - testQuery(childToParentRel); - }); - it('should output appropriate CSV for parent to child relationship queries', () => { - testQuery(parentToChildRel); - }); - it('should output appropriate CSV for queries with aggregate functions selected', () => { - testQuery(aggFn); - }); - it('should output appropriate CSV for queries with aliased aggregate functions selected', () => { - testQuery(alias); - }); -}); - -function testQuery(q: TestQuery): void { - const provider = new CsvDataProvider('x.soql'); - expect(provider.getFileContent(q.queryText, q.queryResults).split('\n').map(s => s.trim())).deep.eq(q.csvOutput); -} diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/queryDataFileService.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/queryDataFileService.test.ts deleted file mode 100644 index b966de7088..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/queryDataFileService.test.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as fs from 'fs'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { - CsvDataProvider, - JsonDataProvider -} from '../../../src/queryDataView/dataProviders'; -import { FileFormat } from '../../../src/queryDataView/queryDataFileService'; -import { - mockQueryText, - mockQueryData, - MockTextDocumentProvider, - TestFileService -} from '../testUtilities'; - -export const QUERY_RESULTS_DIR_PATH = path.join( - 'scripts', - 'soql', - 'query-results' -); - -describe('Query Data File Service', () => { - let mockTextDocument: vscode.TextDocument; - let docProviderDisposable: vscode.Disposable; - const documentName = 'example.soql'; - const workspacePath = vscode.workspace.workspaceFolders![0].uri.fsPath; - const testResultsDirPath = path.join(workspacePath, QUERY_RESULTS_DIR_PATH); - const mockUriPath = path.join(testResultsDirPath, documentName); - let sandbox: sinon.SinonSandbox; - - function createResultsDirectory() { - fs.mkdirSync(testResultsDirPath, { - recursive: true - }); - } - - beforeEach(async () => { - sandbox = sinon.createSandbox(); - docProviderDisposable = vscode.workspace.registerTextDocumentContentProvider( - 'sfdc-test', - new MockTextDocumentProvider() - ); - mockTextDocument = await vscode.workspace.openTextDocument( - vscode.Uri.parse('sfdc-test:test/examples/soql/mocksoql.soql') - ); - createResultsDirectory(); - }); - - afterEach(() => { - // delete the query-results directory and its files. - // @ts-ignore - fs.rmSync(testResultsDirPath, { recursive: true }); - sandbox.restore(); - }); - - it('should use the correct data provider', () => { - const csvFileService = new TestFileService( - mockQueryText, - mockQueryData, - FileFormat.CSV, - mockTextDocument - ); - expect(csvFileService.getDataProvider()).instanceOf(CsvDataProvider); - - const jsonFileService = new TestFileService( - mockQueryText, - mockQueryData, - FileFormat.JSON, - mockTextDocument - ); - expect(jsonFileService.getDataProvider()).instanceOf(JsonDataProvider); - }); -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/queryDataViewService.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/queryDataViewService.test.ts deleted file mode 100644 index 97d2739253..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/queryDataView/queryDataViewService.test.ts +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { JsonMap } from '@salesforce/ts-types'; -import { expect } from 'chai'; -import { QueryResult } from 'jsforce'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import { getDocumentName } from '../../../src/commonUtils'; -import * as commonUtils from '../../../src/commonUtils'; -import { - FileFormat, - QueryDataFileService -} from '../../../src/queryDataView/queryDataFileService'; -import { QueryDataViewService } from '../../../src/queryDataView/queryDataViewService'; -import { - mockColumnData, - mockQueryData, - MockTextDocumentProvider, - TestQueryDataViewService -} from '../testUtilities'; - -describe('Query Data View Service', () => { - let mockTextDocument: vscode.TextDocument; - let docProviderDisposable: vscode.Disposable; - let mockSubscription: vscode.Disposable[]; - let mockWebviewPanel: vscode.WebviewPanel; - let sandbox: sinon.SinonSandbox; - let queryRecords: QueryResult; - - beforeEach(async () => { - sandbox = sinon.createSandbox(); - docProviderDisposable = vscode.workspace.registerTextDocumentContentProvider( - 'sfdc-test', - new MockTextDocumentProvider() - ); - mockTextDocument = await vscode.workspace.openTextDocument( - vscode.Uri.parse('sfdc-test:test/examples/soql/mocksoql.soql') - ); - mockSubscription = [{} as vscode.Disposable]; - mockWebviewPanel = vscode.window.createWebviewPanel( - 'mockWebviewPanel', - 'Mock Webview Panel', - vscode.ViewColumn.One, - { enableScripts: true } - ); - queryRecords = mockQueryData; - }); - - afterEach(() => { - docProviderDisposable.dispose(); - sandbox.restore(); - }); - - it('should post message to webview with query data on activation event ', () => { - const dataViewService = new TestQueryDataViewService( - mockSubscription, - queryRecords, - mockTextDocument - ); - const postMessageSpy = sandbox.spy(mockWebviewPanel.webview, 'postMessage'); - - QueryDataViewService.extensionPath = ''; - sandbox.stub(vscode.window, 'createWebviewPanel').returns(mockWebviewPanel); - dataViewService.createOrShowWebView(); - dataViewService.mockReceiveEvent({ type: 'activate' }); - - expect(postMessageSpy.callCount).equal(1); - - const postMessageArgs = postMessageSpy.args[0][0]; - expect(postMessageArgs.data).to.eql({ columnData: mockColumnData, ...mockQueryData }); - expect(postMessageArgs.documentName).equal( - getDocumentName(mockTextDocument) - ); - expect(postMessageArgs.type).equal('update'); - }); - - it('should save with save_records event', () => { - const dataViewService = new TestQueryDataViewService( - mockSubscription, - queryRecords, - mockTextDocument - ); - const saveRecordsSpy = sandbox.spy(dataViewService, 'handleSaveRecords'); - const fileServiceStub = sandbox.stub( - QueryDataFileService.prototype, - 'save' - ); - QueryDataViewService.extensionPath = ''; - sandbox.stub(vscode.window, 'createWebviewPanel').returns(mockWebviewPanel); - dataViewService.createOrShowWebView(); - dataViewService.mockReceiveEvent({ - type: 'save_records', - format: FileFormat.CSV - }); - - expect(saveRecordsSpy.callCount).equal(1); - const postMessageArgs = saveRecordsSpy.args[0][0]; - expect(postMessageArgs).to.eql(FileFormat.CSV); - expect(fileServiceStub.callCount).equal(1); - }); - - it('should track error via telemetry if event type is not handled', () => { - const trackSpy = sandbox.spy(commonUtils, 'trackErrorWithTelemetry'); - const dataViewService = new TestQueryDataViewService( - mockSubscription, - queryRecords, - mockTextDocument - ); - dataViewService.createOrShowWebView(); - dataViewService.mockReceiveEvent({ - type: 'unsupported', - format: FileFormat.CSV - }); - expect(trackSpy.callCount).to.equal(1); - }); - - it('should display error when save fails', () => { - const trackSpy = sandbox.spy(commonUtils, 'trackErrorWithTelemetry'); - const dataViewService = new TestQueryDataViewService( - mockSubscription, - queryRecords, - mockTextDocument - ); - const fileServiceStub = sandbox - .stub(QueryDataFileService.prototype, 'save') - .throws(); - QueryDataViewService.extensionPath = ''; - sandbox.stub(vscode.window, 'createWebviewPanel').returns(mockWebviewPanel); - dataViewService.createOrShowWebView(); - dataViewService.mockReceiveEvent({ - type: 'save_records', - format: FileFormat.CSV - }); - expect(fileServiceStub.callCount).equal(1); - expect(trackSpy.callCount).to.equal(1); - }); -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/sf.test.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/sf.test.ts deleted file mode 100644 index 9464a50342..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/sf.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2023, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import * as vscode from 'vscode'; -import * as sf from '../../src/sf'; - -describe('sf utils', () => { - let sandbox: sinon.SinonSandbox; - - beforeEach(() => { - sandbox = sinon.createSandbox(); - }); - - afterEach(() => { - sandbox.restore(); - }); - - describe('withSFConnection', () => { - function run(showErrorMessage: boolean) { - it(`should ${ - showErrorMessage ? '' : 'not ' - }display an error, channel log, and send telemetry if can not get connection to org when showErrorMessage=${showErrorMessage}`, async () => { - sandbox.stub(sf.workspaceContext, 'getConnection').throws(); - const vscodeErrorMessageSpy = sandbox.spy( - vscode.window, - 'showErrorMessage' - ); - const channelServiceSpy = sandbox.spy(sf.channelService, 'appendLine'); - await sf.withSFConnection(async () => {}, showErrorMessage); - sf.debouncedShowChannelAndErrorMessage.flush(); - const errorCount = showErrorMessage ? 1 : 0; - expect(vscodeErrorMessageSpy.callCount).to.equal(errorCount); - expect(channelServiceSpy.callCount).to.equal(errorCount); - }); - } - - run(true); - run(false); - }); -}); diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Account.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Account.json deleted file mode 100644 index 090921bf31..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Account.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Account ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Master Record ID","name":"MasterRecordId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"MasterRecord","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Account Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Account Type","name":"Type","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Analyst","validFor":null,"value":"Analyst"},{"active":true,"defaultValue":false,"label":"Competitor","validFor":null,"value":"Competitor"},{"active":true,"defaultValue":false,"label":"Customer","validFor":null,"value":"Customer"},{"active":true,"defaultValue":false,"label":"Integrator","validFor":null,"value":"Integrator"},{"active":true,"defaultValue":false,"label":"Investor","validFor":null,"value":"Investor"},{"active":true,"defaultValue":false,"label":"Partner","validFor":null,"value":"Partner"},{"active":true,"defaultValue":false,"label":"Press","validFor":null,"value":"Press"},{"active":true,"defaultValue":false,"label":"Prospect","validFor":null,"value":"Prospect"},{"active":true,"defaultValue":false,"label":"Reseller","validFor":null,"value":"Reseller"},{"active":true,"defaultValue":false,"label":"Other","validFor":null,"value":"Other"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Parent Account ID","name":"ParentId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Parent","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Billing Street","name":"BillingStreet","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Billing City","name":"BillingCity","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing State/Province","name":"BillingState","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing Zip/Postal Code","name":"BillingPostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing Country","name":"BillingCountry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing Latitude","name":"BillingLatitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Billing Longitude","name":"BillingLongitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Billing Geocode Accuracy","name":"BillingGeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Billing Address","name":"BillingAddress","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Shipping Street","name":"ShippingStreet","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Shipping City","name":"ShippingCity","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping State/Province","name":"ShippingState","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping Zip/Postal Code","name":"ShippingPostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping Country","name":"ShippingCountry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping Latitude","name":"ShippingLatitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Shipping Longitude","name":"ShippingLongitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Shipping Geocode Accuracy","name":"ShippingGeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Shipping Address","name":"ShippingAddress","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Account Phone","name":"Phone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Account Fax","name":"Fax","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Website","name":"Website","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Photo URL","name":"PhotoUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Industry","name":"Industry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Agriculture","validFor":null,"value":"Agriculture"},{"active":true,"defaultValue":false,"label":"Apparel","validFor":null,"value":"Apparel"},{"active":true,"defaultValue":false,"label":"Banking","validFor":null,"value":"Banking"},{"active":true,"defaultValue":false,"label":"Biotechnology","validFor":null,"value":"Biotechnology"},{"active":true,"defaultValue":false,"label":"Chemicals","validFor":null,"value":"Chemicals"},{"active":true,"defaultValue":false,"label":"Communications","validFor":null,"value":"Communications"},{"active":true,"defaultValue":false,"label":"Construction","validFor":null,"value":"Construction"},{"active":true,"defaultValue":false,"label":"Consulting","validFor":null,"value":"Consulting"},{"active":true,"defaultValue":false,"label":"Education","validFor":null,"value":"Education"},{"active":true,"defaultValue":false,"label":"Electronics","validFor":null,"value":"Electronics"},{"active":true,"defaultValue":false,"label":"Energy","validFor":null,"value":"Energy"},{"active":true,"defaultValue":false,"label":"Engineering","validFor":null,"value":"Engineering"},{"active":true,"defaultValue":false,"label":"Entertainment","validFor":null,"value":"Entertainment"},{"active":true,"defaultValue":false,"label":"Environmental","validFor":null,"value":"Environmental"},{"active":true,"defaultValue":false,"label":"Finance","validFor":null,"value":"Finance"},{"active":true,"defaultValue":false,"label":"Food & Beverage","validFor":null,"value":"Food & Beverage"},{"active":true,"defaultValue":false,"label":"Government","validFor":null,"value":"Government"},{"active":true,"defaultValue":false,"label":"Healthcare","validFor":null,"value":"Healthcare"},{"active":true,"defaultValue":false,"label":"Hospitality","validFor":null,"value":"Hospitality"},{"active":true,"defaultValue":false,"label":"Insurance","validFor":null,"value":"Insurance"},{"active":true,"defaultValue":false,"label":"Machinery","validFor":null,"value":"Machinery"},{"active":true,"defaultValue":false,"label":"Manufacturing","validFor":null,"value":"Manufacturing"},{"active":true,"defaultValue":false,"label":"Media","validFor":null,"value":"Media"},{"active":true,"defaultValue":false,"label":"Not For Profit","validFor":null,"value":"Not For Profit"},{"active":true,"defaultValue":false,"label":"Other","validFor":null,"value":"Other"},{"active":true,"defaultValue":false,"label":"Recreation","validFor":null,"value":"Recreation"},{"active":true,"defaultValue":false,"label":"Retail","validFor":null,"value":"Retail"},{"active":true,"defaultValue":false,"label":"Shipping","validFor":null,"value":"Shipping"},{"active":true,"defaultValue":false,"label":"Technology","validFor":null,"value":"Technology"},{"active":true,"defaultValue":false,"label":"Telecommunications","validFor":null,"value":"Telecommunications"},{"active":true,"defaultValue":false,"label":"Transportation","validFor":null,"value":"Transportation"},{"active":true,"defaultValue":false,"label":"Utilities","validFor":null,"value":"Utilities"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Annual Revenue","name":"AnnualRevenue","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"currency"},{"label":"Employees","name":"NumberOfEmployees","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Account Description","name":"Description","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"textarea"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Activity","name":"LastActivityDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Data.com Key","name":"Jigsaw","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Jigsaw Company ID","name":"JigsawCompanyId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"JigsawCompany","referenceTo":[],"sortable":true,"type":"string"},{"label":"Account Source","name":"AccountSource","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Advertisement","validFor":null,"value":"Advertisement"},{"active":true,"defaultValue":false,"label":"Employee Referral","validFor":null,"value":"Employee Referral"},{"active":true,"defaultValue":false,"label":"External Referral","validFor":null,"value":"External Referral"},{"active":true,"defaultValue":false,"label":"Partner","validFor":null,"value":"Partner"},{"active":true,"defaultValue":false,"label":"Public Relations","validFor":null,"value":"Public Relations"},{"active":true,"defaultValue":false,"label":"Seminar - Internal","validFor":null,"value":"Seminar - Internal"},{"active":true,"defaultValue":false,"label":"Seminar - Partner","validFor":null,"value":"Seminar - Partner"},{"active":true,"defaultValue":false,"label":"Trade Show","validFor":null,"value":"Trade Show"},{"active":true,"defaultValue":false,"label":"Web","validFor":null,"value":"Web"},{"active":true,"defaultValue":false,"label":"Word of mouth","validFor":null,"value":"Word of mouth"},{"active":true,"defaultValue":false,"label":"Other","validFor":null,"value":"Other"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"SIC Description","name":"SicDesc","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"}],"childRelationships":[{"cascadeDelete":false,"childSObject":"Account","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ChildAccounts","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AccountContactRole","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AccountContactRoles","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AccountFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AccountHistory","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AccountPartner","deprecatedAndHidden":false,"field":"AccountFromId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AccountPartnersFrom","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AccountPartner","deprecatedAndHidden":false,"field":"AccountToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AccountPartnersTo","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AccountShare","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Shares","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ActivityHistory","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ActivityHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Asset","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Assets","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Asset","deprecatedAndHidden":false,"field":"AssetProvidedById","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProvidedAssets","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Asset","deprecatedAndHidden":false,"field":"AssetServicedById","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ServicedAssets","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AssociatedLocation","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AssociatedLocations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"AuthorizationFormConsent","deprecatedAndHidden":false,"field":"ConsentGiverId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AuthorizationFormConsents","restrictedDelete":true},{"cascadeDelete":false,"childSObject":"AuthorizationFormConsent","deprecatedAndHidden":false,"field":"RelatedRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RelatedAuthorizationFormConsents","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Case","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Cases","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"CollaborationGroupRecord","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordAssociatedGroups","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"CommSubscriptionConsent","deprecatedAndHidden":false,"field":"ConsentGiverId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CommSubscriptionConsents","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"Contact","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Contacts","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContactPointAddress","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContactPointAddresses","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContactPointEmail","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContactPointEmails","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContactPointPhone","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContactPointPhones","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ContactRequest","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContactRequests","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Contract","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Contracts","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"DuplicateRecordItem","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"DuplicateRecordItems","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"EmailMessage","deprecatedAndHidden":false,"field":"RelatedToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Emails","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Event","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Events","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Note","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Notes","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"NoteAndAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"NotesAndAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpenActivity","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpenActivities","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Opportunity","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Opportunities","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityPartner","deprecatedAndHidden":false,"field":"AccountToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpportunityPartnersTo","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Order","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Orders","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"Partner","deprecatedAndHidden":false,"field":"AccountFromId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"PartnersFrom","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Partner","deprecatedAndHidden":false,"field":"AccountToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"PartnersTo","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProcessInstance","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessInstances","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessInstanceHistory","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessSteps","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"SocialPersona","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Personas","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"SocialPost","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Posts","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Task","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Tasks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TopicAssignment","deprecatedAndHidden":false,"field":"EntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TopicAssignments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"User","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Users","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"WorkOrder","deprecatedAndHidden":false,"field":"AccountId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"WorkOrders","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"sfLma__License__c","deprecatedAndHidden":false,"field":"sfLma__Account__c","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"sfLma__R00N30000001JvRMEA0__r","restrictedDelete":false}],"label":"Account","custom":false,"name":"Account","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Attachment.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Attachment.json deleted file mode 100644 index fcbb723d49..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Attachment.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Attachment ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Parent ID","name":"ParentId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Parent","referenceTo":["Account","Asset","Case","CommSubscription","CommSubscriptionChannelType","CommSubscriptionConsent","CommSubscriptionTiming","Contact","Contract","EmailMessage","EmailTemplate","EngagementChannelType","Event","Image","Lead","Location","Opportunity","Order","Product2","SocialPost","Solution","Task","WorkOrder","WorkOrderLineItem","sfFma__FeatureParameterBoolean__c","sfFma__FeatureParameterDate__c","sfFma__FeatureParameterInteger__c","sfFma__FeatureParameter__c","sfLma__License__c","sfLma__Package_Version__c","sfLma__Package__c"],"sortable":true,"type":"reference"},{"label":"File Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Private","name":"IsPrivate","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Content Type","name":"ContentType","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Body Length","name":"BodyLength","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Body","name":"Body","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"base64"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["Calendar","User"],"sortable":true,"type":"reference"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Description","name":"Description","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"}],"childRelationships":[],"label":"Attachment","custom":false,"name":"Attachment","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Case.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Case.json deleted file mode 100644 index 905f71b58c..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Case.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Case ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Master Record ID","name":"MasterRecordId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"MasterRecord","referenceTo":["Case"],"sortable":true,"type":"reference"},{"label":"Case Number","name":"CaseNumber","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Contact ID","name":"ContactId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Contact","referenceTo":["Contact"],"sortable":true,"type":"reference"},{"label":"Account ID","name":"AccountId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Account","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Parent Case ID","name":"ParentId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Parent","referenceTo":["Case"],"sortable":true,"type":"reference"},{"label":"Name","name":"SuppliedName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Email Address","name":"SuppliedEmail","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"email"},{"label":"Phone","name":"SuppliedPhone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Company","name":"SuppliedCompany","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Case Type","name":"Type","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Problem","validFor":null,"value":"Problem"},{"active":true,"defaultValue":false,"label":"Feature Request","validFor":null,"value":"Feature Request"},{"active":true,"defaultValue":false,"label":"Question","validFor":null,"value":"Question"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Status","name":"Status","aggregatable":true,"defaultValue":"New","filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"On Hold","validFor":null,"value":"On Hold"},{"active":true,"defaultValue":false,"label":"Escalated","validFor":null,"value":"Escalated"},{"active":true,"defaultValue":false,"label":"Closed","validFor":null,"value":"Closed"},{"active":true,"defaultValue":true,"label":"New","validFor":null,"value":"New"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Case Reason","name":"Reason","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"User didn't attend training","validFor":null,"value":"User didn't attend training"},{"active":true,"defaultValue":false,"label":"Complex functionality","validFor":null,"value":"Complex functionality"},{"active":true,"defaultValue":false,"label":"Existing problem","validFor":null,"value":"Existing problem"},{"active":true,"defaultValue":false,"label":"Instructions not clear","validFor":null,"value":"Instructions not clear"},{"active":true,"defaultValue":false,"label":"New problem","validFor":null,"value":"New problem"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Case Origin","name":"Origin","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Email","validFor":null,"value":"Email"},{"active":true,"defaultValue":false,"label":"Phone","validFor":null,"value":"Phone"},{"active":true,"defaultValue":false,"label":"Web","validFor":null,"value":"Web"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Subject","name":"Subject","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Priority","name":"Priority","aggregatable":true,"defaultValue":"Medium","filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"High","validFor":null,"value":"High"},{"active":true,"defaultValue":true,"label":"Medium","validFor":null,"value":"Medium"},{"active":true,"defaultValue":false,"label":"Low","validFor":null,"value":"Low"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Description","name":"Description","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"textarea"},{"label":"Closed","name":"IsClosed","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Closed Date","name":"ClosedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Escalated","name":"IsEscalated","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["Group","User"],"sortable":true,"type":"reference"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Contact Phone","name":"ContactPhone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Contact Mobile","name":"ContactMobile","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Contact Email","name":"ContactEmail","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"email"},{"label":"Contact Fax","name":"ContactFax","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Internal Comments","name":"Comments","aggregatable":true,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"}],"childRelationships":[{"cascadeDelete":true,"childSObject":"ActivityHistory","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ActivityHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Case","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Cases","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CaseComment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CaseComments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CaseContactRole","deprecatedAndHidden":false,"field":"CasesId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CaseContactRoles","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CaseFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CaseHistory","deprecatedAndHidden":false,"field":"CaseId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CaseShare","deprecatedAndHidden":false,"field":"CaseId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Shares","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CaseSolution","deprecatedAndHidden":false,"field":"CaseId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CaseSolutions","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CaseTeamMember","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TeamMembers","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CaseTeamTemplateRecord","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TeamTemplateRecords","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CollaborationGroupRecord","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordAssociatedGroups","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ContactRequest","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContactRequests","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EmailMessage","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"EmailMessages","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"EmailMessage","deprecatedAndHidden":false,"field":"RelatedToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Emails","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Event","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Events","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpenActivity","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpenActivities","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessException","deprecatedAndHidden":false,"field":"CaseId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessExceptions","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProcessInstance","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessInstances","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessInstanceHistory","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessSteps","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"SocialPost","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Posts","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Task","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Tasks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TopicAssignment","deprecatedAndHidden":false,"field":"EntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TopicAssignments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"WorkOrder","deprecatedAndHidden":false,"field":"CaseId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"WorkOrders","restrictedDelete":false}],"label":"Case","custom":false,"name":"Case","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Contact.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Contact.json deleted file mode 100644 index 34a0d6e87f..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Contact.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Contact ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Master Record ID","name":"MasterRecordId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"MasterRecord","referenceTo":["Contact"],"sortable":true,"type":"reference"},{"label":"Account ID","name":"AccountId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Account","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Last Name","name":"LastName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"First Name","name":"FirstName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Salutation","name":"Salutation","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Mr.","validFor":null,"value":"Mr."},{"active":true,"defaultValue":false,"label":"Ms.","validFor":null,"value":"Ms."},{"active":true,"defaultValue":false,"label":"Mrs.","validFor":null,"value":"Mrs."},{"active":true,"defaultValue":false,"label":"Dr.","validFor":null,"value":"Dr."},{"active":true,"defaultValue":false,"label":"Prof.","validFor":null,"value":"Prof."}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Full Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Other Street","name":"OtherStreet","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Other City","name":"OtherCity","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Other State/Province","name":"OtherState","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Other Zip/Postal Code","name":"OtherPostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Other Country","name":"OtherCountry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Other Latitude","name":"OtherLatitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Other Longitude","name":"OtherLongitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Other Geocode Accuracy","name":"OtherGeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Other Address","name":"OtherAddress","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Mailing Street","name":"MailingStreet","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Mailing City","name":"MailingCity","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Mailing State/Province","name":"MailingState","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Mailing Zip/Postal Code","name":"MailingPostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Mailing Country","name":"MailingCountry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Mailing Latitude","name":"MailingLatitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Mailing Longitude","name":"MailingLongitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Mailing Geocode Accuracy","name":"MailingGeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Mailing Address","name":"MailingAddress","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Business Phone","name":"Phone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Business Fax","name":"Fax","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Mobile Phone","name":"MobilePhone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Home Phone","name":"HomePhone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Other Phone","name":"OtherPhone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Asst. Phone","name":"AssistantPhone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Reports To ID","name":"ReportsToId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"ReportsTo","referenceTo":["Contact"],"sortable":true,"type":"reference"},{"label":"Email","name":"Email","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"email"},{"label":"Title","name":"Title","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Department","name":"Department","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Assistant's Name","name":"AssistantName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Lead Source","name":"LeadSource","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Advertisement","validFor":null,"value":"Advertisement"},{"active":true,"defaultValue":false,"label":"Employee Referral","validFor":null,"value":"Employee Referral"},{"active":true,"defaultValue":false,"label":"External Referral","validFor":null,"value":"External Referral"},{"active":true,"defaultValue":false,"label":"Partner","validFor":null,"value":"Partner"},{"active":true,"defaultValue":false,"label":"Public Relations","validFor":null,"value":"Public Relations"},{"active":true,"defaultValue":false,"label":"Seminar - Internal","validFor":null,"value":"Seminar - Internal"},{"active":true,"defaultValue":false,"label":"Seminar - Partner","validFor":null,"value":"Seminar - Partner"},{"active":true,"defaultValue":false,"label":"Trade Show","validFor":null,"value":"Trade Show"},{"active":true,"defaultValue":false,"label":"Web","validFor":null,"value":"Web"},{"active":true,"defaultValue":false,"label":"Word of mouth","validFor":null,"value":"Word of mouth"},{"active":true,"defaultValue":false,"label":"Other","validFor":null,"value":"Other"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Birthdate","name":"Birthdate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Contact Description","name":"Description","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"textarea"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Activity","name":"LastActivityDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Last Stay-in-Touch Request Date","name":"LastCURequestDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Stay-in-Touch Save Date","name":"LastCUUpdateDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Email Bounced Reason","name":"EmailBouncedReason","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Email Bounced Date","name":"EmailBouncedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Is Email Bounced","name":"IsEmailBounced","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Photo URL","name":"PhotoUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Data.com Key","name":"Jigsaw","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Jigsaw Contact ID","name":"JigsawContactId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"JigsawContact","referenceTo":[],"sortable":true,"type":"string"},{"label":"Individual ID","name":"IndividualId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Individual","referenceTo":["Individual"],"sortable":true,"type":"reference"}],"childRelationships":[{"cascadeDelete":false,"childSObject":"AcceptedEventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AcceptedEventRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AccountContactRole","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AccountContactRoles","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ActivityHistory","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ActivityHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Asset","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Assets","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"AuthorizationFormConsent","deprecatedAndHidden":false,"field":"ConsentGiverId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AuthorizationFormConsents","restrictedDelete":true},{"cascadeDelete":false,"childSObject":"Case","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Cases","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"CaseContactRole","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CaseContactRoles","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CollaborationGroupRecord","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordAssociatedGroups","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"CommSubscriptionConsent","deprecatedAndHidden":false,"field":"ConsentGiverId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CommSubscriptionConsents","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"ContactFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContactHistory","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ContactRequest","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContactRequests","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContactShare","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Shares","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Contract","deprecatedAndHidden":false,"field":"CustomerSignedId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContractsSigned","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"ContractContactRole","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContractContactRoles","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"DeclinedEventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"DeclinedEventRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"DuplicateRecordItem","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"DuplicateRecordItems","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EmailMessageRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"EmailMessageRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EmailStatus","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"EmailStatuses","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Event","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Events","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"EventRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ListEmailIndividualRecipient","deprecatedAndHidden":false,"field":"RecipientId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ListEmailIndividualRecipients","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Note","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Notes","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"NoteAndAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"NotesAndAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpenActivity","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpenActivities","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Opportunity","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Opportunities","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityContactRole","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpportunityContactRoles","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"OutgoingEmailRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OutgoingEmailRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProcessInstance","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessInstances","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessInstanceHistory","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessSteps","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"SocialPersona","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Personas","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"SocialPost","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Posts","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Task","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Tasks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TopicAssignment","deprecatedAndHidden":false,"field":"EntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TopicAssignments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"UndecidedEventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"UndecidedEventRelations","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"User","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Users","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"UserEmailPreferredPerson","deprecatedAndHidden":false,"field":"PersonRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"PersonRecord","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"WorkOrder","deprecatedAndHidden":false,"field":"ContactId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"WorkOrders","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"sfLma__License__c","deprecatedAndHidden":false,"field":"sfLma__Contact__c","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"sfLma__R00N30000001JvR6EAK__r","restrictedDelete":false}],"label":"Contact","custom":false,"name":"Contact","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Contract.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Contract.json deleted file mode 100644 index 9d5263f17e..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Contract.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Contract ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Account ID","name":"AccountId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Account","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Owner Expiration Notice","name":"OwnerExpirationNotice","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"15 Days","validFor":null,"value":"15"},{"active":true,"defaultValue":false,"label":"30 Days","validFor":null,"value":"30"},{"active":true,"defaultValue":false,"label":"45 Days","validFor":null,"value":"45"},{"active":true,"defaultValue":false,"label":"60 Days","validFor":null,"value":"60"},{"active":true,"defaultValue":false,"label":"90 Days","validFor":null,"value":"90"},{"active":true,"defaultValue":false,"label":"120 Days","validFor":null,"value":"120"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Contract Start Date","name":"StartDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Contract End Date","name":"EndDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Billing Street","name":"BillingStreet","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Billing City","name":"BillingCity","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing State/Province","name":"BillingState","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing Zip/Postal Code","name":"BillingPostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing Country","name":"BillingCountry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing Latitude","name":"BillingLatitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Billing Longitude","name":"BillingLongitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Billing Geocode Accuracy","name":"BillingGeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Billing Address","name":"BillingAddress","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Shipping Street","name":"ShippingStreet","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Shipping City","name":"ShippingCity","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping State/Province","name":"ShippingState","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping Zip/Postal Code","name":"ShippingPostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping Country","name":"ShippingCountry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping Latitude","name":"ShippingLatitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Shipping Longitude","name":"ShippingLongitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Shipping Geocode Accuracy","name":"ShippingGeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Shipping Address","name":"ShippingAddress","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Contract Term","name":"ContractTerm","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Status","name":"Status","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"In Approval Process","validFor":null,"value":"In Approval Process"},{"active":true,"defaultValue":false,"label":"Activated","validFor":null,"value":"Activated"},{"active":true,"defaultValue":false,"label":"Draft","validFor":null,"value":"Draft"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Company Signed By ID","name":"CompanySignedId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"CompanySigned","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Company Signed Date","name":"CompanySignedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Customer Signed By ID","name":"CustomerSignedId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"CustomerSigned","referenceTo":["Contact"],"sortable":true,"type":"reference"},{"label":"Customer Signed Title","name":"CustomerSignedTitle","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Customer Signed Date","name":"CustomerSignedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Special Terms","name":"SpecialTerms","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Activated By ID","name":"ActivatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"ActivatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Activated Date","name":"ActivatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Status Category","name":"StatusCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Draft","validFor":null,"value":"Draft"},{"active":true,"defaultValue":false,"label":"In Approval Process","validFor":null,"value":"InApproval"},{"active":true,"defaultValue":false,"label":"Activated","validFor":null,"value":"Activated"},{"active":true,"defaultValue":false,"label":"Terminated","validFor":null,"value":"Terminated"},{"active":true,"defaultValue":false,"label":"Expired","validFor":null,"value":"Expired"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Description","name":"Description","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"textarea"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Contract Number","name":"ContractNumber","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Last Approved Date","name":"LastApprovedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Activity","name":"LastActivityDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"}],"childRelationships":[{"cascadeDelete":true,"childSObject":"ActivityHistory","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ActivityHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CollaborationGroupRecord","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordAssociatedGroups","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContractContactRole","deprecatedAndHidden":false,"field":"ContractId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContractContactRoles","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContractFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContractHistory","deprecatedAndHidden":false,"field":"ContractId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"EmailMessage","deprecatedAndHidden":false,"field":"RelatedToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Emails","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Event","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Events","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Note","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Notes","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"NoteAndAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"NotesAndAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpenActivity","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpenActivities","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Order","deprecatedAndHidden":false,"field":"ContractId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Orders","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProcessInstance","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessInstances","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessInstanceHistory","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessSteps","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Task","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Tasks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TopicAssignment","deprecatedAndHidden":false,"field":"EntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TopicAssignments","restrictedDelete":false}],"label":"Contract","custom":false,"name":"Contract","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Lead.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Lead.json deleted file mode 100644 index e0bc49d439..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Lead.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Lead ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Master Record ID","name":"MasterRecordId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"MasterRecord","referenceTo":["Lead"],"sortable":true,"type":"reference"},{"label":"Last Name","name":"LastName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"First Name","name":"FirstName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Salutation","name":"Salutation","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Mr.","validFor":null,"value":"Mr."},{"active":true,"defaultValue":false,"label":"Ms.","validFor":null,"value":"Ms."},{"active":true,"defaultValue":false,"label":"Mrs.","validFor":null,"value":"Mrs."},{"active":true,"defaultValue":false,"label":"Dr.","validFor":null,"value":"Dr."},{"active":true,"defaultValue":false,"label":"Prof.","validFor":null,"value":"Prof."}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Full Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Title","name":"Title","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Company","name":"Company","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Street","name":"Street","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"City","name":"City","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"State/Province","name":"State","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Zip/Postal Code","name":"PostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Country","name":"Country","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Latitude","name":"Latitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Longitude","name":"Longitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Geocode Accuracy","name":"GeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Address","name":"Address","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Phone","name":"Phone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Email","name":"Email","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"email"},{"label":"Website","name":"Website","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Photo URL","name":"PhotoUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Description","name":"Description","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"textarea"},{"label":"Lead Source","name":"LeadSource","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Advertisement","validFor":null,"value":"Advertisement"},{"active":true,"defaultValue":false,"label":"Employee Referral","validFor":null,"value":"Employee Referral"},{"active":true,"defaultValue":false,"label":"External Referral","validFor":null,"value":"External Referral"},{"active":true,"defaultValue":false,"label":"Partner","validFor":null,"value":"Partner"},{"active":true,"defaultValue":false,"label":"Public Relations","validFor":null,"value":"Public Relations"},{"active":true,"defaultValue":false,"label":"Seminar - Internal","validFor":null,"value":"Seminar - Internal"},{"active":true,"defaultValue":false,"label":"Seminar - Partner","validFor":null,"value":"Seminar - Partner"},{"active":true,"defaultValue":false,"label":"Trade Show","validFor":null,"value":"Trade Show"},{"active":true,"defaultValue":false,"label":"Web","validFor":null,"value":"Web"},{"active":true,"defaultValue":false,"label":"Word of mouth","validFor":null,"value":"Word of mouth"},{"active":true,"defaultValue":false,"label":"Other","validFor":null,"value":"Other"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Status","name":"Status","aggregatable":true,"defaultValue":"New","filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":true,"label":"New","validFor":null,"value":"New"},{"active":true,"defaultValue":false,"label":"Contacted","validFor":null,"value":"Contacted"},{"active":true,"defaultValue":false,"label":"Nurturing","validFor":null,"value":"Nurturing"},{"active":true,"defaultValue":false,"label":"Qualified","validFor":null,"value":"Qualified"},{"active":true,"defaultValue":false,"label":"Unqualified","validFor":null,"value":"Unqualified"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Industry","name":"Industry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Agriculture","validFor":null,"value":"Agriculture"},{"active":true,"defaultValue":false,"label":"Apparel","validFor":null,"value":"Apparel"},{"active":true,"defaultValue":false,"label":"Banking","validFor":null,"value":"Banking"},{"active":true,"defaultValue":false,"label":"Biotechnology","validFor":null,"value":"Biotechnology"},{"active":true,"defaultValue":false,"label":"Chemicals","validFor":null,"value":"Chemicals"},{"active":true,"defaultValue":false,"label":"Communications","validFor":null,"value":"Communications"},{"active":true,"defaultValue":false,"label":"Construction","validFor":null,"value":"Construction"},{"active":true,"defaultValue":false,"label":"Consulting","validFor":null,"value":"Consulting"},{"active":true,"defaultValue":false,"label":"Education","validFor":null,"value":"Education"},{"active":true,"defaultValue":false,"label":"Electronics","validFor":null,"value":"Electronics"},{"active":true,"defaultValue":false,"label":"Energy","validFor":null,"value":"Energy"},{"active":true,"defaultValue":false,"label":"Engineering","validFor":null,"value":"Engineering"},{"active":true,"defaultValue":false,"label":"Entertainment","validFor":null,"value":"Entertainment"},{"active":true,"defaultValue":false,"label":"Environmental","validFor":null,"value":"Environmental"},{"active":true,"defaultValue":false,"label":"Finance","validFor":null,"value":"Finance"},{"active":true,"defaultValue":false,"label":"Food & Beverage","validFor":null,"value":"Food & Beverage"},{"active":true,"defaultValue":false,"label":"Government","validFor":null,"value":"Government"},{"active":true,"defaultValue":false,"label":"Healthcare","validFor":null,"value":"Healthcare"},{"active":true,"defaultValue":false,"label":"Hospitality","validFor":null,"value":"Hospitality"},{"active":true,"defaultValue":false,"label":"Insurance","validFor":null,"value":"Insurance"},{"active":true,"defaultValue":false,"label":"Machinery","validFor":null,"value":"Machinery"},{"active":true,"defaultValue":false,"label":"Manufacturing","validFor":null,"value":"Manufacturing"},{"active":true,"defaultValue":false,"label":"Media","validFor":null,"value":"Media"},{"active":true,"defaultValue":false,"label":"Not For Profit","validFor":null,"value":"Not For Profit"},{"active":true,"defaultValue":false,"label":"Other","validFor":null,"value":"Other"},{"active":true,"defaultValue":false,"label":"Recreation","validFor":null,"value":"Recreation"},{"active":true,"defaultValue":false,"label":"Retail","validFor":null,"value":"Retail"},{"active":true,"defaultValue":false,"label":"Shipping","validFor":null,"value":"Shipping"},{"active":true,"defaultValue":false,"label":"Technology","validFor":null,"value":"Technology"},{"active":true,"defaultValue":false,"label":"Telecommunications","validFor":null,"value":"Telecommunications"},{"active":true,"defaultValue":false,"label":"Transportation","validFor":null,"value":"Transportation"},{"active":true,"defaultValue":false,"label":"Utilities","validFor":null,"value":"Utilities"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Rating","name":"Rating","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Hot","validFor":null,"value":"Hot"},{"active":true,"defaultValue":false,"label":"Warm","validFor":null,"value":"Warm"},{"active":true,"defaultValue":false,"label":"Cold","validFor":null,"value":"Cold"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Annual Revenue","name":"AnnualRevenue","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"currency"},{"label":"Employees","name":"NumberOfEmployees","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["Group","User"],"sortable":true,"type":"reference"},{"label":"Converted","name":"IsConverted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Converted Date","name":"ConvertedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Converted Account ID","name":"ConvertedAccountId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"ConvertedAccount","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Converted Contact ID","name":"ConvertedContactId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"ConvertedContact","referenceTo":["Contact"],"sortable":true,"type":"reference"},{"label":"Converted Opportunity ID","name":"ConvertedOpportunityId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"ConvertedOpportunity","referenceTo":["Opportunity"],"sortable":true,"type":"reference"},{"label":"Unread By Owner","name":"IsUnreadByOwner","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Activity","name":"LastActivityDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Data.com Key","name":"Jigsaw","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Jigsaw Contact ID","name":"JigsawContactId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"JigsawContact","referenceTo":[],"sortable":true,"type":"string"},{"label":"Email Bounced Reason","name":"EmailBouncedReason","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Email Bounced Date","name":"EmailBouncedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Individual ID","name":"IndividualId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Individual","referenceTo":["Individual"],"sortable":true,"type":"reference"},{"label":"Subscriber Org Type","name":"sfLma__Subscriber_Org_Type__c","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"}],"childRelationships":[{"cascadeDelete":false,"childSObject":"AcceptedEventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AcceptedEventRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ActivityHistory","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ActivityHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CollaborationGroupRecord","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordAssociatedGroups","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ContactRequest","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContactRequests","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"DeclinedEventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"DeclinedEventRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"DuplicateRecordItem","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"DuplicateRecordItems","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EmailMessageRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"EmailMessageRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EmailStatus","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"EmailStatuses","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Event","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Events","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"EventRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"LeadFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"LeadHistory","deprecatedAndHidden":false,"field":"LeadId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"LeadShare","deprecatedAndHidden":false,"field":"LeadId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Shares","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ListEmailIndividualRecipient","deprecatedAndHidden":false,"field":"RecipientId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ListEmailIndividualRecipients","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Note","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Notes","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"NoteAndAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"NotesAndAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpenActivity","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpenActivities","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"OutgoingEmailRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OutgoingEmailRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProcessInstance","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessInstances","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessInstanceHistory","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessSteps","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"SocialPersona","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Personas","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"SocialPost","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Posts","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Task","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Tasks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TopicAssignment","deprecatedAndHidden":false,"field":"EntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TopicAssignments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"UndecidedEventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"UndecidedEventRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"UserEmailPreferredPerson","deprecatedAndHidden":false,"field":"PersonRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"PersonRecord","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"sfLma__License__c","deprecatedAndHidden":false,"field":"sfLma__Lead__c","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"sfLma__R00N30000001JvRAEA0__r","restrictedDelete":false}],"label":"Lead","custom":false,"name":"Lead","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Note.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Note.json deleted file mode 100644 index 34377c474d..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Note.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Note Id","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Parent ID","name":"ParentId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Parent","referenceTo":["Account","Asset","CommSubscription","CommSubscriptionChannelType","CommSubscriptionConsent","CommSubscriptionTiming","Contact","Contract","EngagementChannelType","Image","Lead","Location","Opportunity","Order","Product2","SocialPost","WorkOrder","WorkOrderLineItem","sfFma__FeatureParameterBoolean__c","sfFma__FeatureParameterDate__c","sfFma__FeatureParameterInteger__c","sfFma__FeatureParameter__c","sfLma__License__c","sfLma__Package_Version__c","sfLma__Package__c"],"sortable":true,"type":"reference"},{"label":"Title","name":"Title","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Private","name":"IsPrivate","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Body","name":"Body","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"textarea"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"}],"childRelationships":[],"label":"Note","custom":false,"name":"Note","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Opportunity.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Opportunity.json deleted file mode 100644 index a4faf60131..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Opportunity.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Opportunity ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Account ID","name":"AccountId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Account","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Description","name":"Description","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"textarea"},{"label":"Stage","name":"StageName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Prospecting","validFor":null,"value":"Prospecting"},{"active":true,"defaultValue":false,"label":"Qualification","validFor":null,"value":"Qualification"},{"active":true,"defaultValue":false,"label":"Needs Analysis","validFor":null,"value":"Needs Analysis"},{"active":true,"defaultValue":false,"label":"Value Proposition","validFor":null,"value":"Value Proposition"},{"active":true,"defaultValue":false,"label":"Id. Decision Makers","validFor":null,"value":"Id. Decision Makers"},{"active":true,"defaultValue":false,"label":"Perception Analysis","validFor":null,"value":"Perception Analysis"},{"active":true,"defaultValue":false,"label":"Proposal/Price Quote","validFor":null,"value":"Proposal/Price Quote"},{"active":true,"defaultValue":false,"label":"Negotiation/Review","validFor":null,"value":"Negotiation/Review"},{"active":true,"defaultValue":false,"label":"Closed Won","validFor":null,"value":"Closed Won"},{"active":true,"defaultValue":false,"label":"Closed Lost","validFor":null,"value":"Closed Lost"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Amount","name":"Amount","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"currency"},{"label":"Probability (%)","name":"Probability","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"percent"},{"label":"Close Date","name":"CloseDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Opportunity Type","name":"Type","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Existing Business","validFor":null,"value":"Existing Business"},{"active":true,"defaultValue":false,"label":"New Business","validFor":null,"value":"New Business"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Next Step","name":"NextStep","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Lead Source","name":"LeadSource","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Advertisement","validFor":null,"value":"Advertisement"},{"active":true,"defaultValue":false,"label":"Employee Referral","validFor":null,"value":"Employee Referral"},{"active":true,"defaultValue":false,"label":"External Referral","validFor":null,"value":"External Referral"},{"active":true,"defaultValue":false,"label":"Partner","validFor":null,"value":"Partner"},{"active":true,"defaultValue":false,"label":"Public Relations","validFor":null,"value":"Public Relations"},{"active":true,"defaultValue":false,"label":"Seminar - Internal","validFor":null,"value":"Seminar - Internal"},{"active":true,"defaultValue":false,"label":"Seminar - Partner","validFor":null,"value":"Seminar - Partner"},{"active":true,"defaultValue":false,"label":"Trade Show","validFor":null,"value":"Trade Show"},{"active":true,"defaultValue":false,"label":"Web","validFor":null,"value":"Web"},{"active":true,"defaultValue":false,"label":"Word of mouth","validFor":null,"value":"Word of mouth"},{"active":true,"defaultValue":false,"label":"Other","validFor":null,"value":"Other"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Closed","name":"IsClosed","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Won","name":"IsWon","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Forecast Category","name":"ForecastCategory","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Omitted","validFor":null,"value":"Omitted"},{"active":true,"defaultValue":false,"label":"Pipeline","validFor":null,"value":"Pipeline"},{"active":true,"defaultValue":false,"label":"Best Case","validFor":null,"value":"BestCase"},{"active":true,"defaultValue":false,"label":"Commit","validFor":null,"value":"Forecast"},{"active":true,"defaultValue":false,"label":"Closed","validFor":null,"value":"Closed"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Forecast Category","name":"ForecastCategoryName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Omitted","validFor":null,"value":"Omitted"},{"active":true,"defaultValue":false,"label":"Pipeline","validFor":null,"value":"Pipeline"},{"active":true,"defaultValue":false,"label":"Best Case","validFor":null,"value":"Best Case"},{"active":true,"defaultValue":false,"label":"Commit","validFor":null,"value":"Commit"},{"active":true,"defaultValue":false,"label":"Closed","validFor":null,"value":"Closed"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Has Line Item","name":"HasOpportunityLineItem","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Price Book ID","name":"Pricebook2Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Pricebook2","referenceTo":["Pricebook2"],"sortable":true,"type":"reference"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Activity","name":"LastActivityDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Fiscal Quarter","name":"FiscalQuarter","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Fiscal Year","name":"FiscalYear","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Fiscal Period","name":"Fiscal","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Contact ID","name":"ContactId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":["Contact"],"sortable":true,"type":"reference"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Has Open Activity","name":"HasOpenActivity","aggregatable":false,"defaultValue":false,"filterable":false,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"Has Overdue Task","name":"HasOverdueTask","aggregatable":false,"defaultValue":false,"filterable":false,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"Opportunity History ID","name":"LastAmountChangedHistoryId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"LastAmountChangedHistory","referenceTo":["OpportunityHistory"],"sortable":true,"type":"reference"},{"label":"Opportunity History ID","name":"LastCloseDateChangedHistoryId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"LastCloseDateChangedHistory","referenceTo":["OpportunityHistory"],"sortable":true,"type":"reference"}],"childRelationships":[{"cascadeDelete":true,"childSObject":"AccountPartner","deprecatedAndHidden":false,"field":"OpportunityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AccountPartners","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ActivityHistory","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ActivityHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CollaborationGroupRecord","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordAssociatedGroups","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ContactRequest","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContactRequests","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"EmailMessage","deprecatedAndHidden":false,"field":"RelatedToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Emails","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Event","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Events","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Note","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Notes","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"NoteAndAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"NotesAndAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpenActivity","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpenActivities","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityCompetitor","deprecatedAndHidden":false,"field":"OpportunityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpportunityCompetitors","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityContactRole","deprecatedAndHidden":false,"field":"OpportunityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpportunityContactRoles","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityFieldHistory","deprecatedAndHidden":false,"field":"OpportunityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityHistory","deprecatedAndHidden":false,"field":"OpportunityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpportunityHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityLineItem","deprecatedAndHidden":false,"field":"OpportunityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpportunityLineItems","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityPartner","deprecatedAndHidden":false,"field":"OpportunityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpportunityPartnersFrom","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpportunityShare","deprecatedAndHidden":false,"field":"OpportunityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Shares","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Partner","deprecatedAndHidden":false,"field":"OpportunityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Partners","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProcessInstance","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessInstances","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessInstanceHistory","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessSteps","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Task","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Tasks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TopicAssignment","deprecatedAndHidden":false,"field":"EntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TopicAssignments","restrictedDelete":false}],"label":"Opportunity","custom":false,"name":"Opportunity","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Order.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Order.json deleted file mode 100644 index f32fafb8bf..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Order.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Order ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["Group","User"],"sortable":true,"type":"reference"},{"label":"Contract ID","name":"ContractId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Contract","referenceTo":["Contract"],"sortable":true,"type":"reference"},{"label":"Account ID","name":"AccountId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Account","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Price Book ID","name":"Pricebook2Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Pricebook2","referenceTo":["Pricebook2"],"sortable":true,"type":"reference"},{"label":"Order ID","name":"OriginalOrderId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"OriginalOrder","referenceTo":["Order"],"sortable":true,"type":"reference"},{"label":"Order Start Date","name":"EffectiveDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Order End Date","name":"EndDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Reduction Order","name":"IsReductionOrder","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Status","name":"Status","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Draft","validFor":null,"value":"Draft"},{"active":true,"defaultValue":false,"label":"Activated","validFor":null,"value":"Activated"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Description","name":"Description","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"textarea"},{"label":"Customer Authorized By ID","name":"CustomerAuthorizedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"CustomerAuthorizedBy","referenceTo":["Contact"],"sortable":true,"type":"reference"},{"label":"Company Authorized By ID","name":"CompanyAuthorizedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"CompanyAuthorizedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Order Type","name":"Type","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Billing Street","name":"BillingStreet","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Billing City","name":"BillingCity","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing State/Province","name":"BillingState","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing Zip/Postal Code","name":"BillingPostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing Country","name":"BillingCountry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Billing Latitude","name":"BillingLatitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Billing Longitude","name":"BillingLongitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Billing Geocode Accuracy","name":"BillingGeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Billing Address","name":"BillingAddress","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Shipping Street","name":"ShippingStreet","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Shipping City","name":"ShippingCity","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping State/Province","name":"ShippingState","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping Zip/Postal Code","name":"ShippingPostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping Country","name":"ShippingCountry","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Shipping Latitude","name":"ShippingLatitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Shipping Longitude","name":"ShippingLongitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Shipping Geocode Accuracy","name":"ShippingGeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Shipping Address","name":"ShippingAddress","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Activated Date","name":"ActivatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Activated By ID","name":"ActivatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"ActivatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Status Category","name":"StatusCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Draft","validFor":null,"value":"Draft"},{"active":true,"defaultValue":false,"label":"Activated","validFor":null,"value":"Activated"},{"active":true,"defaultValue":false,"label":"Cancelled","validFor":null,"value":"Canceled"},{"active":true,"defaultValue":false,"label":"Expired","validFor":null,"value":"Expired"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Order Number","name":"OrderNumber","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Order Amount","name":"TotalAmount","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"currency"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"}],"childRelationships":[{"cascadeDelete":true,"childSObject":"ActivityHistory","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ActivityHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"EmailMessage","deprecatedAndHidden":false,"field":"RelatedToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Emails","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Event","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Events","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Note","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Notes","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"NoteAndAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"NotesAndAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpenActivity","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpenActivities","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Order","deprecatedAndHidden":false,"field":"OriginalOrderId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Orders","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"OrderFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OrderHistory","deprecatedAndHidden":false,"field":"OrderId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OrderItem","deprecatedAndHidden":false,"field":"OrderId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OrderItems","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OrderShare","deprecatedAndHidden":false,"field":"OrderId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Shares","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProcessException","deprecatedAndHidden":false,"field":"AttachedToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessExceptions","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProcessInstance","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessInstances","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessInstanceHistory","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessSteps","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Task","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Tasks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TopicAssignment","deprecatedAndHidden":false,"field":"EntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TopicAssignments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"WorkOrderLineItem","deprecatedAndHidden":false,"field":"OrderId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"WorkOrderLineItems","restrictedDelete":false}],"label":"Order","custom":false,"name":"Order","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Pricebook2.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Pricebook2.json deleted file mode 100644 index df153793d0..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Pricebook2.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Price Book ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Price Book Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Active","name":"IsActive","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Archived","name":"IsArchived","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Description","name":"Description","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Is Standard Price Book","name":"IsStandard","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"}],"childRelationships":[{"cascadeDelete":false,"childSObject":"Opportunity","deprecatedAndHidden":false,"field":"Pricebook2Id","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Opportunities","restrictedDelete":true},{"cascadeDelete":false,"childSObject":"Order","deprecatedAndHidden":false,"field":"Pricebook2Id","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Orders","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"Pricebook2History","deprecatedAndHidden":false,"field":"Pricebook2Id","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"PricebookEntry","deprecatedAndHidden":false,"field":"Pricebook2Id","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"PricebookEntries","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"WorkOrder","deprecatedAndHidden":false,"field":"Pricebook2Id","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"WorkOrders","restrictedDelete":false}],"label":"Price Book","custom":false,"name":"Pricebook2","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/PricebookEntry.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/PricebookEntry.json deleted file mode 100644 index 8195a9688a..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/PricebookEntry.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Price Book Entry ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Product Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Price Book ID","name":"Pricebook2Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Pricebook2","referenceTo":["Pricebook2"],"sortable":true,"type":"reference"},{"label":"Product ID","name":"Product2Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Product2","referenceTo":["Product2"],"sortable":true,"type":"reference"},{"label":"List Price","name":"UnitPrice","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"currency"},{"label":"Active","name":"IsActive","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Use Standard Price","name":"UseStandardPrice","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Product Code","name":"ProductCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Archived","name":"IsArchived","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"}],"childRelationships":[{"cascadeDelete":false,"childSObject":"OpportunityLineItem","deprecatedAndHidden":false,"field":"PricebookEntryId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpportunityLineItems","restrictedDelete":true},{"cascadeDelete":false,"childSObject":"OrderItem","deprecatedAndHidden":false,"field":"PricebookEntryId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OrderItems","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"PricebookEntryHistory","deprecatedAndHidden":false,"field":"PricebookEntryId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"WorkOrderLineItem","deprecatedAndHidden":false,"field":"PricebookEntryId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"WorkOrderLineItems","restrictedDelete":false}],"label":"Price Book Entry","custom":false,"name":"PricebookEntry","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Product2.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Product2.json deleted file mode 100644 index cdea3464cc..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Product2.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Product ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Product Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Product Code","name":"ProductCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Product Description","name":"Description","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Active","name":"IsActive","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Product Family","name":"Family","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"None","validFor":null,"value":"None"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"External Data Source ID","name":"ExternalDataSourceId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":["ExternalDataSource"],"sortable":true,"type":"reference"},{"label":"External ID","name":"ExternalId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Display URL","name":"DisplayUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Quantity Unit Of Measure","name":"QuantityUnitOfMeasure","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Each","validFor":null,"value":"Each"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Archived","name":"IsArchived","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Product SKU","name":"StockKeepingUnit","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"}],"childRelationships":[{"cascadeDelete":true,"childSObject":"ActivityHistory","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ActivityHistories","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Asset","deprecatedAndHidden":false,"field":"Product2Id","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Assets","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"EmailMessage","deprecatedAndHidden":false,"field":"RelatedToId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Emails","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Event","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Events","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Note","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Notes","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"NoteAndAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"NotesAndAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OpenActivity","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OpenActivities","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"PricebookEntry","deprecatedAndHidden":false,"field":"Product2Id","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"PricebookEntries","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"ProcessInstance","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessInstances","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ProcessInstanceHistory","deprecatedAndHidden":false,"field":"TargetObjectId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ProcessSteps","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Product2Feed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Product2History","deprecatedAndHidden":false,"field":"Product2Id","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Histories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Task","deprecatedAndHidden":false,"field":"WhatId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Tasks","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"WorkOrderLineItem","deprecatedAndHidden":false,"field":"Product2Id","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"WorkOrderLineItems","restrictedDelete":false}],"label":"Product","custom":false,"name":"Product2","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/RecordType.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/RecordType.json deleted file mode 100644 index 1511471ad1..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/RecordType.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Record Type ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Record Type Name","name":"DeveloperName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Namespace Prefix","name":"NamespacePrefix","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Description","name":"Description","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Business Process ID","name":"BusinessProcessId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":["BusinessProcess"],"sortable":true,"type":"reference"},{"label":"SObject Type Name","name":"SobjectType","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Account"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ActiveScratchOrg"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Announcement"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"AppAnalyticsQueryRequest"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Asset"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"AssetRelationship"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"AssistantProgress"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"AssociatedLocation"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"AuthorizationForm"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"AuthorizationFormConsent"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"AuthorizationFormDataUse"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"AuthorizationFormText"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CalendarModel"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CalendarView"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Case"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CollabDocumentMetric"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CollabDocumentMetricRecord"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CollaborationGroup"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CollaborationGroupRank"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CollaborationGroupRecord"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CollabTemplateMetric"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CollabTemplateMetricRecord"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CollabUserEngagementMetric"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CollabUserEngmtRecordLink"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CommSubscription"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CommSubscriptionChannelType"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CommSubscriptionConsent"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"CommSubscriptionTiming"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ComponentResponseCache"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Contact"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContactPointAddress"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContactPointConsent"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContactPointEmail"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContactPointPhone"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContactPointTypeConsent"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContactRequest"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContentBuilderChannel"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContentDocumentListViewMapping"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContentFolderDistribution"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ContentVersion"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Contract"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"DataUseLegalBasis"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"DataUsePurpose"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"DuplicateErrorLog"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"DuplicateRecordItem"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"DuplicateRecordSet"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"EngagementChannelType"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Event"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"FileInspectionResult"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"FileSearchActivity"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"FlowExecutionEventMetric"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"FlowRecordRelation"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"FlowStageRelation"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Idea"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Image"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"InboundSocialPost"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Individual"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Lead"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"LearningAssignment"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"LearningAssignmentProgress"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"LearningItem"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"LearningLink"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"LearningLinkProgress"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ListEmail"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ListEmailIndividualRecipient"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ListEmailRecipientSource"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ListEmailSentResult"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Location"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"LocationTrustMeasure"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"MalformedTemplateTracker"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContent"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentBlock"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentBlockVersion"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentBodyLink"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentChannel"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentExportJobItem"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentImportExportJob"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentMigration"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentNode"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentNodeRefTree"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentNodeRendition"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentRelease"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentReleaseItem"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentSpaceChannel"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentSpaceFolderMember"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentSpaceItem"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentTranslationJob"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentTranslationTask"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentTypeSearchBlackList"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ManagedContentVersion"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"NamespaceRegistry"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Opportunity"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Order"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"OrgDeleteRequest"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"OrgMetric"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"OrgMetricScanResult"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"OrgMetricScanSummary"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"PageContentAssignment"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"PartyConsent"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"PersonalizationResource"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Pricebook2"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ProcessException"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Product2"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ProfileSkill"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ProfileSkillEndorsement"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ProfileSkillUser"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"PromptAction"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"QuickText"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"QuickTextUsage"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Recommendation"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"RecommendationReaction"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"RecordAction"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"RecordMergeHistory"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"RecordOrigin"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ReleaseUpdateStep"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ReleaseUpdateStepLog"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ReportResultBlob"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Scorecard"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ScorecardAssociation"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ScorecardMetric"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ScratchOrgInfo"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"SearchActivity"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"ServiceSetupProvisioning"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"SetupAssistantAnswer"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"SetupAssistantProgress"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"SetupAssistantStep"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"SetupFlowProgress"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"sfFma__FeatureParameter__c"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"sfFma__FeatureParameterBoolean__c"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"sfFma__FeatureParameterDate__c"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"sfFma__FeatureParameterInteger__c"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"sfLma__License__c"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"sfLma__Package__c"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"sfLma__Package_Version__c"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"SocialPost"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"SoftwareProduct"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Solution"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"StrategyMonthlyStats"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"SyncTransactionLog"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"Task"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"TenantSecurityLogin"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"TenantSecurityMonitorMetric"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"UserAssistantProgress"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"UserEmailPreferredPerson"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"UserMetrics"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"UserNavItem"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"UserQuestionnaireAnswer"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"UserQuestionnaireSummary"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"WorkAccess"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"WorkBadge"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"WorkBadgeDefinition"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"WorkOrder"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"WorkOrderLineItem"},{"active":true,"defaultValue":false,"label":null,"validFor":null,"value":"WorkThanks"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Active","name":"IsActive","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"}],"childRelationships":[],"label":"Record Type","custom":false,"name":"RecordType","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Report.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Report.json deleted file mode 100644 index e1f43bf15e..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Report.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Report ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Owner ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["Folder","Organization","User"],"sortable":true,"type":"reference"},{"label":"Folder Name","name":"FolderName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Report Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Description","name":"Description","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Report Unique Name","name":"DeveloperName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Namespace Prefix","name":"NamespacePrefix","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Last Run","name":"LastRunDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Format","name":"Format","aggregatable":true,"defaultValue":"Tabular","filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Joined","validFor":null,"value":"MultiBlock"},{"active":true,"defaultValue":false,"label":"Matrix","validFor":null,"value":"Matrix"},{"active":true,"defaultValue":false,"label":"Summary","validFor":null,"value":"Summary"},{"active":true,"defaultValue":true,"label":"Tabular","validFor":null,"value":"Tabular"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"}],"childRelationships":[{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ReportFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false}],"label":"Report","custom":false,"name":"Report","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Task.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Task.json deleted file mode 100644 index ce0fee26b7..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/Task.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"Activity ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Name ID","name":"WhoId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Who","referenceTo":["Contact","Lead"],"sortable":true,"type":"reference"},{"label":"Related To ID","name":"WhatId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"What","referenceTo":["Account","Asset","AssetRelationship","Case","CommSubscriptionConsent","ContactRequest","Contract","Image","ListEmail","Location","Opportunity","Order","PartyConsent","ProcessException","Product2","Solution","WorkOrder","WorkOrderLineItem","sfLma__License__c","sfLma__Package_Version__c","sfLma__Package__c"],"sortable":true,"type":"reference"},{"label":"Subject","name":"Subject","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Call","validFor":null,"value":"Call"},{"active":true,"defaultValue":false,"label":"Send Letter","validFor":null,"value":"Send Letter"},{"active":true,"defaultValue":false,"label":"Send Quote","validFor":null,"value":"Send Quote"},{"active":true,"defaultValue":false,"label":"Other","validFor":null,"value":"Other"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"combobox"},{"label":"Due Date Only","name":"ActivityDate","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Status","name":"Status","aggregatable":true,"defaultValue":"Not Started","filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":true,"label":"Not Started","validFor":null,"value":"Not Started"},{"active":true,"defaultValue":false,"label":"In Progress","validFor":null,"value":"In Progress"},{"active":true,"defaultValue":false,"label":"Completed","validFor":null,"value":"Completed"},{"active":true,"defaultValue":false,"label":"Waiting on someone else","validFor":null,"value":"Waiting on someone else"},{"active":true,"defaultValue":false,"label":"Deferred","validFor":null,"value":"Deferred"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Priority","name":"Priority","aggregatable":true,"defaultValue":"Normal","filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"High","validFor":null,"value":"High"},{"active":true,"defaultValue":true,"label":"Normal","validFor":null,"value":"Normal"},{"active":true,"defaultValue":false,"label":"Low","validFor":null,"value":"Low"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"High Priority","name":"IsHighPriority","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Assigned To ID","name":"OwnerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Owner","referenceTo":["Group","User"],"sortable":true,"type":"reference"},{"label":"Description","name":"Description","aggregatable":false,"defaultValue":null,"filterable":false,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"textarea"},{"label":"Deleted","name":"IsDeleted","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Account ID","name":"AccountId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Account","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Closed","name":"IsClosed","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Archived","name":"IsArchived","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Call Duration","name":"CallDurationInSeconds","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Call Type","name":"CallType","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Internal","validFor":null,"value":"Internal"},{"active":true,"defaultValue":false,"label":"Inbound","validFor":null,"value":"Inbound"},{"active":true,"defaultValue":false,"label":"Outbound","validFor":null,"value":"Outbound"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Call Result","name":"CallDisposition","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Call Object Identifier","name":"CallObject","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Reminder Date/Time","name":"ReminderDateTime","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Reminder Set","name":"IsReminderSet","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Recurrence Activity ID","name":"RecurrenceActivityId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":["Task"],"sortable":true,"type":"reference"},{"label":"Create Recurring Series of Tasks","name":"IsRecurrence","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Recurrence Start","name":"RecurrenceStartDateOnly","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Recurrence End","name":"RecurrenceEndDateOnly","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"date"},{"label":"Recurrence Time Zone","name":"RecurrenceTimeZoneSidKey","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"(GMT+14:00) Line Islands Time (Pacific/Kiritimati)","validFor":null,"value":"Pacific/Kiritimati"},{"active":true,"defaultValue":false,"label":"(GMT+13:00) Phoenix Islands Time (Pacific/Enderbury)","validFor":null,"value":"Pacific/Enderbury"},{"active":true,"defaultValue":false,"label":"(GMT+13:00) Tonga Standard Time (Pacific/Tongatapu)","validFor":null,"value":"Pacific/Tongatapu"},{"active":true,"defaultValue":false,"label":"(GMT+12:45) Chatham Standard Time (Pacific/Chatham)","validFor":null,"value":"Pacific/Chatham"},{"active":true,"defaultValue":false,"label":"(GMT+12:00) Petropavlovsk-Kamchatski Standard Time (Asia/Kamchatka)","validFor":null,"value":"Asia/Kamchatka"},{"active":true,"defaultValue":false,"label":"(GMT+12:00) New Zealand Standard Time (Pacific/Auckland)","validFor":null,"value":"Pacific/Auckland"},{"active":true,"defaultValue":false,"label":"(GMT+12:00) Fiji Standard Time (Pacific/Fiji)","validFor":null,"value":"Pacific/Fiji"},{"active":true,"defaultValue":false,"label":"(GMT+11:00) Solomon Islands Time (Pacific/Guadalcanal)","validFor":null,"value":"Pacific/Guadalcanal"},{"active":true,"defaultValue":false,"label":"(GMT+11:00) Norfolk Island Time (Pacific/Norfolk)","validFor":null,"value":"Pacific/Norfolk"},{"active":true,"defaultValue":false,"label":"(GMT+10:30) Lord Howe Standard Time (Australia/Lord_Howe)","validFor":null,"value":"Australia/Lord_Howe"},{"active":true,"defaultValue":false,"label":"(GMT+10:00) Australian Eastern Standard Time (Australia/Brisbane)","validFor":null,"value":"Australia/Brisbane"},{"active":true,"defaultValue":false,"label":"(GMT+10:00) Australian Eastern Standard Time (Australia/Sydney)","validFor":null,"value":"Australia/Sydney"},{"active":true,"defaultValue":false,"label":"(GMT+09:30) Australian Central Standard Time (Australia/Adelaide)","validFor":null,"value":"Australia/Adelaide"},{"active":true,"defaultValue":false,"label":"(GMT+09:30) Australian Central Standard Time (Australia/Darwin)","validFor":null,"value":"Australia/Darwin"},{"active":true,"defaultValue":false,"label":"(GMT+09:00) Korean Standard Time (Asia/Seoul)","validFor":null,"value":"Asia/Seoul"},{"active":true,"defaultValue":false,"label":"(GMT+09:00) Japan Standard Time (Asia/Tokyo)","validFor":null,"value":"Asia/Tokyo"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Hong Kong Standard Time (Asia/Hong_Kong)","validFor":null,"value":"Asia/Hong_Kong"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Malaysia Time (Asia/Kuala_Lumpur)","validFor":null,"value":"Asia/Kuala_Lumpur"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Philippine Standard Time (Asia/Manila)","validFor":null,"value":"Asia/Manila"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) China Standard Time (Asia/Shanghai)","validFor":null,"value":"Asia/Shanghai"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Singapore Standard Time (Asia/Singapore)","validFor":null,"value":"Asia/Singapore"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Taipei Standard Time (Asia/Taipei)","validFor":null,"value":"Asia/Taipei"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Australian Western Standard Time (Australia/Perth)","validFor":null,"value":"Australia/Perth"},{"active":true,"defaultValue":false,"label":"(GMT+07:00) Indochina Time (Asia/Bangkok)","validFor":null,"value":"Asia/Bangkok"},{"active":true,"defaultValue":false,"label":"(GMT+07:00) Indochina Time (Asia/Ho_Chi_Minh)","validFor":null,"value":"Asia/Ho_Chi_Minh"},{"active":true,"defaultValue":false,"label":"(GMT+07:00) Western Indonesia Time (Asia/Jakarta)","validFor":null,"value":"Asia/Jakarta"},{"active":true,"defaultValue":false,"label":"(GMT+06:30) Myanmar Time (Asia/Rangoon)","validFor":null,"value":"Asia/Rangoon"},{"active":true,"defaultValue":false,"label":"(GMT+06:00) Bangladesh Standard Time (Asia/Dhaka)","validFor":null,"value":"Asia/Dhaka"},{"active":true,"defaultValue":false,"label":"(GMT+05:45) Nepal Time (Asia/Kathmandu)","validFor":null,"value":"Asia/Kathmandu"},{"active":true,"defaultValue":false,"label":"(GMT+05:30) India Standard Time (Asia/Colombo)","validFor":null,"value":"Asia/Colombo"},{"active":true,"defaultValue":false,"label":"(GMT+05:30) India Standard Time (Asia/Kolkata)","validFor":null,"value":"Asia/Kolkata"},{"active":true,"defaultValue":false,"label":"(GMT+05:00) Pakistan Standard Time (Asia/Karachi)","validFor":null,"value":"Asia/Karachi"},{"active":true,"defaultValue":false,"label":"(GMT+05:00) Uzbekistan Standard Time (Asia/Tashkent)","validFor":null,"value":"Asia/Tashkent"},{"active":true,"defaultValue":false,"label":"(GMT+05:00) Yekaterinburg Standard Time (Asia/Yekaterinburg)","validFor":null,"value":"Asia/Yekaterinburg"},{"active":true,"defaultValue":false,"label":"(GMT+04:30) Afghanistan Time (Asia/Kabul)","validFor":null,"value":"Asia/Kabul"},{"active":true,"defaultValue":false,"label":"(GMT+04:30) Iran Daylight Time (Asia/Tehran)","validFor":null,"value":"Asia/Tehran"},{"active":true,"defaultValue":false,"label":"(GMT+04:00) Azerbaijan Standard Time (Asia/Baku)","validFor":null,"value":"Asia/Baku"},{"active":true,"defaultValue":false,"label":"(GMT+04:00) Gulf Standard Time (Asia/Dubai)","validFor":null,"value":"Asia/Dubai"},{"active":true,"defaultValue":false,"label":"(GMT+04:00) Georgia Standard Time (Asia/Tbilisi)","validFor":null,"value":"Asia/Tbilisi"},{"active":true,"defaultValue":false,"label":"(GMT+04:00) Armenia Standard Time (Asia/Yerevan)","validFor":null,"value":"Asia/Yerevan"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) East Africa Time (Africa/Nairobi)","validFor":null,"value":"Africa/Nairobi"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Arabian Standard Time (Asia/Baghdad)","validFor":null,"value":"Asia/Baghdad"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Summer Time (Asia/Beirut)","validFor":null,"value":"Asia/Beirut"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Israel Daylight Time (Asia/Jerusalem)","validFor":null,"value":"Asia/Jerusalem"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Arabian Standard Time (Asia/Kuwait)","validFor":null,"value":"Asia/Kuwait"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Arabian Standard Time (Asia/Riyadh)","validFor":null,"value":"Asia/Riyadh"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Summer Time (Europe/Athens)","validFor":null,"value":"Europe/Athens"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Summer Time (Europe/Bucharest)","validFor":null,"value":"Europe/Bucharest"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Summer Time (Europe/Helsinki)","validFor":null,"value":"Europe/Helsinki"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Standard Time (Europe/Istanbul)","validFor":null,"value":"Europe/Istanbul"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Moscow Standard Time (Europe/Minsk)","validFor":null,"value":"Europe/Minsk"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Moscow Standard Time (Europe/Moscow)","validFor":null,"value":"Europe/Moscow"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Eastern European Standard Time (Africa/Cairo)","validFor":null,"value":"Africa/Cairo"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) South Africa Standard Time (Africa/Johannesburg)","validFor":null,"value":"Africa/Johannesburg"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Amsterdam)","validFor":null,"value":"Europe/Amsterdam"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Berlin)","validFor":null,"value":"Europe/Berlin"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Brussels)","validFor":null,"value":"Europe/Brussels"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Paris)","validFor":null,"value":"Europe/Paris"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Prague)","validFor":null,"value":"Europe/Prague"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Rome)","validFor":null,"value":"Europe/Rome"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) Central European Standard Time (Africa/Algiers)","validFor":null,"value":"Africa/Algiers"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) Western European Summer Time (Africa/Casablanca)","validFor":null,"value":"Africa/Casablanca"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) Irish Standard Time (Europe/Dublin)","validFor":null,"value":"Europe/Dublin"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) Western European Summer Time (Europe/Lisbon)","validFor":null,"value":"Europe/Lisbon"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) British Summer Time (Europe/London)","validFor":null,"value":"Europe/London"},{"active":true,"defaultValue":false,"label":"(GMT+00:00) East Greenland Summer Time (America/Scoresbysund)","validFor":null,"value":"America/Scoresbysund"},{"active":true,"defaultValue":false,"label":"(GMT+00:00) Azores Summer Time (Atlantic/Azores)","validFor":null,"value":"Atlantic/Azores"},{"active":true,"defaultValue":false,"label":"(GMT+00:00) Greenwich Mean Time (GMT)","validFor":null,"value":"GMT"},{"active":true,"defaultValue":false,"label":"(GMT-01:00) Cape Verde Standard Time (Atlantic/Cape_Verde)","validFor":null,"value":"Atlantic/Cape_Verde"},{"active":true,"defaultValue":false,"label":"(GMT-02:00) South Georgia Time (Atlantic/South_Georgia)","validFor":null,"value":"Atlantic/South_Georgia"},{"active":true,"defaultValue":false,"label":"(GMT-02:30) Newfoundland Daylight Time (America/St_Johns)","validFor":null,"value":"America/St_Johns"},{"active":true,"defaultValue":false,"label":"(GMT-03:00) Argentina Standard Time (America/Argentina/Buenos_Aires)","validFor":null,"value":"America/Argentina/Buenos_Aires"},{"active":true,"defaultValue":false,"label":"(GMT-03:00) Atlantic Daylight Time (America/Halifax)","validFor":null,"value":"America/Halifax"},{"active":true,"defaultValue":false,"label":"(GMT-03:00) Brasilia Standard Time (America/Sao_Paulo)","validFor":null,"value":"America/Sao_Paulo"},{"active":true,"defaultValue":false,"label":"(GMT-03:00) Atlantic Daylight Time (Atlantic/Bermuda)","validFor":null,"value":"Atlantic/Bermuda"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Venezuela Time (America/Caracas)","validFor":null,"value":"America/Caracas"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Eastern Daylight Time (America/Indiana/Indianapolis)","validFor":null,"value":"America/Indiana/Indianapolis"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Eastern Daylight Time (America/New_York)","validFor":null,"value":"America/New_York"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Atlantic Standard Time (America/Puerto_Rico)","validFor":null,"value":"America/Puerto_Rico"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Chile Standard Time (America/Santiago)","validFor":null,"value":"America/Santiago"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Colombia Standard Time (America/Bogota)","validFor":null,"value":"America/Bogota"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Central Daylight Time (America/Chicago)","validFor":null,"value":"America/Chicago"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Peru Standard Time (America/Lima)","validFor":null,"value":"America/Lima"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Central Daylight Time (America/Mexico_City)","validFor":null,"value":"America/Mexico_City"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Eastern Standard Time (America/Panama)","validFor":null,"value":"America/Panama"},{"active":true,"defaultValue":false,"label":"(GMT-06:00) Mountain Daylight Time (America/Denver)","validFor":null,"value":"America/Denver"},{"active":true,"defaultValue":false,"label":"(GMT-06:00) Central Standard Time (America/El_Salvador)","validFor":null,"value":"America/El_Salvador"},{"active":true,"defaultValue":false,"label":"(GMT-06:00) Mexican Pacific Daylight Time (America/Mazatlan)","validFor":null,"value":"America/Mazatlan"},{"active":true,"defaultValue":false,"label":"(GMT-07:00) Pacific Daylight Time (America/Los_Angeles)","validFor":null,"value":"America/Los_Angeles"},{"active":true,"defaultValue":false,"label":"(GMT-07:00) Mountain Standard Time (America/Phoenix)","validFor":null,"value":"America/Phoenix"},{"active":true,"defaultValue":false,"label":"(GMT-07:00) Pacific Daylight Time (America/Tijuana)","validFor":null,"value":"America/Tijuana"},{"active":true,"defaultValue":false,"label":"(GMT-08:00) Alaska Daylight Time (America/Anchorage)","validFor":null,"value":"America/Anchorage"},{"active":true,"defaultValue":false,"label":"(GMT-08:00) Pitcairn Time (Pacific/Pitcairn)","validFor":null,"value":"Pacific/Pitcairn"},{"active":true,"defaultValue":false,"label":"(GMT-09:00) Hawaii-Aleutian Daylight Time (America/Adak)","validFor":null,"value":"America/Adak"},{"active":true,"defaultValue":false,"label":"(GMT-09:00) Gambier Time (Pacific/Gambier)","validFor":null,"value":"Pacific/Gambier"},{"active":true,"defaultValue":false,"label":"(GMT-09:30) Marquesas Time (Pacific/Marquesas)","validFor":null,"value":"Pacific/Marquesas"},{"active":true,"defaultValue":false,"label":"(GMT-10:00) Hawaii-Aleutian Standard Time (Pacific/Honolulu)","validFor":null,"value":"Pacific/Honolulu"},{"active":true,"defaultValue":false,"label":"(GMT-11:00) Niue Time (Pacific/Niue)","validFor":null,"value":"Pacific/Niue"},{"active":true,"defaultValue":false,"label":"(GMT-11:00) Samoa Standard Time (Pacific/Pago_Pago)","validFor":null,"value":"Pacific/Pago_Pago"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Recurrence Type","name":"RecurrenceType","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Recurs Daily","validFor":null,"value":"RecursDaily"},{"active":true,"defaultValue":false,"label":"Recurs Every Weekday","validFor":null,"value":"RecursEveryWeekday"},{"active":true,"defaultValue":false,"label":"Recurs Monthly","validFor":null,"value":"RecursMonthly"},{"active":true,"defaultValue":false,"label":"Recurs Monthly Nth","validFor":null,"value":"RecursMonthlyNth"},{"active":true,"defaultValue":false,"label":"Recurs Weekly","validFor":null,"value":"RecursWeekly"},{"active":true,"defaultValue":false,"label":"Recurs Yearly","validFor":null,"value":"RecursYearly"},{"active":true,"defaultValue":false,"label":"Recurs Yearly Nth","validFor":null,"value":"RecursYearlyNth"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Recurrence Interval","name":"RecurrenceInterval","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Recurrence Day of Week Mask","name":"RecurrenceDayOfWeekMask","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Recurrence Day of Month","name":"RecurrenceDayOfMonth","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Recurrence Instance","name":"RecurrenceInstance","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"1st","validFor":null,"value":"First"},{"active":true,"defaultValue":false,"label":"2nd","validFor":null,"value":"Second"},{"active":true,"defaultValue":false,"label":"3rd","validFor":null,"value":"Third"},{"active":true,"defaultValue":false,"label":"4th","validFor":null,"value":"Fourth"},{"active":true,"defaultValue":false,"label":"last","validFor":null,"value":"Last"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Recurrence Month of Year","name":"RecurrenceMonthOfYear","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"January","validFor":null,"value":"January"},{"active":true,"defaultValue":false,"label":"February","validFor":null,"value":"February"},{"active":true,"defaultValue":false,"label":"March","validFor":null,"value":"March"},{"active":true,"defaultValue":false,"label":"April","validFor":null,"value":"April"},{"active":true,"defaultValue":false,"label":"May","validFor":null,"value":"May"},{"active":true,"defaultValue":false,"label":"June","validFor":null,"value":"June"},{"active":true,"defaultValue":false,"label":"July","validFor":null,"value":"July"},{"active":true,"defaultValue":false,"label":"August","validFor":null,"value":"August"},{"active":true,"defaultValue":false,"label":"September","validFor":null,"value":"September"},{"active":true,"defaultValue":false,"label":"October","validFor":null,"value":"October"},{"active":true,"defaultValue":false,"label":"November","validFor":null,"value":"November"},{"active":true,"defaultValue":false,"label":"December","validFor":null,"value":"December"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Repeat This Task","name":"RecurrenceRegeneratedType","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"After due date","validFor":null,"value":"RecurrenceRegenerateAfterDueDate"},{"active":true,"defaultValue":false,"label":"After date completed","validFor":null,"value":"RecurrenceRegenerateAfterToday"},{"active":true,"defaultValue":false,"label":"(Task Closed)","validFor":null,"value":"RecurrenceRegenerated"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Task Subtype","name":"TaskSubtype","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Task","validFor":null,"value":"Task"},{"active":true,"defaultValue":false,"label":"Email","validFor":null,"value":"Email"},{"active":true,"defaultValue":false,"label":"List Email","validFor":null,"value":"ListEmail"},{"active":true,"defaultValue":false,"label":"Cadence","validFor":null,"value":"Cadence"},{"active":true,"defaultValue":false,"label":"Call","validFor":null,"value":"Call"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Completed Date","name":"CompletedDateTime","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"}],"childRelationships":[{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"Attachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Attachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Task","deprecatedAndHidden":false,"field":"RecurrenceActivityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecurringTasks","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TaskFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"TopicAssignment","deprecatedAndHidden":false,"field":"EntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"TopicAssignments","restrictedDelete":false}],"label":"Task","custom":false,"name":"Task","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/User.json b/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/User.json deleted file mode 100644 index afa204af2f..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/soqlMetadata/standardObjects/User.json +++ /dev/null @@ -1 +0,0 @@ -{"fields":[{"label":"User ID","name":"Id","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"id"},{"label":"Username","name":"Username","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Last Name","name":"LastName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"First Name","name":"FirstName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Full Name","name":"Name","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Company Name","name":"CompanyName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Division","name":"Division","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Department","name":"Department","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Title","name":"Title","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Street","name":"Street","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"City","name":"City","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"State/Province","name":"State","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Zip/Postal Code","name":"PostalCode","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Country","name":"Country","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Latitude","name":"Latitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Longitude","name":"Longitude","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"double"},{"label":"Geocode Accuracy","name":"GeocodeAccuracy","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Address","validFor":null,"value":"Address"},{"active":true,"defaultValue":false,"label":"NearAddress","validFor":null,"value":"NearAddress"},{"active":true,"defaultValue":false,"label":"Block","validFor":null,"value":"Block"},{"active":true,"defaultValue":false,"label":"Street","validFor":null,"value":"Street"},{"active":true,"defaultValue":false,"label":"ExtendedZip","validFor":null,"value":"ExtendedZip"},{"active":true,"defaultValue":false,"label":"Zip","validFor":null,"value":"Zip"},{"active":true,"defaultValue":false,"label":"Neighborhood","validFor":null,"value":"Neighborhood"},{"active":true,"defaultValue":false,"label":"City","validFor":null,"value":"City"},{"active":true,"defaultValue":false,"label":"County","validFor":null,"value":"County"},{"active":true,"defaultValue":false,"label":"State","validFor":null,"value":"State"},{"active":true,"defaultValue":false,"label":"Unknown","validFor":null,"value":"Unknown"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Address","name":"Address","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"address"},{"label":"Email","name":"Email","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"email"},{"label":"AutoBcc","name":"EmailPreferencesAutoBcc","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"AutoBccStayInTouch","name":"EmailPreferencesAutoBccStayInTouch","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"StayInTouchReminder","name":"EmailPreferencesStayInTouchReminder","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"Email Sender Address","name":"SenderEmail","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"email"},{"label":"Email Sender Name","name":"SenderName","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Email Signature","name":"Signature","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Stay-in-Touch Email Subject","name":"StayInTouchSubject","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Stay-in-Touch Email Signature","name":"StayInTouchSignature","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Stay-in-Touch Email Note","name":"StayInTouchNote","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Phone","name":"Phone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Fax","name":"Fax","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Mobile","name":"MobilePhone","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"Alias","name":"Alias","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Nickname","name":"CommunityNickname","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"User Photo badge text overlay","name":"BadgeText","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Active","name":"IsActive","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Time Zone","name":"TimeZoneSidKey","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"(GMT+14:00) Line Islands Time (Pacific/Kiritimati)","validFor":null,"value":"Pacific/Kiritimati"},{"active":true,"defaultValue":false,"label":"(GMT+13:00) Phoenix Islands Time (Pacific/Enderbury)","validFor":null,"value":"Pacific/Enderbury"},{"active":true,"defaultValue":false,"label":"(GMT+13:00) Tonga Standard Time (Pacific/Tongatapu)","validFor":null,"value":"Pacific/Tongatapu"},{"active":true,"defaultValue":false,"label":"(GMT+12:45) Chatham Standard Time (Pacific/Chatham)","validFor":null,"value":"Pacific/Chatham"},{"active":true,"defaultValue":false,"label":"(GMT+12:00) Petropavlovsk-Kamchatski Standard Time (Asia/Kamchatka)","validFor":null,"value":"Asia/Kamchatka"},{"active":true,"defaultValue":false,"label":"(GMT+12:00) New Zealand Standard Time (Pacific/Auckland)","validFor":null,"value":"Pacific/Auckland"},{"active":true,"defaultValue":false,"label":"(GMT+12:00) Fiji Standard Time (Pacific/Fiji)","validFor":null,"value":"Pacific/Fiji"},{"active":true,"defaultValue":false,"label":"(GMT+11:00) Solomon Islands Time (Pacific/Guadalcanal)","validFor":null,"value":"Pacific/Guadalcanal"},{"active":true,"defaultValue":false,"label":"(GMT+11:00) Norfolk Island Time (Pacific/Norfolk)","validFor":null,"value":"Pacific/Norfolk"},{"active":true,"defaultValue":false,"label":"(GMT+10:30) Lord Howe Standard Time (Australia/Lord_Howe)","validFor":null,"value":"Australia/Lord_Howe"},{"active":true,"defaultValue":false,"label":"(GMT+10:00) Australian Eastern Standard Time (Australia/Brisbane)","validFor":null,"value":"Australia/Brisbane"},{"active":true,"defaultValue":false,"label":"(GMT+10:00) Australian Eastern Standard Time (Australia/Sydney)","validFor":null,"value":"Australia/Sydney"},{"active":true,"defaultValue":false,"label":"(GMT+09:30) Australian Central Standard Time (Australia/Adelaide)","validFor":null,"value":"Australia/Adelaide"},{"active":true,"defaultValue":false,"label":"(GMT+09:30) Australian Central Standard Time (Australia/Darwin)","validFor":null,"value":"Australia/Darwin"},{"active":true,"defaultValue":false,"label":"(GMT+09:00) Korean Standard Time (Asia/Seoul)","validFor":null,"value":"Asia/Seoul"},{"active":true,"defaultValue":false,"label":"(GMT+09:00) Japan Standard Time (Asia/Tokyo)","validFor":null,"value":"Asia/Tokyo"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Hong Kong Standard Time (Asia/Hong_Kong)","validFor":null,"value":"Asia/Hong_Kong"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Malaysia Time (Asia/Kuala_Lumpur)","validFor":null,"value":"Asia/Kuala_Lumpur"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Philippine Standard Time (Asia/Manila)","validFor":null,"value":"Asia/Manila"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) China Standard Time (Asia/Shanghai)","validFor":null,"value":"Asia/Shanghai"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Singapore Standard Time (Asia/Singapore)","validFor":null,"value":"Asia/Singapore"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Taipei Standard Time (Asia/Taipei)","validFor":null,"value":"Asia/Taipei"},{"active":true,"defaultValue":false,"label":"(GMT+08:00) Australian Western Standard Time (Australia/Perth)","validFor":null,"value":"Australia/Perth"},{"active":true,"defaultValue":false,"label":"(GMT+07:00) Indochina Time (Asia/Bangkok)","validFor":null,"value":"Asia/Bangkok"},{"active":true,"defaultValue":false,"label":"(GMT+07:00) Indochina Time (Asia/Ho_Chi_Minh)","validFor":null,"value":"Asia/Ho_Chi_Minh"},{"active":true,"defaultValue":false,"label":"(GMT+07:00) Western Indonesia Time (Asia/Jakarta)","validFor":null,"value":"Asia/Jakarta"},{"active":true,"defaultValue":false,"label":"(GMT+06:30) Myanmar Time (Asia/Rangoon)","validFor":null,"value":"Asia/Rangoon"},{"active":true,"defaultValue":false,"label":"(GMT+06:00) Bangladesh Standard Time (Asia/Dhaka)","validFor":null,"value":"Asia/Dhaka"},{"active":true,"defaultValue":false,"label":"(GMT+05:45) Nepal Time (Asia/Kathmandu)","validFor":null,"value":"Asia/Kathmandu"},{"active":true,"defaultValue":false,"label":"(GMT+05:30) India Standard Time (Asia/Colombo)","validFor":null,"value":"Asia/Colombo"},{"active":true,"defaultValue":false,"label":"(GMT+05:30) India Standard Time (Asia/Kolkata)","validFor":null,"value":"Asia/Kolkata"},{"active":true,"defaultValue":false,"label":"(GMT+05:00) Pakistan Standard Time (Asia/Karachi)","validFor":null,"value":"Asia/Karachi"},{"active":true,"defaultValue":false,"label":"(GMT+05:00) Uzbekistan Standard Time (Asia/Tashkent)","validFor":null,"value":"Asia/Tashkent"},{"active":true,"defaultValue":false,"label":"(GMT+05:00) Yekaterinburg Standard Time (Asia/Yekaterinburg)","validFor":null,"value":"Asia/Yekaterinburg"},{"active":true,"defaultValue":false,"label":"(GMT+04:30) Afghanistan Time (Asia/Kabul)","validFor":null,"value":"Asia/Kabul"},{"active":true,"defaultValue":false,"label":"(GMT+04:30) Iran Daylight Time (Asia/Tehran)","validFor":null,"value":"Asia/Tehran"},{"active":true,"defaultValue":false,"label":"(GMT+04:00) Azerbaijan Standard Time (Asia/Baku)","validFor":null,"value":"Asia/Baku"},{"active":true,"defaultValue":false,"label":"(GMT+04:00) Gulf Standard Time (Asia/Dubai)","validFor":null,"value":"Asia/Dubai"},{"active":true,"defaultValue":false,"label":"(GMT+04:00) Georgia Standard Time (Asia/Tbilisi)","validFor":null,"value":"Asia/Tbilisi"},{"active":true,"defaultValue":false,"label":"(GMT+04:00) Armenia Standard Time (Asia/Yerevan)","validFor":null,"value":"Asia/Yerevan"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) East Africa Time (Africa/Nairobi)","validFor":null,"value":"Africa/Nairobi"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Arabian Standard Time (Asia/Baghdad)","validFor":null,"value":"Asia/Baghdad"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Summer Time (Asia/Beirut)","validFor":null,"value":"Asia/Beirut"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Israel Daylight Time (Asia/Jerusalem)","validFor":null,"value":"Asia/Jerusalem"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Arabian Standard Time (Asia/Kuwait)","validFor":null,"value":"Asia/Kuwait"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Arabian Standard Time (Asia/Riyadh)","validFor":null,"value":"Asia/Riyadh"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Summer Time (Europe/Athens)","validFor":null,"value":"Europe/Athens"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Summer Time (Europe/Bucharest)","validFor":null,"value":"Europe/Bucharest"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Summer Time (Europe/Helsinki)","validFor":null,"value":"Europe/Helsinki"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Eastern European Standard Time (Europe/Istanbul)","validFor":null,"value":"Europe/Istanbul"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Moscow Standard Time (Europe/Minsk)","validFor":null,"value":"Europe/Minsk"},{"active":true,"defaultValue":false,"label":"(GMT+03:00) Moscow Standard Time (Europe/Moscow)","validFor":null,"value":"Europe/Moscow"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Eastern European Standard Time (Africa/Cairo)","validFor":null,"value":"Africa/Cairo"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) South Africa Standard Time (Africa/Johannesburg)","validFor":null,"value":"Africa/Johannesburg"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Amsterdam)","validFor":null,"value":"Europe/Amsterdam"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Berlin)","validFor":null,"value":"Europe/Berlin"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Brussels)","validFor":null,"value":"Europe/Brussels"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Paris)","validFor":null,"value":"Europe/Paris"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Prague)","validFor":null,"value":"Europe/Prague"},{"active":true,"defaultValue":false,"label":"(GMT+02:00) Central European Summer Time (Europe/Rome)","validFor":null,"value":"Europe/Rome"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) Central European Standard Time (Africa/Algiers)","validFor":null,"value":"Africa/Algiers"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) Western European Summer Time (Africa/Casablanca)","validFor":null,"value":"Africa/Casablanca"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) Irish Standard Time (Europe/Dublin)","validFor":null,"value":"Europe/Dublin"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) Western European Summer Time (Europe/Lisbon)","validFor":null,"value":"Europe/Lisbon"},{"active":true,"defaultValue":false,"label":"(GMT+01:00) British Summer Time (Europe/London)","validFor":null,"value":"Europe/London"},{"active":true,"defaultValue":false,"label":"(GMT+00:00) East Greenland Summer Time (America/Scoresbysund)","validFor":null,"value":"America/Scoresbysund"},{"active":true,"defaultValue":false,"label":"(GMT+00:00) Azores Summer Time (Atlantic/Azores)","validFor":null,"value":"Atlantic/Azores"},{"active":true,"defaultValue":false,"label":"(GMT+00:00) Greenwich Mean Time (GMT)","validFor":null,"value":"GMT"},{"active":true,"defaultValue":false,"label":"(GMT-01:00) Cape Verde Standard Time (Atlantic/Cape_Verde)","validFor":null,"value":"Atlantic/Cape_Verde"},{"active":true,"defaultValue":false,"label":"(GMT-02:00) South Georgia Time (Atlantic/South_Georgia)","validFor":null,"value":"Atlantic/South_Georgia"},{"active":true,"defaultValue":false,"label":"(GMT-02:30) Newfoundland Daylight Time (America/St_Johns)","validFor":null,"value":"America/St_Johns"},{"active":true,"defaultValue":false,"label":"(GMT-03:00) Argentina Standard Time (America/Argentina/Buenos_Aires)","validFor":null,"value":"America/Argentina/Buenos_Aires"},{"active":true,"defaultValue":false,"label":"(GMT-03:00) Atlantic Daylight Time (America/Halifax)","validFor":null,"value":"America/Halifax"},{"active":true,"defaultValue":false,"label":"(GMT-03:00) Brasilia Standard Time (America/Sao_Paulo)","validFor":null,"value":"America/Sao_Paulo"},{"active":true,"defaultValue":false,"label":"(GMT-03:00) Atlantic Daylight Time (Atlantic/Bermuda)","validFor":null,"value":"Atlantic/Bermuda"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Venezuela Time (America/Caracas)","validFor":null,"value":"America/Caracas"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Eastern Daylight Time (America/Indiana/Indianapolis)","validFor":null,"value":"America/Indiana/Indianapolis"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Eastern Daylight Time (America/New_York)","validFor":null,"value":"America/New_York"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Atlantic Standard Time (America/Puerto_Rico)","validFor":null,"value":"America/Puerto_Rico"},{"active":true,"defaultValue":false,"label":"(GMT-04:00) Chile Standard Time (America/Santiago)","validFor":null,"value":"America/Santiago"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Colombia Standard Time (America/Bogota)","validFor":null,"value":"America/Bogota"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Central Daylight Time (America/Chicago)","validFor":null,"value":"America/Chicago"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Peru Standard Time (America/Lima)","validFor":null,"value":"America/Lima"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Central Daylight Time (America/Mexico_City)","validFor":null,"value":"America/Mexico_City"},{"active":true,"defaultValue":false,"label":"(GMT-05:00) Eastern Standard Time (America/Panama)","validFor":null,"value":"America/Panama"},{"active":true,"defaultValue":false,"label":"(GMT-06:00) Mountain Daylight Time (America/Denver)","validFor":null,"value":"America/Denver"},{"active":true,"defaultValue":false,"label":"(GMT-06:00) Central Standard Time (America/El_Salvador)","validFor":null,"value":"America/El_Salvador"},{"active":true,"defaultValue":false,"label":"(GMT-06:00) Mexican Pacific Daylight Time (America/Mazatlan)","validFor":null,"value":"America/Mazatlan"},{"active":true,"defaultValue":false,"label":"(GMT-07:00) Pacific Daylight Time (America/Los_Angeles)","validFor":null,"value":"America/Los_Angeles"},{"active":true,"defaultValue":false,"label":"(GMT-07:00) Mountain Standard Time (America/Phoenix)","validFor":null,"value":"America/Phoenix"},{"active":true,"defaultValue":false,"label":"(GMT-07:00) Pacific Daylight Time (America/Tijuana)","validFor":null,"value":"America/Tijuana"},{"active":true,"defaultValue":false,"label":"(GMT-08:00) Alaska Daylight Time (America/Anchorage)","validFor":null,"value":"America/Anchorage"},{"active":true,"defaultValue":false,"label":"(GMT-08:00) Pitcairn Time (Pacific/Pitcairn)","validFor":null,"value":"Pacific/Pitcairn"},{"active":true,"defaultValue":false,"label":"(GMT-09:00) Hawaii-Aleutian Daylight Time (America/Adak)","validFor":null,"value":"America/Adak"},{"active":true,"defaultValue":false,"label":"(GMT-09:00) Gambier Time (Pacific/Gambier)","validFor":null,"value":"Pacific/Gambier"},{"active":true,"defaultValue":false,"label":"(GMT-09:30) Marquesas Time (Pacific/Marquesas)","validFor":null,"value":"Pacific/Marquesas"},{"active":true,"defaultValue":false,"label":"(GMT-10:00) Hawaii-Aleutian Standard Time (Pacific/Honolulu)","validFor":null,"value":"Pacific/Honolulu"},{"active":true,"defaultValue":false,"label":"(GMT-11:00) Niue Time (Pacific/Niue)","validFor":null,"value":"Pacific/Niue"},{"active":true,"defaultValue":false,"label":"(GMT-11:00) Samoa Standard Time (Pacific/Pago_Pago)","validFor":null,"value":"Pacific/Pago_Pago"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Role ID","name":"UserRoleId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"UserRole","referenceTo":["UserRole"],"sortable":true,"type":"reference"},{"label":"Locale","name":"LocaleSidKey","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Afrikaans (South Africa)","validFor":null,"value":"af_ZA"},{"active":true,"defaultValue":false,"label":"Albanian (Albania)","validFor":null,"value":"sq_AL"},{"active":true,"defaultValue":false,"label":"Amharic (Ethiopia)","validFor":null,"value":"am_ET"},{"active":true,"defaultValue":false,"label":"Arabic (Algeria)","validFor":null,"value":"ar_DZ"},{"active":true,"defaultValue":false,"label":"Arabic (Bahrain)","validFor":null,"value":"ar_BH"},{"active":true,"defaultValue":false,"label":"Arabic (Egypt)","validFor":null,"value":"ar_EG"},{"active":true,"defaultValue":false,"label":"Arabic (Iraq)","validFor":null,"value":"ar_IQ"},{"active":true,"defaultValue":false,"label":"Arabic (Jordan)","validFor":null,"value":"ar_JO"},{"active":true,"defaultValue":false,"label":"Arabic (Kuwait)","validFor":null,"value":"ar_KW"},{"active":true,"defaultValue":false,"label":"Arabic (Lebanon)","validFor":null,"value":"ar_LB"},{"active":true,"defaultValue":false,"label":"Arabic (Libya)","validFor":null,"value":"ar_LY"},{"active":true,"defaultValue":false,"label":"Arabic (Morocco)","validFor":null,"value":"ar_MA"},{"active":true,"defaultValue":false,"label":"Arabic (Oman)","validFor":null,"value":"ar_OM"},{"active":true,"defaultValue":false,"label":"Arabic (Qatar)","validFor":null,"value":"ar_QA"},{"active":true,"defaultValue":false,"label":"Arabic (Saudi Arabia)","validFor":null,"value":"ar_SA"},{"active":true,"defaultValue":false,"label":"Arabic (Sudan)","validFor":null,"value":"ar_SD"},{"active":true,"defaultValue":false,"label":"Arabic (Syria)","validFor":null,"value":"ar_SY"},{"active":true,"defaultValue":false,"label":"Arabic (Tunisia)","validFor":null,"value":"ar_TN"},{"active":true,"defaultValue":false,"label":"Arabic (United Arab Emirates)","validFor":null,"value":"ar_AE"},{"active":true,"defaultValue":false,"label":"Arabic (Yemen)","validFor":null,"value":"ar_YE"},{"active":true,"defaultValue":false,"label":"Armenian (Armenia)","validFor":null,"value":"hy_AM"},{"active":true,"defaultValue":false,"label":"Azerbaijani (Azerbaijan)","validFor":null,"value":"az_AZ"},{"active":true,"defaultValue":false,"label":"Bangla (Bangladesh)","validFor":null,"value":"bn_BD"},{"active":true,"defaultValue":false,"label":"Bangla (India)","validFor":null,"value":"bn_IN"},{"active":true,"defaultValue":false,"label":"Basque (Spain)","validFor":null,"value":"eu_ES"},{"active":true,"defaultValue":false,"label":"Belarusian (Belarus)","validFor":null,"value":"be_BY"},{"active":true,"defaultValue":false,"label":"Bosnian (Bosnia & Herzegovina)","validFor":null,"value":"bs_BA"},{"active":true,"defaultValue":false,"label":"Bulgarian (Bulgaria)","validFor":null,"value":"bg_BG"},{"active":true,"defaultValue":false,"label":"Burmese (Myanmar (Burma))","validFor":null,"value":"my_MM"},{"active":true,"defaultValue":false,"label":"Catalan (Spain)","validFor":null,"value":"ca_ES"},{"active":true,"defaultValue":false,"label":"Chinese (China, Pinyin Ordering)","validFor":null,"value":"zh_CN_PINYIN"},{"active":true,"defaultValue":false,"label":"Chinese (China, Stroke Ordering)","validFor":null,"value":"zh_CN_STROKE"},{"active":true,"defaultValue":false,"label":"Chinese (China)","validFor":null,"value":"zh_CN"},{"active":true,"defaultValue":false,"label":"Chinese (Hong Kong SAR China, Stroke Ordering)","validFor":null,"value":"zh_HK_STROKE"},{"active":true,"defaultValue":false,"label":"Chinese (Hong Kong SAR China)","validFor":null,"value":"zh_HK"},{"active":true,"defaultValue":false,"label":"Chinese (Macao SAR China)","validFor":null,"value":"zh_MO"},{"active":true,"defaultValue":false,"label":"Chinese (Singapore)","validFor":null,"value":"zh_SG"},{"active":true,"defaultValue":false,"label":"Chinese (Taiwan, Stroke Ordering)","validFor":null,"value":"zh_TW_STROKE"},{"active":true,"defaultValue":false,"label":"Chinese (Taiwan)","validFor":null,"value":"zh_TW"},{"active":true,"defaultValue":false,"label":"Croatian (Croatia)","validFor":null,"value":"hr_HR"},{"active":true,"defaultValue":false,"label":"Czech (Czechia)","validFor":null,"value":"cs_CZ"},{"active":true,"defaultValue":false,"label":"Danish (Denmark)","validFor":null,"value":"da_DK"},{"active":true,"defaultValue":false,"label":"Dutch (Aruba)","validFor":null,"value":"nl_AW"},{"active":true,"defaultValue":false,"label":"Dutch (Belgium)","validFor":null,"value":"nl_BE"},{"active":true,"defaultValue":false,"label":"Dutch (Netherlands)","validFor":null,"value":"nl_NL"},{"active":true,"defaultValue":false,"label":"Dutch (Suriname)","validFor":null,"value":"nl_SR"},{"active":true,"defaultValue":false,"label":"Dzongkha (Bhutan)","validFor":null,"value":"dz_BT"},{"active":true,"defaultValue":false,"label":"English (Antigua & Barbuda)","validFor":null,"value":"en_AG"},{"active":true,"defaultValue":false,"label":"English (Australia)","validFor":null,"value":"en_AU"},{"active":true,"defaultValue":false,"label":"English (Bahamas)","validFor":null,"value":"en_BS"},{"active":true,"defaultValue":false,"label":"English (Barbados)","validFor":null,"value":"en_BB"},{"active":true,"defaultValue":false,"label":"English (Belize)","validFor":null,"value":"en_BZ"},{"active":true,"defaultValue":false,"label":"English (Bermuda)","validFor":null,"value":"en_BM"},{"active":true,"defaultValue":false,"label":"English (Botswana)","validFor":null,"value":"en_BW"},{"active":true,"defaultValue":false,"label":"English (Cameroon)","validFor":null,"value":"en_CM"},{"active":true,"defaultValue":false,"label":"English (Canada)","validFor":null,"value":"en_CA"},{"active":true,"defaultValue":false,"label":"English (Cayman Islands)","validFor":null,"value":"en_KY"},{"active":true,"defaultValue":false,"label":"English (Eritrea)","validFor":null,"value":"en_ER"},{"active":true,"defaultValue":false,"label":"English (Eswatini)","validFor":null,"value":"en_SZ"},{"active":true,"defaultValue":false,"label":"English (Falkland Islands)","validFor":null,"value":"en_FK"},{"active":true,"defaultValue":false,"label":"English (Fiji)","validFor":null,"value":"en_FJ"},{"active":true,"defaultValue":false,"label":"English (Gambia)","validFor":null,"value":"en_GM"},{"active":true,"defaultValue":false,"label":"English (Ghana)","validFor":null,"value":"en_GH"},{"active":true,"defaultValue":false,"label":"English (Gibraltar)","validFor":null,"value":"en_GI"},{"active":true,"defaultValue":false,"label":"English (Guyana)","validFor":null,"value":"en_GY"},{"active":true,"defaultValue":false,"label":"English (Hong Kong SAR China)","validFor":null,"value":"en_HK"},{"active":true,"defaultValue":false,"label":"English (India)","validFor":null,"value":"en_IN"},{"active":true,"defaultValue":false,"label":"English (Indonesia)","validFor":null,"value":"en_ID"},{"active":true,"defaultValue":false,"label":"English (Ireland)","validFor":null,"value":"en_IE"},{"active":true,"defaultValue":false,"label":"English (Jamaica)","validFor":null,"value":"en_JM"},{"active":true,"defaultValue":false,"label":"English (Kenya)","validFor":null,"value":"en_KE"},{"active":true,"defaultValue":false,"label":"English (Liberia)","validFor":null,"value":"en_LR"},{"active":true,"defaultValue":false,"label":"English (Madagascar)","validFor":null,"value":"en_MG"},{"active":true,"defaultValue":false,"label":"English (Malawi)","validFor":null,"value":"en_MW"},{"active":true,"defaultValue":false,"label":"English (Malaysia)","validFor":null,"value":"en_MY"},{"active":true,"defaultValue":false,"label":"English (Mauritius)","validFor":null,"value":"en_MU"},{"active":true,"defaultValue":false,"label":"English (Namibia)","validFor":null,"value":"en_NA"},{"active":true,"defaultValue":false,"label":"English (New Zealand)","validFor":null,"value":"en_NZ"},{"active":true,"defaultValue":false,"label":"English (Nigeria)","validFor":null,"value":"en_NG"},{"active":true,"defaultValue":false,"label":"English (Pakistan)","validFor":null,"value":"en_PK"},{"active":true,"defaultValue":false,"label":"English (Papua New Guinea)","validFor":null,"value":"en_PG"},{"active":true,"defaultValue":false,"label":"English (Philippines)","validFor":null,"value":"en_PH"},{"active":true,"defaultValue":false,"label":"English (Rwanda)","validFor":null,"value":"en_RW"},{"active":true,"defaultValue":false,"label":"English (Samoa)","validFor":null,"value":"en_WS"},{"active":true,"defaultValue":false,"label":"English (Seychelles)","validFor":null,"value":"en_SC"},{"active":true,"defaultValue":false,"label":"English (Sierra Leone)","validFor":null,"value":"en_SL"},{"active":true,"defaultValue":false,"label":"English (Singapore)","validFor":null,"value":"en_SG"},{"active":true,"defaultValue":false,"label":"English (Sint Maarten)","validFor":null,"value":"en_SX"},{"active":true,"defaultValue":false,"label":"English (Solomon Islands)","validFor":null,"value":"en_SB"},{"active":true,"defaultValue":false,"label":"English (South Africa)","validFor":null,"value":"en_ZA"},{"active":true,"defaultValue":false,"label":"English (St. Helena)","validFor":null,"value":"en_SH"},{"active":true,"defaultValue":false,"label":"English (Tanzania)","validFor":null,"value":"en_TZ"},{"active":true,"defaultValue":false,"label":"English (Tonga)","validFor":null,"value":"en_TO"},{"active":true,"defaultValue":false,"label":"English (Trinidad & Tobago)","validFor":null,"value":"en_TT"},{"active":true,"defaultValue":false,"label":"English (Uganda)","validFor":null,"value":"en_UG"},{"active":true,"defaultValue":false,"label":"English (United Kingdom)","validFor":null,"value":"en_GB"},{"active":true,"defaultValue":false,"label":"English (United States)","validFor":null,"value":"en_US"},{"active":true,"defaultValue":false,"label":"English (Vanuatu)","validFor":null,"value":"en_VU"},{"active":true,"defaultValue":false,"label":"Estonian (Estonia)","validFor":null,"value":"et_EE"},{"active":true,"defaultValue":false,"label":"Finnish (Finland)","validFor":null,"value":"fi_FI"},{"active":true,"defaultValue":false,"label":"French (Belgium)","validFor":null,"value":"fr_BE"},{"active":true,"defaultValue":false,"label":"French (Canada)","validFor":null,"value":"fr_CA"},{"active":true,"defaultValue":false,"label":"French (Comoros)","validFor":null,"value":"fr_KM"},{"active":true,"defaultValue":false,"label":"French (France)","validFor":null,"value":"fr_FR"},{"active":true,"defaultValue":false,"label":"French (Guinea)","validFor":null,"value":"fr_GN"},{"active":true,"defaultValue":false,"label":"French (Haiti)","validFor":null,"value":"fr_HT"},{"active":true,"defaultValue":false,"label":"French (Luxembourg)","validFor":null,"value":"fr_LU"},{"active":true,"defaultValue":false,"label":"French (Mauritania)","validFor":null,"value":"fr_MR"},{"active":true,"defaultValue":false,"label":"French (Monaco)","validFor":null,"value":"fr_MC"},{"active":true,"defaultValue":false,"label":"French (Switzerland)","validFor":null,"value":"fr_CH"},{"active":true,"defaultValue":false,"label":"French (Wallis & Futuna)","validFor":null,"value":"fr_WF"},{"active":true,"defaultValue":false,"label":"Georgian (Georgia)","validFor":null,"value":"ka_GE"},{"active":true,"defaultValue":false,"label":"German (Austria)","validFor":null,"value":"de_AT"},{"active":true,"defaultValue":false,"label":"German (Belgium)","validFor":null,"value":"de_BE"},{"active":true,"defaultValue":false,"label":"German (Germany)","validFor":null,"value":"de_DE"},{"active":true,"defaultValue":false,"label":"German (Luxembourg)","validFor":null,"value":"de_LU"},{"active":true,"defaultValue":false,"label":"German (Switzerland)","validFor":null,"value":"de_CH"},{"active":true,"defaultValue":false,"label":"Greek (Greece)","validFor":null,"value":"el_GR"},{"active":true,"defaultValue":false,"label":"Gujarati (India)","validFor":null,"value":"gu_IN"},{"active":true,"defaultValue":false,"label":"Hebrew (Israel)","validFor":null,"value":"iw_IL"},{"active":true,"defaultValue":false,"label":"Hindi (India)","validFor":null,"value":"hi_IN"},{"active":true,"defaultValue":false,"label":"Hungarian (Hungary)","validFor":null,"value":"hu_HU"},{"active":true,"defaultValue":false,"label":"Icelandic (Iceland)","validFor":null,"value":"is_IS"},{"active":true,"defaultValue":false,"label":"Indonesian (Indonesia)","validFor":null,"value":"in_ID"},{"active":true,"defaultValue":false,"label":"Irish (Ireland)","validFor":null,"value":"ga_IE"},{"active":true,"defaultValue":false,"label":"Italian (Italy)","validFor":null,"value":"it_IT"},{"active":true,"defaultValue":false,"label":"Italian (Switzerland)","validFor":null,"value":"it_CH"},{"active":true,"defaultValue":false,"label":"Japanese (Japan)","validFor":null,"value":"ja_JP"},{"active":true,"defaultValue":false,"label":"Kannada (India)","validFor":null,"value":"kn_IN"},{"active":true,"defaultValue":false,"label":"Kazakh (Kazakhstan)","validFor":null,"value":"kk_KZ"},{"active":true,"defaultValue":false,"label":"Khmer (Cambodia)","validFor":null,"value":"km_KH"},{"active":true,"defaultValue":false,"label":"Korean (North Korea)","validFor":null,"value":"ko_KP"},{"active":true,"defaultValue":false,"label":"Korean (South Korea)","validFor":null,"value":"ko_KR"},{"active":true,"defaultValue":false,"label":"Kyrgyz (Kyrgyzstan)","validFor":null,"value":"ky_KG"},{"active":true,"defaultValue":false,"label":"Lao (Laos)","validFor":null,"value":"lo_LA"},{"active":true,"defaultValue":false,"label":"Latvian (Latvia)","validFor":null,"value":"lv_LV"},{"active":true,"defaultValue":false,"label":"Lithuanian (Lithuania)","validFor":null,"value":"lt_LT"},{"active":true,"defaultValue":false,"label":"Luba-Katanga (Congo - Kinshasa)","validFor":null,"value":"lu_CD"},{"active":true,"defaultValue":false,"label":"Luxembourgish (Luxembourg)","validFor":null,"value":"lb_LU"},{"active":true,"defaultValue":false,"label":"Macedonian (North Macedonia)","validFor":null,"value":"mk_MK"},{"active":true,"defaultValue":false,"label":"Malay (Brunei)","validFor":null,"value":"ms_BN"},{"active":true,"defaultValue":false,"label":"Malay (Malaysia)","validFor":null,"value":"ms_MY"},{"active":true,"defaultValue":false,"label":"Malayalam (India)","validFor":null,"value":"ml_IN"},{"active":true,"defaultValue":false,"label":"Maltese (Malta)","validFor":null,"value":"mt_MT"},{"active":true,"defaultValue":false,"label":"Marathi (India)","validFor":null,"value":"mr_IN"},{"active":true,"defaultValue":false,"label":"Montenegrin (Montenegro, USD)","validFor":null,"value":"sh_ME_USD"},{"active":true,"defaultValue":false,"label":"Montenegrin (Montenegro)","validFor":null,"value":"sh_ME"},{"active":true,"defaultValue":false,"label":"Nepali (Nepal)","validFor":null,"value":"ne_NP"},{"active":true,"defaultValue":false,"label":"Norwegian (Norway)","validFor":null,"value":"no_NO"},{"active":true,"defaultValue":false,"label":"Pashto (Afghanistan)","validFor":null,"value":"ps_AF"},{"active":true,"defaultValue":false,"label":"Persian (Iran)","validFor":null,"value":"fa_IR"},{"active":true,"defaultValue":false,"label":"Polish (Poland)","validFor":null,"value":"pl_PL"},{"active":true,"defaultValue":false,"label":"Portuguese (Angola)","validFor":null,"value":"pt_AO"},{"active":true,"defaultValue":false,"label":"Portuguese (Brazil)","validFor":null,"value":"pt_BR"},{"active":true,"defaultValue":false,"label":"Portuguese (Cape Verde)","validFor":null,"value":"pt_CV"},{"active":true,"defaultValue":false,"label":"Portuguese (Mozambique)","validFor":null,"value":"pt_MZ"},{"active":true,"defaultValue":false,"label":"Portuguese (Portugal)","validFor":null,"value":"pt_PT"},{"active":true,"defaultValue":false,"label":"Portuguese (São Tomé & Príncipe)","validFor":null,"value":"pt_ST"},{"active":true,"defaultValue":false,"label":"Romanian (Moldova)","validFor":null,"value":"ro_MD"},{"active":true,"defaultValue":false,"label":"Romanian (Romania)","validFor":null,"value":"ro_RO"},{"active":true,"defaultValue":false,"label":"Romansh (Switzerland)","validFor":null,"value":"rm_CH"},{"active":true,"defaultValue":false,"label":"Rundi (Burundi)","validFor":null,"value":"rn_BI"},{"active":true,"defaultValue":false,"label":"Russian (Kazakhstan)","validFor":null,"value":"ru_KZ"},{"active":true,"defaultValue":false,"label":"Russian (Russia)","validFor":null,"value":"ru_RU"},{"active":true,"defaultValue":false,"label":"Serbian (Cyrillic) (Bosnia and Herzegovina)","validFor":null,"value":"sr_BA"},{"active":true,"defaultValue":false,"label":"Serbian (Cyrillic) (Serbia)","validFor":null,"value":"sr_CS"},{"active":true,"defaultValue":false,"label":"Serbian (Latin) (Bosnia and Herzegovina)","validFor":null,"value":"sh_BA"},{"active":true,"defaultValue":false,"label":"Serbian (Latin) (Serbia)","validFor":null,"value":"sh_CS"},{"active":true,"defaultValue":false,"label":"Serbian (Serbia)","validFor":null,"value":"sr_RS"},{"active":true,"defaultValue":false,"label":"Slovak (Slovakia)","validFor":null,"value":"sk_SK"},{"active":true,"defaultValue":false,"label":"Slovenian (Slovenia)","validFor":null,"value":"sl_SI"},{"active":true,"defaultValue":false,"label":"Somali (Djibouti)","validFor":null,"value":"so_DJ"},{"active":true,"defaultValue":false,"label":"Somali (Somalia)","validFor":null,"value":"so_SO"},{"active":true,"defaultValue":false,"label":"Spanish (Argentina)","validFor":null,"value":"es_AR"},{"active":true,"defaultValue":false,"label":"Spanish (Bolivia)","validFor":null,"value":"es_BO"},{"active":true,"defaultValue":false,"label":"Spanish (Chile)","validFor":null,"value":"es_CL"},{"active":true,"defaultValue":false,"label":"Spanish (Colombia)","validFor":null,"value":"es_CO"},{"active":true,"defaultValue":false,"label":"Spanish (Costa Rica)","validFor":null,"value":"es_CR"},{"active":true,"defaultValue":false,"label":"Spanish (Cuba)","validFor":null,"value":"es_CU"},{"active":true,"defaultValue":false,"label":"Spanish (Dominican Republic)","validFor":null,"value":"es_DO"},{"active":true,"defaultValue":false,"label":"Spanish (Ecuador)","validFor":null,"value":"es_EC"},{"active":true,"defaultValue":false,"label":"Spanish (El Salvador)","validFor":null,"value":"es_SV"},{"active":true,"defaultValue":false,"label":"Spanish (Guatemala)","validFor":null,"value":"es_GT"},{"active":true,"defaultValue":false,"label":"Spanish (Honduras)","validFor":null,"value":"es_HN"},{"active":true,"defaultValue":false,"label":"Spanish (Mexico)","validFor":null,"value":"es_MX"},{"active":true,"defaultValue":false,"label":"Spanish (Nicaragua)","validFor":null,"value":"es_NI"},{"active":true,"defaultValue":false,"label":"Spanish (Panama)","validFor":null,"value":"es_PA"},{"active":true,"defaultValue":false,"label":"Spanish (Paraguay)","validFor":null,"value":"es_PY"},{"active":true,"defaultValue":false,"label":"Spanish (Peru)","validFor":null,"value":"es_PE"},{"active":true,"defaultValue":false,"label":"Spanish (Puerto Rico)","validFor":null,"value":"es_PR"},{"active":true,"defaultValue":false,"label":"Spanish (Spain)","validFor":null,"value":"es_ES"},{"active":true,"defaultValue":false,"label":"Spanish (United States)","validFor":null,"value":"es_US"},{"active":true,"defaultValue":false,"label":"Spanish (Uruguay)","validFor":null,"value":"es_UY"},{"active":true,"defaultValue":false,"label":"Spanish (Venezuela)","validFor":null,"value":"es_VE"},{"active":true,"defaultValue":false,"label":"Swahili (Kenya)","validFor":null,"value":"sw_KE"},{"active":true,"defaultValue":false,"label":"Swedish (Sweden)","validFor":null,"value":"sv_SE"},{"active":true,"defaultValue":false,"label":"Tagalog (Philippines)","validFor":null,"value":"tl_PH"},{"active":true,"defaultValue":false,"label":"Tajik (Tajikistan)","validFor":null,"value":"tg_TJ"},{"active":true,"defaultValue":false,"label":"Tamil (India)","validFor":null,"value":"ta_IN"},{"active":true,"defaultValue":false,"label":"Tamil (Sri Lanka)","validFor":null,"value":"ta_LK"},{"active":true,"defaultValue":false,"label":"Telugu (India)","validFor":null,"value":"te_IN"},{"active":true,"defaultValue":false,"label":"Te reo (New Zealand)","validFor":null,"value":"mi_NZ"},{"active":true,"defaultValue":false,"label":"Thai (Thailand)","validFor":null,"value":"th_TH"},{"active":true,"defaultValue":false,"label":"Tigrinya (Ethiopia)","validFor":null,"value":"ti_ET"},{"active":true,"defaultValue":false,"label":"Turkish (Turkey)","validFor":null,"value":"tr_TR"},{"active":true,"defaultValue":false,"label":"Ukrainian (Ukraine)","validFor":null,"value":"uk_UA"},{"active":true,"defaultValue":false,"label":"Urdu (Pakistan)","validFor":null,"value":"ur_PK"},{"active":true,"defaultValue":false,"label":"Uzbek (LATN,UZ)","validFor":null,"value":"uz_LATN_UZ"},{"active":true,"defaultValue":false,"label":"Vietnamese (Vietnam)","validFor":null,"value":"vi_VN"},{"active":true,"defaultValue":false,"label":"Welsh (United Kingdom)","validFor":null,"value":"cy_GB"},{"active":true,"defaultValue":false,"label":"Xhosa (South Africa)","validFor":null,"value":"xh_ZA"},{"active":true,"defaultValue":false,"label":"Yoruba (Benin)","validFor":null,"value":"yo_BJ"},{"active":true,"defaultValue":false,"label":"Zulu (South Africa)","validFor":null,"value":"zu_ZA"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Info Emails","name":"ReceivesInfoEmails","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Admin Info Emails","name":"ReceivesAdminInfoEmails","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Email Encoding","name":"EmailEncodingKey","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Unicode (UTF-8)","validFor":null,"value":"UTF-8"},{"active":true,"defaultValue":false,"label":"General US & Western Europe (ISO-8859-1, ISO-LATIN-1)","validFor":null,"value":"ISO-8859-1"},{"active":true,"defaultValue":false,"label":"Japanese (Shift-JIS)","validFor":null,"value":"Shift_JIS"},{"active":true,"defaultValue":false,"label":"Japanese (JIS)","validFor":null,"value":"ISO-2022-JP"},{"active":true,"defaultValue":false,"label":"Japanese (EUC)","validFor":null,"value":"EUC-JP"},{"active":true,"defaultValue":false,"label":"Korean (ks_c_5601-1987)","validFor":null,"value":"ks_c_5601-1987"},{"active":true,"defaultValue":false,"label":"Traditional Chinese (Big5)","validFor":null,"value":"Big5"},{"active":true,"defaultValue":false,"label":"Simplified Chinese (GB2312)","validFor":null,"value":"GB2312"},{"active":true,"defaultValue":false,"label":"Traditional Chinese Hong Kong (Big5-HKSCS)","validFor":null,"value":"Big5-HKSCS"},{"active":true,"defaultValue":false,"label":"Japanese (Shift-JIS_2004)","validFor":null,"value":"x-SJIS_0213"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Profile ID","name":"ProfileId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"Profile","referenceTo":["Profile"],"sortable":true,"type":"reference"},{"label":"User Type","name":"UserType","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[{"active":true,"defaultValue":false,"label":"Standard","validFor":null,"value":"Standard"},{"active":true,"defaultValue":false,"label":"Partner","validFor":null,"value":"PowerPartner"},{"active":true,"defaultValue":false,"label":"Customer Portal Manager","validFor":null,"value":"PowerCustomerSuccess"},{"active":true,"defaultValue":false,"label":"Customer Portal User","validFor":null,"value":"CustomerSuccess"},{"active":true,"defaultValue":false,"label":"Guest","validFor":null,"value":"Guest"},{"active":true,"defaultValue":false,"label":"High Volume Portal","validFor":null,"value":"CspLitePortal"},{"active":true,"defaultValue":false,"label":"CSN Only","validFor":null,"value":"CsnOnly"},{"active":true,"defaultValue":false,"label":"Self Service","validFor":null,"value":"SelfService"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Language","name":"LanguageLocaleKey","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"English","validFor":null,"value":"en_US"},{"active":true,"defaultValue":false,"label":"German","validFor":null,"value":"de"},{"active":true,"defaultValue":false,"label":"Spanish","validFor":null,"value":"es"},{"active":true,"defaultValue":false,"label":"French","validFor":null,"value":"fr"},{"active":true,"defaultValue":false,"label":"Italian","validFor":null,"value":"it"},{"active":true,"defaultValue":false,"label":"Japanese","validFor":null,"value":"ja"},{"active":true,"defaultValue":false,"label":"Swedish","validFor":null,"value":"sv"},{"active":true,"defaultValue":false,"label":"Korean","validFor":null,"value":"ko"},{"active":true,"defaultValue":false,"label":"Chinese (Traditional)","validFor":null,"value":"zh_TW"},{"active":true,"defaultValue":false,"label":"Chinese (Simplified)","validFor":null,"value":"zh_CN"},{"active":true,"defaultValue":false,"label":"Portuguese (Brazil)","validFor":null,"value":"pt_BR"},{"active":true,"defaultValue":false,"label":"Dutch","validFor":null,"value":"nl_NL"},{"active":true,"defaultValue":false,"label":"Danish","validFor":null,"value":"da"},{"active":true,"defaultValue":false,"label":"Thai","validFor":null,"value":"th"},{"active":true,"defaultValue":false,"label":"Finnish","validFor":null,"value":"fi"},{"active":true,"defaultValue":false,"label":"Russian","validFor":null,"value":"ru"},{"active":true,"defaultValue":false,"label":"Spanish (Mexico)","validFor":null,"value":"es_MX"},{"active":true,"defaultValue":false,"label":"Norwegian","validFor":null,"value":"no"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Employee Number","name":"EmployeeNumber","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Delegated Approver ID","name":"DelegatedApproverId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":["Group","User"],"sortable":true,"type":"reference"},{"label":"Manager ID","name":"ManagerId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Manager","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Login","name":"LastLoginDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Password Change or Reset","name":"LastPasswordChangeDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created Date","name":"CreatedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Created By ID","name":"CreatedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"CreatedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"Last Modified Date","name":"LastModifiedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Modified By ID","name":"LastModifiedById","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":"LastModifiedBy","referenceTo":["User"],"sortable":true,"type":"reference"},{"label":"System Modstamp","name":"SystemModstamp","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Failed Login Attempts","name":"NumberOfFailedLogins","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"int"},{"label":"Offline Edition Trial Expiration Date","name":"OfflineTrialExpirationDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Sales Anywhere Trial Expiration Date","name":"OfflinePdaTrialExpirationDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Marketing User","name":"UserPermissionsMarketingUser","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"Offline User","name":"UserPermissionsOfflineUser","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"AvantGo User","name":"UserPermissionsAvantgoUser","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"Auto-login To Call Center","name":"UserPermissionsCallCenterAutoLogin","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"Salesforce CRM Content User","name":"UserPermissionsSFContentUser","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"Flow User","name":"UserPermissionsInteractionUser","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"Allow Forecasting","name":"ForecastEnabled","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"ActivityRemindersPopup","name":"UserPreferencesActivityRemindersPopup","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"EventRemindersCheckboxDefault","name":"UserPreferencesEventRemindersCheckboxDefault","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"TaskRemindersCheckboxDefault","name":"UserPreferencesTaskRemindersCheckboxDefault","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ReminderSoundOff","name":"UserPreferencesReminderSoundOff","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableAllFeedsEmail","name":"UserPreferencesDisableAllFeedsEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableFollowersEmail","name":"UserPreferencesDisableFollowersEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableProfilePostEmail","name":"UserPreferencesDisableProfilePostEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableChangeCommentEmail","name":"UserPreferencesDisableChangeCommentEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableLaterCommentEmail","name":"UserPreferencesDisableLaterCommentEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisProfPostCommentEmail","name":"UserPreferencesDisProfPostCommentEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ContentNoEmail","name":"UserPreferencesContentNoEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ContentEmailAsAndWhen","name":"UserPreferencesContentEmailAsAndWhen","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ApexPagesDeveloperMode","name":"UserPreferencesApexPagesDeveloperMode","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ReceiveNoNotificationsAsApprover","name":"UserPreferencesReceiveNoNotificationsAsApprover","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ReceiveNotificationsAsDelegatedApprover","name":"UserPreferencesReceiveNotificationsAsDelegatedApprover","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HideCSNGetChatterMobileTask","name":"UserPreferencesHideCSNGetChatterMobileTask","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableMentionsPostEmail","name":"UserPreferencesDisableMentionsPostEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisMentionsCommentEmail","name":"UserPreferencesDisMentionsCommentEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HideCSNDesktopTask","name":"UserPreferencesHideCSNDesktopTask","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HideChatterOnboardingSplash","name":"UserPreferencesHideChatterOnboardingSplash","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HideSecondChatterOnboardingSplash","name":"UserPreferencesHideSecondChatterOnboardingSplash","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisCommentAfterLikeEmail","name":"UserPreferencesDisCommentAfterLikeEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableLikeEmail","name":"UserPreferencesDisableLikeEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"SortFeedByComment","name":"UserPreferencesSortFeedByComment","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableMessageEmail","name":"UserPreferencesDisableMessageEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableBookmarkEmail","name":"UserPreferencesDisableBookmarkEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableSharePostEmail","name":"UserPreferencesDisableSharePostEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"EnableAutoSubForFeeds","name":"UserPreferencesEnableAutoSubForFeeds","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableFileShareNotificationsForApi","name":"UserPreferencesDisableFileShareNotificationsForApi","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowTitleToExternalUsers","name":"UserPreferencesShowTitleToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowManagerToExternalUsers","name":"UserPreferencesShowManagerToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowEmailToExternalUsers","name":"UserPreferencesShowEmailToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowWorkPhoneToExternalUsers","name":"UserPreferencesShowWorkPhoneToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowMobilePhoneToExternalUsers","name":"UserPreferencesShowMobilePhoneToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowFaxToExternalUsers","name":"UserPreferencesShowFaxToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowStreetAddressToExternalUsers","name":"UserPreferencesShowStreetAddressToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowCityToExternalUsers","name":"UserPreferencesShowCityToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowStateToExternalUsers","name":"UserPreferencesShowStateToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowPostalCodeToExternalUsers","name":"UserPreferencesShowPostalCodeToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowCountryToExternalUsers","name":"UserPreferencesShowCountryToExternalUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowProfilePicToGuestUsers","name":"UserPreferencesShowProfilePicToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowTitleToGuestUsers","name":"UserPreferencesShowTitleToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowCityToGuestUsers","name":"UserPreferencesShowCityToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowStateToGuestUsers","name":"UserPreferencesShowStateToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowPostalCodeToGuestUsers","name":"UserPreferencesShowPostalCodeToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowCountryToGuestUsers","name":"UserPreferencesShowCountryToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HideS1BrowserUI","name":"UserPreferencesHideS1BrowserUI","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"DisableEndorsementEmail","name":"UserPreferencesDisableEndorsementEmail","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"PathAssistantCollapsed","name":"UserPreferencesPathAssistantCollapsed","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"CacheDiagnostics","name":"UserPreferencesCacheDiagnostics","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowEmailToGuestUsers","name":"UserPreferencesShowEmailToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowManagerToGuestUsers","name":"UserPreferencesShowManagerToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowWorkPhoneToGuestUsers","name":"UserPreferencesShowWorkPhoneToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowMobilePhoneToGuestUsers","name":"UserPreferencesShowMobilePhoneToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowFaxToGuestUsers","name":"UserPreferencesShowFaxToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ShowStreetAddressToGuestUsers","name":"UserPreferencesShowStreetAddressToGuestUsers","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"LightningExperiencePreferred","name":"UserPreferencesLightningExperiencePreferred","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"PreviewLightning","name":"UserPreferencesPreviewLightning","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HideEndUserOnboardingAssistantModal","name":"UserPreferencesHideEndUserOnboardingAssistantModal","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HideLightningMigrationModal","name":"UserPreferencesHideLightningMigrationModal","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HideSfxWelcomeMat","name":"UserPreferencesHideSfxWelcomeMat","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HideBiggerPhotoCallout","name":"UserPreferencesHideBiggerPhotoCallout","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"GlobalNavBarWTShown","name":"UserPreferencesGlobalNavBarWTShown","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"GlobalNavGridMenuWTShown","name":"UserPreferencesGlobalNavGridMenuWTShown","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"CreateLEXAppsWTShown","name":"UserPreferencesCreateLEXAppsWTShown","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"FavoritesWTShown","name":"UserPreferencesFavoritesWTShown","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"RecordHomeSectionCollapseWTShown","name":"UserPreferencesRecordHomeSectionCollapseWTShown","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"RecordHomeReservedWTShown","name":"UserPreferencesRecordHomeReservedWTShown","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"FavoritesShowTopFavorites","name":"UserPreferencesFavoritesShowTopFavorites","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"ExcludeMailAppAttachments","name":"UserPreferencesExcludeMailAppAttachments","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"SuppressTaskSFXReminders","name":"UserPreferencesSuppressTaskSFXReminders","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"SuppressEventSFXReminders","name":"UserPreferencesSuppressEventSFXReminders","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"PreviewCustomTheme","name":"UserPreferencesPreviewCustomTheme","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"HasCelebrationBadge","name":"UserPreferencesHasCelebrationBadge","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"UserDebugModePref","name":"UserPreferencesUserDebugModePref","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"SRHOverrideActivities","name":"UserPreferencesSRHOverrideActivities","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"NewLightningReportRunPageEnabled","name":"UserPreferencesNewLightningReportRunPageEnabled","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"NativeEmailClient","name":"UserPreferencesNativeEmailClient","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":false,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":false,"type":"boolean"},{"label":"Contact ID","name":"ContactId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Contact","referenceTo":["Contact"],"sortable":true,"type":"reference"},{"label":"Account ID","name":"AccountId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Account","referenceTo":["Account"],"sortable":true,"type":"reference"},{"label":"Call Center ID","name":"CallCenterId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":["CallCenter"],"sortable":true,"type":"reference"},{"label":"Extension","name":"Extension","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"phone"},{"label":"SAML Federation ID","name":"FederationIdentifier","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"About Me","name":"AboutMe","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"textarea"},{"label":"Url for full-sized Photo","name":"FullPhotoUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Photo","name":"SmallPhotoUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Show external indicator","name":"IsExtIndicatorVisible","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Out of office message","name":"OutOfOfficeMessage","aggregatable":false,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"string"},{"label":"Url for medium profile photo","name":"MediumPhotoUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Chatter Email Highlights Frequency","name":"DigestFrequency","aggregatable":true,"defaultValue":"N","filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Daily","validFor":null,"value":"D"},{"active":true,"defaultValue":false,"label":"Weekly","validFor":null,"value":"W"},{"active":true,"defaultValue":true,"label":"Never","validFor":null,"value":"N"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Default Notification Frequency when Joining Groups","name":"DefaultGroupNotificationFrequency","aggregatable":true,"defaultValue":"N","filterable":true,"groupable":true,"nillable":false,"picklistValues":[{"active":true,"defaultValue":false,"label":"Email on Each Post","validFor":null,"value":"P"},{"active":true,"defaultValue":false,"label":"Daily Digests","validFor":null,"value":"D"},{"active":true,"defaultValue":false,"label":"Weekly Digests","validFor":null,"value":"W"},{"active":true,"defaultValue":true,"label":"Never","validFor":null,"value":"N"}],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"picklist"},{"label":"Last Viewed Date","name":"LastViewedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Last Referenced Date","name":"LastReferencedDate","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"datetime"},{"label":"Url for banner photo","name":"BannerPhotoUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Url for IOS banner photo","name":"SmallBannerPhotoUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Url for Android banner photo","name":"MediumBannerPhotoUrl","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":false,"nillable":true,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"url"},{"label":"Has Profile Photo","name":"IsProfilePhotoActive","aggregatable":false,"defaultValue":false,"filterable":true,"groupable":true,"nillable":false,"picklistValues":[],"relationshipName":null,"referenceTo":[],"sortable":true,"type":"boolean"},{"label":"Individual ID","name":"IndividualId","aggregatable":true,"defaultValue":null,"filterable":true,"groupable":true,"nillable":true,"picklistValues":[],"relationshipName":"Individual","referenceTo":["Individual"],"sortable":true,"type":"reference"}],"childRelationships":[{"cascadeDelete":false,"childSObject":"AcceptedEventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AcceptedEventRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"AttachedContentDocument","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AttachedContentDocuments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"AuthorizationFormConsent","deprecatedAndHidden":false,"field":"ConsentGiverId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"AuthorizationFormConsents","restrictedDelete":true},{"cascadeDelete":true,"childSObject":"CollaborationGroupMember","deprecatedAndHidden":false,"field":"MemberId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"GroupMemberships","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CollaborationGroupMemberRequest","deprecatedAndHidden":false,"field":"RequesterId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"GroupMembershipRequests","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"CombinedAttachment","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CombinedAttachments","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"CommSubscriptionConsent","deprecatedAndHidden":false,"field":"ConsentGiverId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"CommSubscriptionConsents","restrictedDelete":true},{"cascadeDelete":false,"childSObject":"ContactRequest","deprecatedAndHidden":false,"field":"WhoId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContactRequests","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ContentDocumentLink","deprecatedAndHidden":false,"field":"LinkedEntityId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContentDocumentLinks","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Contract","deprecatedAndHidden":false,"field":"CompanySignedId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ContractsSigned","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"DeclinedEventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"DeclinedEventRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EmailMessageRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"EmailMessageRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptionsForEntity","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EntitySubscription","deprecatedAndHidden":false,"field":"SubscriberId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"FeedSubscriptions","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"EventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"EventRelations","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"ExternalDataUserAuth","deprecatedAndHidden":false,"field":"UserId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ExternalDataUserAuths","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"InstalledMobileApp","deprecatedAndHidden":false,"field":"UserId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"InstalledMobileApps","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"OutgoingEmailRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OutgoingEmailRelations","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"OwnedContentDocument","deprecatedAndHidden":false,"field":"OwnerId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"OwnedContentDocuments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"PermissionSetAssignment","deprecatedAndHidden":false,"field":"AssigneeId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"PermissionSetAssignments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"PermissionSetLicenseAssign","deprecatedAndHidden":false,"field":"AssigneeId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"PermissionSetLicenseAssignments","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProfileSkillEndorsement","deprecatedAndHidden":false,"field":"UserId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"UserProfileSkillUserEndorsements","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"ProfileSkillUser","deprecatedAndHidden":false,"field":"UserId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"UserProfileSkillChildren","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"RecordAction","deprecatedAndHidden":false,"field":"RecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActions","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"RecordActionHistory","deprecatedAndHidden":false,"field":"ParentRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"RecordActionHistories","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"SessionPermSetActivation","deprecatedAndHidden":false,"field":"UserId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"SessionPermSetActivations","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"Site","deprecatedAndHidden":false,"field":"AdminId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"UserSites","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"UndecidedEventRelation","deprecatedAndHidden":false,"field":"RelationId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"UndecidedEventRelations","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"User","deprecatedAndHidden":false,"field":"DelegatedApproverId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"DelegatedUsers","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"User","deprecatedAndHidden":false,"field":"ManagerId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"ManagedUsers","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"UserEmailPreferredPerson","deprecatedAndHidden":false,"field":"PersonRecordId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"PersonRecord","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"UserEntityAccess","deprecatedAndHidden":false,"field":"UserId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"UserEntityAccessRights","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"UserFeed","deprecatedAndHidden":false,"field":"ParentId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Feeds","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"UserFieldAccess","deprecatedAndHidden":false,"field":"UserId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"UserFieldAccessRights","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"UserPreference","deprecatedAndHidden":false,"field":"UserId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"UserPreferences","restrictedDelete":false},{"cascadeDelete":true,"childSObject":"UserShare","deprecatedAndHidden":false,"field":"UserId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Shares","restrictedDelete":false},{"cascadeDelete":false,"childSObject":"WorkBadge","deprecatedAndHidden":false,"field":"RecipientId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"Badges","restrictedDelete":true},{"cascadeDelete":false,"childSObject":"WorkThanks","deprecatedAndHidden":false,"field":"GiverId","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"GivenThanks","restrictedDelete":true},{"cascadeDelete":false,"childSObject":"sfLma__Package__c","deprecatedAndHidden":false,"field":"sfLma__Lead_Manager__c","junctionIdListNames":[],"junctionReferenceTo":[],"relationshipName":"sfLma__R00N30000001JvRJEA0__r","restrictedDelete":false}],"label":"User","custom":false,"name":"User","queryable":true} \ No newline at end of file diff --git a/packages/salesforcedx-vscode-soql/test/vscode-integration/testUtilities.ts b/packages/salesforcedx-vscode-soql/test/vscode-integration/testUtilities.ts deleted file mode 100644 index bf1e898da8..0000000000 --- a/packages/salesforcedx-vscode-soql/test/vscode-integration/testUtilities.ts +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { AuthInfo, Connection } from '@salesforce/core'; -import { JsonMap } from '@salesforce/ts-types'; -import { QueryResult } from 'jsforce'; -import { SinonSandbox, SinonSpy } from 'sinon'; -import * as vscode from 'vscode'; -import { - SoqlEditorEvent, - SOQLEditorInstance -} from '../../src/editor/soqlEditorInstance'; -import { DataProvider } from '../../src/queryDataView/dataProviders'; -import { - FileFormat, - QueryDataFileService -} from '../../src/queryDataView/queryDataFileService'; -import { - DataViewEvent, - QueryDataViewService -} from '../../src/queryDataView/queryDataViewService'; - -const soqlExtension = vscode.extensions.getExtension( - 'salesforce.salesforcedx-vscode-soql' -); -const soqlExports = soqlExtension?.exports; -const { workspaceContext, channelService } = soqlExports; - -export function spyChannelService(sandbox: SinonSandbox): SinonSpy { - return sandbox.spy(channelService, 'appendLine'); -} - -export const mockQueryText = 'SELECT A, B FROM C'; -export const mockQueryData: QueryResult = { - done: true, - totalSize: 2000, - records: [ - { - attributes: { - type: 'C', - url: '' - }, - A: '', - B: false - }, - { - attributes: { - type: 'C', - url: '' - }, - A: '', - B: false - }, - { - attributes: { - type: 'C', - url: '' - }, - A: '', - B: false - } - ] -}; -export const mockColumnData = { - objectName: 'C', - columns: [ - { title: 'A', fieldHelper: ['A'] }, - { title: 'B', fieldHelper: ['B'] } - ], - subTables: [] -}; - -export const mockDescribeGlobalResponse = { - sobjects: [ - { name: 'Account', queryable: true }, - { name: 'User', queryable: true }, - { name: 'Z', queryable: false } - ] -}; - -export const mockSObjects = [ - { - name: 'Account', - childRelationships: [ - { - cascadeDelete: false, - childSObject: 'User', - field: 'AccountId', - relationshipName: 'Users' - } - ], - fields: [ - { - aggregatable: false, - name: 'Id', - label: 'Account ID', - custom: false, - groupable: true, - nillable: false, - relationshipName: null, - sortable: true, - type: 'id', - updateable: false - }, - { - aggregatable: true, - custom: false, - filterable: true, - groupable: true, - label: 'Account Name', - name: 'Name', - nameField: true, - nillable: false, - sortable: true, - type: 'string', - updateable: true - }, - { - aggregatable: false, - custom: false, - filterable: false, - groupable: false, - label: 'Account Description', - name: 'Description', - nameField: false, - sortable: false, - type: 'textarea', - updateable: true - }, - { - aggregatable: true, - custom: false, - filterable: true, - groupable: true, - label: 'Billing City', - name: 'BillingCity', - nameField: false, - nillable: true, - sortable: true, - type: 'string', - updateable: true - }, - { - aggregatable: false, - calculated: false, - custom: false, - defaultValue: false, - filterable: true, - groupable: true, - label: 'Deleted', - name: 'IsDeleted', - nameField: false, - nillable: false, - sortable: true, - type: 'boolean', - unique: false, - updateable: false - }, - { - aggregatable: false, - calculated: false, - custom: false, - defaultValue: false, - filterable: true, - groupable: true, - label: 'LastActivityDate', - name: 'LastActivityDate', - nameField: false, - nillable: false, - sortable: true, - type: 'date', - unique: false, - updateable: false - }, - { - aggregatable: true, - calculated: false, - custom: false, - defaultValue: false, - filterable: true, - groupable: false, - label: 'CreatedDate', - name: 'CreatedDate', - nameField: false, - nillable: false, - sortable: true, - type: 'datetime', - unique: false, - updateable: false - } - ] - }, - { - name: 'User', - fields: [ - { - aggregatable: true, - filterable: true, - groupable: true, - label: 'User ID', - name: 'Id', - referenceTo: [], - relationshipName: null, - sortable: true, - type: 'id' - }, - { - aggregatable: true, - custom: false, - filterable: true, - groupable: true, - label: 'User Name', - name: 'Name', - nameField: true, - sortable: true, - type: 'string', - updateable: true - }, - { - aggregatable: true, - filterable: true, - groupable: true, - label: 'Account ID', - name: 'AccountId', - referenceTo: ['Account'], - relationshipName: 'Account', - type: 'reference' - }, - { - aggregatable: false, - calculated: false, - custom: false, - defaultValue: false, - filterable: true, - groupable: true, - label: 'Deleted', - name: 'IsDeleted', - nameField: false, - nillable: false, - sortable: true, - type: 'boolean', - unique: false, - updateable: false - } - ] - }, - { - name: 'QuickText', - fields: [ - { - aggregatable: false, - defaultValue: 'Email', - filterable: true, - groupable: false, - label: 'Channel', - name: 'Channel', - nillable: true, - picklistValues: [ - { - active: true, - defaultValue: true, - label: 'Email', - validFor: null, - value: 'Email' - }, - { - active: true, - defaultValue: false, - label: 'Portal', - validFor: null, - value: 'Portal' - }, - { - active: true, - defaultValue: false, - label: 'Phone', - validFor: null, - value: 'Phone' - }, - { - active: false, - label: 'INACTIVE', - value: 'INACTIVE' - } - ], - sortable: false, - type: 'multipicklist', - unique: false, - updateable: true - } - ] - } -]; -export const mockSObject = mockSObjects[0]; - -export function stubMockConnection( - sandbox: SinonSandbox, - testUserName = 'test@test.com' -): Connection { - const connection = getMockConnection(sandbox, testUserName); - sandbox.stub(workspaceContext, 'getConnection').returns(connection); - return connection; -} -export function stubFailingMockConnection( - sandbox: SinonSandbox, - testUserName = 'test@test.com' -): Connection { - const connection = getFailingMockConnection(sandbox, testUserName); - sandbox.stub(workspaceContext, 'getConnection').returns(connection); - return connection; -} - -export function getMockConnection( - sandbox: SinonSandbox, - testUserName = 'test@test.com' -): Connection { - const mockAuthInfo = new AuthInfo({ - username: 'test' - }); - - const mockConnection = ({ - authInfo: mockAuthInfo, - describeGlobal$: () => { - return Promise.resolve(mockDescribeGlobalResponse); - }, - describe$: (name: string) => { - const sobjectMetadata = mockSObjects.find(s => s.name === name); - return Promise.resolve(sobjectMetadata); - }, - query: () => Promise.resolve(mockQueryData) - } as unknown) as Connection; - - return mockConnection; -} - -export function getFailingMockConnection( - sandbox: SinonSandbox, - testUserName = 'test@test.com' -): Connection { - const mockAuthInfo = { test: 'test' }; - const mockConnection = { - authInfo: mockAuthInfo, - describeGlobal$: () => { - return Promise.reject(new Error('Unexpected error')); - }, - describe$: (name: string) => { - return Promise.reject(new Error('Unexpected error')); - }, - query: () => Promise.reject(new Error('Unexpected error')) - }; - return (mockConnection as unknown) as Connection; -} - -export class MockTextDocumentProvider - implements vscode.TextDocumentContentProvider { - public provideTextDocumentContent( - uri: vscode.Uri, - token: vscode.CancellationToken - ): string { - return mockQueryText; - } -} - -export class TestSoqlEditorInstance extends SOQLEditorInstance { - public mockReceiveEvent(event: SoqlEditorEvent): void { - this.onDidRecieveMessageHandler(event); - } - - public updateWebview(document: vscode.TextDocument): void { - super.updateWebview(document); - } - - public updateTextDocument( - document: vscode.TextDocument, - soql: string - ): Thenable { - return super.updateTextDocument(document, soql); - } - - public openQueryDataView(queryData: QueryResult): void { - super.openQueryDataView(queryData); - } - - public sendMessageToUi(type: string, payload: string): void { - super.sendMessageToUi(type, payload); - } -} - -export class TestQueryDataViewService extends QueryDataViewService { - public mockReceiveEvent(event: DataViewEvent): void { - this.onDidRecieveMessageHandler(event); - } - - public createOrShowWebView(): vscode.Webview { - return super.createOrShowWebView(); - } - - public handleSaveRecords(format: FileFormat): void { - super.handleSaveRecords(format); - } - - public getWebViewContent(): string { - return '

This is for you CI

'; - } -} - -export class TestFileService extends QueryDataFileService { - public getDataProvider(): DataProvider { - return super.getDataProvider(); - } -} diff --git a/packages/salesforcedx-vscode-visualforce/test/vscode-integration/fileAssociations.test.ts b/packages/salesforcedx-vscode-visualforce/test/vscode-integration/fileAssociations.test.ts deleted file mode 100644 index d42e6fc4b8..0000000000 --- a/packages/salesforcedx-vscode-visualforce/test/vscode-integration/fileAssociations.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as vscode from 'vscode'; - -const PERFECT_MATCH = 10; - -const matchExtensionAsHtml = async (extension: string) => { - const doc = await vscode.workspace.openTextDocument( - vscode.Uri.parse(`untitled:fake/path/doc.${extension}`) - ); - expect(vscode.languages.match({ language: 'visualforce' }, doc)).to.equal( - PERFECT_MATCH - ); -}; - -describe('Visualforce file association', () => { - it('Should support .page association', async () => { - await matchExtensionAsHtml('.page'); - }); - - it('Should support .component association', async () => { - await matchExtensionAsHtml('.component'); - }); -}); diff --git a/packages/salesforcedx-vscode-visualforce/test/vscode-integration/index.ts b/packages/salesforcedx-vscode-visualforce/test/vscode-integration/index.ts deleted file mode 100644 index 129bcc9fd2..0000000000 --- a/packages/salesforcedx-vscode-visualforce/test/vscode-integration/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { join, normalize } from 'path'; - -// eslint-disable-next-line @typescript-eslint/no-var-requires -const testRunner = require('@salesforce/salesforcedx-test-utils-vscode/out/src/testrunner'); -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure( - { - ui: 'bdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results - fullTrace: true, - slow: 0 - }, - normalize(join(__dirname, '..', '..', '..')) -); - -module.exports = testRunner; diff --git a/packages/salesforcedx-vscode-visualforce/test/vscode-integration/telemetry/telemetry.test.ts b/packages/salesforcedx-vscode-visualforce/test/vscode-integration/telemetry/telemetry.test.ts deleted file mode 100644 index 6c796e6e61..0000000000 --- a/packages/salesforcedx-vscode-visualforce/test/vscode-integration/telemetry/telemetry.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { assert, match, SinonStub, stub } from 'sinon'; -import TelemetryReporter from 'vscode-extension-telemetry'; -import { TelemetryService } from '../../../src/telemetry/telemetry'; - -describe('Telemetry', () => { - let reporter: TelemetryReporter; - let sendEvent: SinonStub; - - beforeEach(() => { - reporter = new TelemetryReporter('salesforcedx-vscode', 'v1', 'test567890'); - sendEvent = stub(reporter, 'sendTelemetryEvent'); - }); - - afterEach(async () => { - sendEvent.restore(); - await reporter.dispose(); - }); - - it('Should send telemetry data', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendExtensionActivationEvent([1, 300]); - assert.calledOnce(sendEvent); - }); - - it('Should not send telemetry data', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], false); - - telemetryService.sendExtensionDeactivationEvent(); - assert.notCalled(sendEvent); - }); - - it('Should send correct data format on sendExtensionActivationEvent', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendExtensionActivationEvent([1, 300]); - assert.calledOnce(sendEvent); - - const expectedProps = { - extensionName: 'salesforcedx-vscode-visualforce' - }; - const expectedMeasures = { - startupTime: match.number - }; - assert.calledWith( - sendEvent, - 'activationEvent', - expectedProps, - match(expectedMeasures) - ); - }); - - it('Should send correct data format on sendExtensionDeactivationEvent', async () => { - const telemetryService = TelemetryService.getInstance(); - telemetryService.initializeService([reporter], true); - - telemetryService.sendExtensionDeactivationEvent(); - assert.calledOnce(sendEvent); - - const expectedData = { - extensionName: 'salesforcedx-vscode-visualforce' - }; - assert.calledWith(sendEvent, 'deactivationEvent', expectedData); - }); -}); From abe23c56398ae7d3e14bab9a00112995c2e5b0e9 Mon Sep 17 00:00:00 2001 From: mingxuanzhang Date: Sat, 6 Apr 2024 16:33:37 -0700 Subject: [PATCH 2/2] chore: update occurrences --- gather.sh | 17 + package-lock.json | 275 ++++---- .../test/integration/adapter.test.ts | 212 ------ .../config/variables/apexExec/test.apex | 1 - .../source/classes/BasicVariables.cls | 44 -- .../classes/BasicVariables.cls-meta.xml | 5 - .../DebugApex.permissionset-meta.xml | 634 ------------------ .../test/integration/adapter.test.ts | 289 -------- .../integration/config/logs/recursive.gold | 395 ----------- .../integration/config/logs/recursive.log | 581 ---------------- .../test/integration/config/logs/statics.gold | 81 --- .../test/integration/config/logs/statics.log | 72 -- .../config/recursive/classes/A.cls | 44 -- .../config/recursive/classes/A.cls-meta.xml | 5 - .../config/recursive/classes/B.cls | 44 -- .../config/recursive/classes/B.cls-meta.xml | 5 - .../recursive/classes/RecursiveTest.cls | 9 - .../classes/RecursiveTest.cls-meta.xml | 5 - .../config/statics/classes/StaticVarsA.cls | 11 - .../statics/classes/StaticVarsA.cls-meta.xml | 5 - .../config/statics/classes/StaticVarsB.cls | 7 - .../statics/classes/StaticVarsB.cls-meta.xml | 5 - .../test/integration/goldFileUtil.ts | 135 ---- .../package.json | 2 +- .../scripts/regenerateMinsSObjects.ts | 2 +- .../src/describe/sObjectDescribe.ts | 2 +- .../src/retriever/orgObjectRetriever.ts | 2 +- .../src/transformer/transformerFactory.ts | 2 +- .../test/integration/integrationTestUtil.ts | 26 - .../test/integration/mockData.ts | 218 ------ .../test/integration/sObjectDescribe.test.ts | 194 ------ .../integration/sobjectTransformer.test.ts | 294 -------- .../salesforcedx-utils-vscode/package.json | 6 +- .../src/config/configUtil.ts | 2 +- .../src/context/workspaceContextUtil.ts | 2 +- .../src/helpers/paths.ts | 2 +- .../src/helpers/traceFlags.ts | 2 +- .../src/helpers/traceFlagsRemover.ts | 2 +- .../src/providers/configAggregatorProvider.ts | 2 +- .../src/providers/sourceTrackingProvider.ts | 4 +- .../src/services/sourceTrackingService.ts | 6 +- .../test/jest/config/configUtil.test.ts | 2 +- .../jest/context/workspaceContextUtil.test.ts | 4 +- .../test/jest/helpers/paths.test.ts | 4 +- .../sourceTrackingService.test.ts | 4 +- .../package.json | 6 +- .../package.json | 10 +- .../src/commands/quickLaunch.ts | 4 +- .../src/context/workspaceContext.ts | 2 +- .../salesforcedx-vscode-apex/package.json | 12 +- .../src/codecoverage/colorizer.ts | 2 +- .../src/commands/anonApexExecute.ts | 4 +- .../src/commands/apexLogGet.ts | 2 +- .../src/commands/apexTestRun.ts | 2 +- .../src/commands/apexTestRunCodeAction.ts | 6 +- .../src/commands/apexTestSuite.ts | 2 +- .../src/context/workspaceContext.ts | 2 +- .../src/views/testOutlineProvider.ts | 2 +- .../salesforcedx-vscode-core/package.json | 16 +- .../src/commands/auth/orgLoginAccessToken.ts | 2 +- .../src/commands/auth/orgLogout.ts | 2 +- .../src/commands/baseDeployRetrieve.ts | 4 +- .../src/commands/deployManifest.ts | 2 +- .../src/commands/deploySourcePath.ts | 2 +- .../src/commands/projectGenerate.ts | 2 +- .../src/commands/projectGenerateManifest.ts | 2 +- .../src/commands/renameLightningComponent.ts | 2 +- .../src/commands/retrieveManifest.ts | 2 +- .../libraryRetrieveSourcePathExecutor.ts | 4 +- .../src/commands/retrieveSourcePath.ts | 2 +- .../templates/analyticsGenerateTemplate.ts | 2 +- .../LibraryApexGenerateClassExecutor.ts | 2 +- .../LibraryApexGenerateTriggerExecutor.ts | 2 +- ...ibraryApexGenerateUnitTestClassExecutor.ts | 2 +- .../templates/libraryBaseTemplateCommand.ts | 2 +- .../templates/lightningGenerateApp.ts | 2 +- .../lightningGenerateAuraComponent.ts | 2 +- .../templates/lightningGenerateEvent.ts | 2 +- .../templates/lightningGenerateInterface.ts | 2 +- .../templates/lightningGenerateLwc.ts | 2 +- .../templates/visualforceGenerateComponent.ts | 2 +- .../templates/visualforceGeneratePage.ts | 2 +- .../src/commands/util/createComponentCount.ts | 2 +- .../src/commands/util/parameterGatherers.ts | 2 +- .../src/conflict/componentDiffer.ts | 2 +- .../src/conflict/directoryDiffer.ts | 2 +- .../src/conflict/metadataCacheService.ts | 2 +- .../src/conflict/persistentStorageService.ts | 2 +- .../src/context/workspaceContext.ts | 2 +- .../src/context/workspaceOrgType.ts | 2 +- .../src/diagnostics/diagnostics.ts | 2 +- .../src/orgBrowser/metadataCmp.ts | 4 +- .../src/orgPicker/orgList.ts | 2 +- .../salesforceProjectConfig.ts | 2 +- .../src/services/sdr/componentSetUtils.ts | 2 +- .../src/util/authInfo.ts | 2 +- .../src/util/orgUtil.ts | 2 +- .../test/jest/commands/deployExecutor.test.ts | 6 +- .../jest/commands/retrieveExecutor.test.ts | 2 +- ...yApexGenerateUnitTestClassExecutor.test.ts | 2 +- .../conflict/metadataCacheService.test.ts | 2 +- .../jest/context/workspaceOrgType.test.ts | 2 +- .../services/sdr/componentSetUtils.test.ts | 2 +- .../package.json | 8 +- packages/salesforcedx-vscode-lwc/package.json | 8 +- .../salesforcedx-vscode-soql/package.json | 8 +- .../src/editor/queryRunner.ts | 2 +- .../src/editor/soqlEditorInstance.ts | 2 +- packages/salesforcedx-vscode-soql/src/sf.ts | 2 +- 109 files changed, 288 insertions(+), 3577 deletions(-) create mode 100755 gather.sh delete mode 100644 packages/salesforcedx-apex-debugger/test/integration/adapter.test.ts delete mode 100644 packages/salesforcedx-apex-debugger/test/integration/config/variables/apexExec/test.apex delete mode 100644 packages/salesforcedx-apex-debugger/test/integration/config/variables/source/classes/BasicVariables.cls delete mode 100644 packages/salesforcedx-apex-debugger/test/integration/config/variables/source/classes/BasicVariables.cls-meta.xml delete mode 100644 packages/salesforcedx-apex-debugger/test/integration/config/variables/source/permissionsets/DebugApex.permissionset-meta.xml delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/adapter.test.ts delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/recursive.gold delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/recursive.log delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/statics.gold delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/statics.log delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/A.cls delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/A.cls-meta.xml delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/B.cls delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/B.cls-meta.xml delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/RecursiveTest.cls delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/RecursiveTest.cls-meta.xml delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsA.cls delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsA.cls-meta.xml delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsB.cls delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsB.cls-meta.xml delete mode 100644 packages/salesforcedx-apex-replay-debugger/test/integration/goldFileUtil.ts delete mode 100644 packages/salesforcedx-sobjects-faux-generator/test/integration/integrationTestUtil.ts delete mode 100644 packages/salesforcedx-sobjects-faux-generator/test/integration/mockData.ts delete mode 100644 packages/salesforcedx-sobjects-faux-generator/test/integration/sObjectDescribe.test.ts delete mode 100644 packages/salesforcedx-sobjects-faux-generator/test/integration/sobjectTransformer.test.ts diff --git a/gather.sh b/gather.sh new file mode 100755 index 0000000000..07f39b877f --- /dev/null +++ b/gather.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Directory where the search will begin +SOURCE_DIR="./packages" # Replace with your source directory path + +# Directory where the .vsix files will be copied +TARGET_DIR="./extensions" # Replace with your target directory path + +# Create the target directory if it doesn't exist +# mkdir -p "$TARGET_DIR" + +# Find and copy .vsix files +find "$SOURCE_DIR" -type d -name 'salesforcedx-vscode*' -print0 | while IFS= read -r -d '' dir; do + find "$dir" -name '*60.7.0.vsix' -exec cp {} "$TARGET_DIR" \; +done + +echo "All .vsix files have been copied to $TARGET_DIR." \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 661c3ce634..7f997fd563 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5763,9 +5763,9 @@ } }, "node_modules/@oclif/core": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/@oclif/core/-/core-3.19.0.tgz", - "integrity": "sha512-Vup9DGMWlPeRVSpC76XCByfDwu1/09Xo2YTyzsquD9vnkeqIl0j0nxEjaYb6Ui3cifozLyKc/Td0+z/zz15/og==", + "version": "3.26.0", + "resolved": "https://registry.npmjs.org/@oclif/core/-/core-3.26.0.tgz", + "integrity": "sha512-TpMdfD4tfA2tVVbd4l0PrP02o5KoUXYmudBbTC7CeguDo/GLoprw4uL8cMsaVA26+cbcy7WYtOEydQiHVtJixA==", "dependencies": { "@types/cli-progress": "^3.11.5", "ansi-escapes": "^4.3.2", @@ -5783,6 +5783,7 @@ "indent-string": "^4.0.0", "is-wsl": "^2.2.0", "js-yaml": "^3.14.1", + "minimatch": "^9.0.3", "natural-orderby": "^2.0.3", "object-treeify": "^1.1.33", "password-prompt": "^1.1.3", @@ -5908,6 +5909,20 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/@oclif/core/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@oclif/core/node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -6244,13 +6259,13 @@ "resolved": "https://registry.npmjs.org/@salesforce/apex/-/apex-0.0.12.tgz", "integrity": "sha512-L4zUDy4lxF7+mM7DYPfOKZ4lqiAIquRx0vHAUJMBaxD4bCiT+70Df++aOfGO9FOJNctvPtT5bLrFRfdos4y4Mg==" }, - "node_modules/@salesforce/apex-node": { + "node_modules/@salesforce/apex-node-bundle": { "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@salesforce/apex-node/-/apex-node-4.0.2.tgz", - "integrity": "sha512-vNjj/CHnX7DerQsePG1HuOqshugKp+v8k8lrH6Pgut0C3AZB4oUn8BDauUtJb0IsyzjwS7B4CDNVuwziKFWheg==", + "resolved": "https://registry.npmjs.org/@salesforce/apex-node-bundle/-/apex-node-bundle-4.0.2.tgz", + "integrity": "sha512-Oxr3N5IT0zB2aFYG//C4HmjtNeRqfABS3O2MhXDzUAjQ9lMfCvsOHjCA5Brqaqca1XMs/wzcz3goLeL2hs5ogA==", "dependencies": { - "@salesforce/core": "^6.5.1", - "@salesforce/kit": "^3.0.15", + "@salesforce/core-bundle": "^6.7.4", + "@salesforce/kit": "^3.1.0", "@types/istanbul-reports": "^3.0.4", "faye": "1.4.0", "glob": "^10.3.10", @@ -6263,7 +6278,7 @@ "node": ">=18.18.2" } }, - "node_modules/@salesforce/apex-node/node_modules/faye": { + "node_modules/@salesforce/apex-node-bundle/node_modules/faye": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/faye/-/faye-1.4.0.tgz", "integrity": "sha512-kRrIg4be8VNYhycS2PY//hpBJSzZPr/DBbcy9VWelhZMW3KhyLkQR0HL0k0MNpmVoNFF4EdfMFkNAWjTP65g6w==", @@ -6279,7 +6294,7 @@ "node": ">=0.8.0" } }, - "node_modules/@salesforce/apex-node/node_modules/foreground-child": { + "node_modules/@salesforce/apex-node-bundle/node_modules/foreground-child": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", @@ -6294,16 +6309,16 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@salesforce/apex-node/node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "node_modules/@salesforce/apex-node-bundle/node_modules/glob": { + "version": "10.3.12", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", + "integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==", "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", + "jackspeak": "^2.3.6", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "minipass": "^7.0.4", + "path-scurry": "^1.10.2" }, "bin": { "glob": "dist/esm/bin.mjs" @@ -6315,10 +6330,10 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@salesforce/apex-node/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "node_modules/@salesforce/apex-node-bundle/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -6329,7 +6344,7 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@salesforce/apex-node/node_modules/minipass": { + "node_modules/@salesforce/apex-node-bundle/node_modules/minipass": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", @@ -6337,7 +6352,7 @@ "node": ">=16 || 14 >=14.17" } }, - "node_modules/@salesforce/apex-node/node_modules/signal-exit": { + "node_modules/@salesforce/apex-node-bundle/node_modules/signal-exit": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", @@ -6432,15 +6447,15 @@ "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.6.tgz", "integrity": "sha512-sLI2L0uGov3wKVb9EB+vIQBl9tVP90nqRvxSoJ35vI3NjxE8jfsE5DSOhWgSunHSZmKS4OCi2jrtfxK7uyp2ww==" }, - "node_modules/@salesforce/core": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/@salesforce/core/-/core-6.5.2.tgz", - "integrity": "sha512-/tviKhMQRMNZlbG/IldCXy6dLAOtCX9gysdiVeCoEsgWcXT72rj02fJg4PQMtc69GAu2vnRSbaRewfrC8Mrw8g==", + "node_modules/@salesforce/core-bundle": { + "version": "6.7.4", + "resolved": "https://registry.npmjs.org/@salesforce/core-bundle/-/core-bundle-6.7.4.tgz", + "integrity": "sha512-DUVvsmh49lSRqAWo2EmCpkSbGMLPOSMAR6lCjmdsKyV1/BhlbDOLcKnSsBHBkHAceVuBsSoVN5ypb29l4eNcrg==", "dependencies": { - "@salesforce/kit": "^3.0.15", + "@salesforce/kit": "^3.1.0", "@salesforce/schemas": "^1.6.1", "@salesforce/ts-types": "^2.0.9", - "@types/semver": "^7.5.6", + "@types/semver": "^7.5.8", "ajv": "^8.12.0", "change-case": "^4.1.2", "faye": "^1.4.0", @@ -6449,18 +6464,18 @@ "jsforce": "^2.0.0-beta.29", "jsonwebtoken": "9.0.2", "jszip": "3.10.1", - "pino": "^8.18.0", + "pino": "^8.19.0", "pino-abstract-transport": "^1.1.0", "pino-pretty": "^10.3.1", "proper-lockfile": "^4.1.2", - "semver": "^7.5.4", + "semver": "^7.6.0", "ts-retry-promise": "^0.7.1" }, "engines": { "node": ">=18.0.0" } }, - "node_modules/@salesforce/core/node_modules/@salesforce/ts-types": { + "node_modules/@salesforce/core-bundle/node_modules/@salesforce/ts-types": { "version": "2.0.9", "resolved": "https://registry.npmjs.org/@salesforce/ts-types/-/ts-types-2.0.9.tgz", "integrity": "sha512-boUD9jw5vQpTCPCCmK/NFTWjSuuW+lsaxOynkyNXLW+zxOc4GDjhtKc4j0vWZJQvolpafbyS8ZLFHZJvs12gYA==", @@ -6471,7 +6486,7 @@ "node": ">=16.0.0" } }, - "node_modules/@salesforce/core/node_modules/ajv": { + "node_modules/@salesforce/core-bundle/node_modules/ajv": { "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", @@ -6486,7 +6501,7 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/@salesforce/core/node_modules/camel-case": { + "node_modules/@salesforce/core-bundle/node_modules/camel-case": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", @@ -6495,7 +6510,7 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/change-case": { + "node_modules/@salesforce/core-bundle/node_modules/change-case": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", @@ -6514,7 +6529,7 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/constant-case": { + "node_modules/@salesforce/core-bundle/node_modules/constant-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", @@ -6524,7 +6539,7 @@ "upper-case": "^2.0.2" } }, - "node_modules/@salesforce/core/node_modules/dot-case": { + "node_modules/@salesforce/core-bundle/node_modules/dot-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", @@ -6533,7 +6548,7 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/faye": { + "node_modules/@salesforce/core-bundle/node_modules/faye": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/faye/-/faye-1.4.0.tgz", "integrity": "sha512-kRrIg4be8VNYhycS2PY//hpBJSzZPr/DBbcy9VWelhZMW3KhyLkQR0HL0k0MNpmVoNFF4EdfMFkNAWjTP65g6w==", @@ -6549,7 +6564,7 @@ "node": ">=0.8.0" } }, - "node_modules/@salesforce/core/node_modules/header-case": { + "node_modules/@salesforce/core-bundle/node_modules/header-case": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", @@ -6558,12 +6573,12 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/json-schema-traverse": { + "node_modules/@salesforce/core-bundle/node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, - "node_modules/@salesforce/core/node_modules/lower-case": { + "node_modules/@salesforce/core-bundle/node_modules/lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", @@ -6571,7 +6586,7 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/lru-cache": { + "node_modules/@salesforce/core-bundle/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", @@ -6582,7 +6597,7 @@ "node": ">=10" } }, - "node_modules/@salesforce/core/node_modules/no-case": { + "node_modules/@salesforce/core-bundle/node_modules/no-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", @@ -6591,7 +6606,7 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/param-case": { + "node_modules/@salesforce/core-bundle/node_modules/param-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", @@ -6600,7 +6615,7 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/pascal-case": { + "node_modules/@salesforce/core-bundle/node_modules/pascal-case": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", @@ -6609,7 +6624,7 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/path-case": { + "node_modules/@salesforce/core-bundle/node_modules/path-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", @@ -6618,10 +6633,10 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "node_modules/@salesforce/core-bundle/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -6632,7 +6647,7 @@ "node": ">=10" } }, - "node_modules/@salesforce/core/node_modules/sentence-case": { + "node_modules/@salesforce/core-bundle/node_modules/sentence-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", @@ -6642,7 +6657,7 @@ "upper-case-first": "^2.0.2" } }, - "node_modules/@salesforce/core/node_modules/snake-case": { + "node_modules/@salesforce/core-bundle/node_modules/snake-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", @@ -6651,12 +6666,12 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/tslib": { + "node_modules/@salesforce/core-bundle/node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, - "node_modules/@salesforce/core/node_modules/upper-case": { + "node_modules/@salesforce/core-bundle/node_modules/upper-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", @@ -6664,7 +6679,7 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/upper-case-first": { + "node_modules/@salesforce/core-bundle/node_modules/upper-case-first": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", @@ -6672,7 +6687,7 @@ "tslib": "^2.0.3" } }, - "node_modules/@salesforce/core/node_modules/yallist": { + "node_modules/@salesforce/core-bundle/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" @@ -6744,9 +6759,9 @@ } }, "node_modules/@salesforce/kit": { - "version": "3.0.15", - "resolved": "https://registry.npmjs.org/@salesforce/kit/-/kit-3.0.15.tgz", - "integrity": "sha512-XkA8jsuLvVnyP460dAbU3pBFP2IkmmmsVxMQVifcKKbNWaIBbZBzAfj+vdaQfnvZyflLhsrFT3q2xkb0vHouPg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@salesforce/kit/-/kit-3.1.0.tgz", + "integrity": "sha512-X2d9O/U2wdQBXIrtVqQdMwo872Cv+qkYFzF0W+AQKG/LEe9cngnOzUVDYNkGD9tq3jcl+oenHXYuVDpkMhxTwA==", "dependencies": { "@salesforce/ts-types": "^2.0.9", "tslib": "^2.6.2" @@ -7229,30 +7244,30 @@ "node": "*" } }, - "node_modules/@salesforce/source-deploy-retrieve": { - "version": "10.3.3", - "resolved": "https://registry.npmjs.org/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-10.3.3.tgz", - "integrity": "sha512-eugVWykEQNheOqGkYvCcGXmO8eCieEsGtMe0wZvwBjvclUYx8tFDOlWhOhF0XaSWuhv1/lxjp9oUxaBr6s7zYA==", + "node_modules/@salesforce/source-deploy-retrieve-bundle": { + "version": "10.9.0", + "resolved": "https://registry.npmjs.org/@salesforce/source-deploy-retrieve-bundle/-/source-deploy-retrieve-bundle-10.9.0.tgz", + "integrity": "sha512-9SIWQIf8Hl6hfy7MwmJDPFZ0yCZ5MZq122GVT1wIKmSmAxO2NxsVx7wQn08wIdxcZk+lCkZYLDI0zeSjFA7G/Q==", "dependencies": { - "@salesforce/core": "^6.5.1", - "@salesforce/kit": "^3.0.15", + "@salesforce/core-bundle": "^6.7.3", + "@salesforce/kit": "^3.1.0", "@salesforce/ts-types": "^2.0.9", "fast-levenshtein": "^3.0.0", - "fast-xml-parser": "^4.3.4", + "fast-xml-parser": "^4.3.6", "got": "^11.8.6", "graceful-fs": "^4.2.11", "ignore": "^5.3.1", "jszip": "^3.10.1", "mime": "2.6.0", "minimatch": "^5.1.6", - "proxy-agent": "^6.3.1", + "proxy-agent": "^6.4.0", "ts-retry-promise": "^0.7.1" }, "engines": { "node": ">=18.0.0" } }, - "node_modules/@salesforce/source-deploy-retrieve/node_modules/@salesforce/ts-types": { + "node_modules/@salesforce/source-deploy-retrieve-bundle/node_modules/@salesforce/ts-types": { "version": "2.0.9", "resolved": "https://registry.npmjs.org/@salesforce/ts-types/-/ts-types-2.0.9.tgz", "integrity": "sha512-boUD9jw5vQpTCPCCmK/NFTWjSuuW+lsaxOynkyNXLW+zxOc4GDjhtKc4j0vWZJQvolpafbyS8ZLFHZJvs12gYA==", @@ -7263,7 +7278,7 @@ "node": ">=16.0.0" } }, - "node_modules/@salesforce/source-deploy-retrieve/node_modules/minimatch": { + "node_modules/@salesforce/source-deploy-retrieve-bundle/node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", @@ -7274,22 +7289,22 @@ "node": ">=10" } }, - "node_modules/@salesforce/source-deploy-retrieve/node_modules/tslib": { + "node_modules/@salesforce/source-deploy-retrieve-bundle/node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, - "node_modules/@salesforce/source-tracking": { - "version": "5.1.11", - "resolved": "https://registry.npmjs.org/@salesforce/source-tracking/-/source-tracking-5.1.11.tgz", - "integrity": "sha512-hT+gtdiCaHPG4Pl/z+3vv1S8xOVZXP3YOetUaeewyARraII2lMyf9PDb5dIZH17C+ZDucFmJdO1zTEpBPzZjGQ==", + "node_modules/@salesforce/source-tracking-bundle": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@salesforce/source-tracking-bundle/-/source-tracking-bundle-5.2.2.tgz", + "integrity": "sha512-ygci1/w3RFzmHdnf6fquGL9z12a9beDDP5iEll4RPBbb0SzWueff1jxkPrKnYn7Y7Vs8UrrQB0POY5pFQ87ykw==", "dependencies": { - "@oclif/core": "^3.18.2", - "@salesforce/core": "^6.5.1", - "@salesforce/kit": "^3.0.15", - "@salesforce/source-deploy-retrieve": "^10.3.1", + "@oclif/core": "^3.26.0", + "@salesforce/core-bundle": "^6.7.3", + "@salesforce/kit": "^3.1.0", + "@salesforce/source-deploy-retrieve-bundle": "^10.7.0", "@salesforce/ts-types": "^2.0.9", - "fast-xml-parser": "^4.2.5", + "fast-xml-parser": "^4.3.6", "graceful-fs": "^4.2.11", "isomorphic-git": "1.23.0", "ts-retry-promise": "^0.8.0" @@ -7298,7 +7313,7 @@ "node": ">=18.0.0" } }, - "node_modules/@salesforce/source-tracking/node_modules/@salesforce/ts-types": { + "node_modules/@salesforce/source-tracking-bundle/node_modules/@salesforce/ts-types": { "version": "2.0.9", "resolved": "https://registry.npmjs.org/@salesforce/ts-types/-/ts-types-2.0.9.tgz", "integrity": "sha512-boUD9jw5vQpTCPCCmK/NFTWjSuuW+lsaxOynkyNXLW+zxOc4GDjhtKc4j0vWZJQvolpafbyS8ZLFHZJvs12gYA==", @@ -7309,7 +7324,7 @@ "node": ">=16.0.0" } }, - "node_modules/@salesforce/source-tracking/node_modules/ts-retry-promise": { + "node_modules/@salesforce/source-tracking-bundle/node_modules/ts-retry-promise": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/ts-retry-promise/-/ts-retry-promise-0.8.0.tgz", "integrity": "sha512-elI/GkojPANBikPaMWQnk4T/bOJ6tq/hqXyQRmhfC9PAD6MoHmXIXK7KilJrlpx47VAKCGcmBrTeK5dHk6YAYg==", @@ -7317,17 +7332,17 @@ "node": ">=6" } }, - "node_modules/@salesforce/source-tracking/node_modules/tslib": { + "node_modules/@salesforce/source-tracking-bundle/node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, - "node_modules/@salesforce/templates": { - "version": "60.1.0", - "resolved": "https://registry.npmjs.org/@salesforce/templates/-/templates-60.1.0.tgz", - "integrity": "sha512-gleKq/osf1vVfrh8s52sqA0U8Syx9PX31kAcMRJ2nc7k6tPY1TRMzGZVeuQc1twnx/XusWJ4dJfmO+uVvEXEhg==", + "node_modules/@salesforce/templates-bundle": { + "version": "60.1.1-beta", + "resolved": "https://registry.npmjs.org/@salesforce/templates-bundle/-/templates-bundle-60.1.1-beta.tgz", + "integrity": "sha512-HGbo8nYEZHDIrvnx7clYDKQMRUq/nS+Q7gUcH/swGbJup23Wr7m/JUTtiS/Fky/LxpduIoDBQIc0NXJ5oosA7w==", "dependencies": { - "@salesforce/core": "^6.1.0", + "@salesforce/core-bundle": "^6.1.0", "@salesforce/kit": "^3.0.15", "got": "^11.8.2", "hpagent": "^1.2.0", @@ -7342,7 +7357,7 @@ "node": ">=18.18.2" } }, - "node_modules/@salesforce/templates/node_modules/tslib": { + "node_modules/@salesforce/templates-bundle/node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" @@ -7993,9 +8008,9 @@ } }, "node_modules/@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==" + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==" }, "node_modules/@types/shelljs": { "version": "0.8.11", @@ -15059,9 +15074,9 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" }, "node_modules/fast-xml-parser": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.4.tgz", - "integrity": "sha512-utnwm92SyozgA3hhH2I8qldf2lBqm6qHOICawRNRFu1qMe3+oqr+GcXjGqTmXTMGE5T4eC03kr/rlh5C1IRdZA==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.6.tgz", + "integrity": "sha512-M2SovcRxD4+vC493Uc2GZVcZaj66CCJhWurC4viynVSTvrpErCShNcDz1lAho6n9REQKvL/ll4A4/fw6Y9z8nw==", "funding": [ { "type": "github", @@ -28994,11 +29009,11 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", + "integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", + "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { @@ -29009,9 +29024,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", - "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", + "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", "engines": { "node": "14 || >=16.14" } @@ -29087,14 +29102,14 @@ } }, "node_modules/pino": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/pino/-/pino-8.18.0.tgz", - "integrity": "sha512-Mz/gKiRyuXu4HnpHgi1YWdHQCoWMufapzooisvFn78zl4dZciAxS+YeRkUxXl1ee/SzU80YCz1zpECCh4oC6Aw==", + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-8.20.0.tgz", + "integrity": "sha512-uhIfMj5TVp+WynVASaVEJFTncTUe4dHBq6CWplu/vBgvGHhvBvQfxz+vcOrnnBQdORH3izaGEurLfNlq3YxdFQ==", "dependencies": { "atomic-sleep": "^1.0.0", "fast-redact": "^3.1.1", "on-exit-leak-free": "^2.1.0", - "pino-abstract-transport": "v1.1.0", + "pino-abstract-transport": "^1.1.0", "pino-std-serializers": "^6.0.0", "process-warning": "^3.0.0", "quick-format-unescaped": "^4.0.3", @@ -29634,14 +29649,14 @@ "dev": true }, "node_modules/proxy-agent": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.1.tgz", - "integrity": "sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.4.0.tgz", + "integrity": "sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==", "dependencies": { "agent-base": "^7.0.2", "debug": "^4.3.4", - "http-proxy-agent": "^7.0.0", - "https-proxy-agent": "^7.0.2", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.3", "lru-cache": "^7.14.1", "pac-proxy-agent": "^7.0.1", "proxy-from-env": "^1.1.0", @@ -29663,9 +29678,9 @@ } }, "node_modules/proxy-agent/node_modules/http-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", - "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" @@ -29675,9 +29690,9 @@ } }, "node_modules/proxy-agent/node_modules/https-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", - "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -36403,7 +36418,7 @@ "version": "60.7.0", "license": "BSD-3-Clause", "dependencies": { - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/salesforcedx-utils-vscode": "60.7.0", "jsforce": "2.0.0-beta.29", "shelljs": "0.8.5" @@ -36559,9 +36574,9 @@ "version": "60.7.0", "license": "BSD-3-Clause", "dependencies": { - "@salesforce/core": "6.5.2", - "@salesforce/source-deploy-retrieve": "10.3.3", - "@salesforce/source-tracking": "5.1.11", + "@salesforce/core-bundle": "6.7.4", + "@salesforce/source-deploy-retrieve-bundle": "10.9.0", + "@salesforce/source-tracking-bundle": "5.2.2", "applicationinsights": "1.0.7", "cross-spawn": "7.0.3", "rxjs": "^5.4.1", @@ -36791,9 +36806,9 @@ "version": "60.7.0", "license": "BSD-3-Clause", "dependencies": { - "@salesforce/apex-node": "4.0.2", + "@salesforce/apex-node-bundle": "4.0.2", "@salesforce/apex-tmlanguage": "1.8.0", - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/salesforcedx-utils-vscode": "60.7.0", "expand-home-dir": "0.0.3", "find-java-home": "0.2.0", @@ -36878,8 +36893,8 @@ "version": "60.7.0", "license": "BSD-3-Clause", "dependencies": { - "@salesforce/apex-node": "4.0.2", - "@salesforce/core": "6.5.2", + "@salesforce/apex-node-bundle": "4.0.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/salesforcedx-apex-replay-debugger": "60.7.0", "@salesforce/salesforcedx-utils": "60.7.0", "@salesforce/salesforcedx-utils-vscode": "60.7.0", @@ -37018,12 +37033,12 @@ "version": "60.7.0", "license": "BSD-3-Clause", "dependencies": { - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/salesforcedx-sobjects-faux-generator": "60.7.0", "@salesforce/salesforcedx-utils-vscode": "60.7.0", "@salesforce/schemas": "^1.6.1", - "@salesforce/source-deploy-retrieve": "10.3.3", - "@salesforce/templates": "^60.1.0", + "@salesforce/source-deploy-retrieve-bundle": "10.9.0", + "@salesforce/templates-bundle": "60.1.1-beta", "@salesforce/ts-types": "2.0.9", "adm-zip": "0.5.10", "applicationinsights": "1.0.7", @@ -37195,7 +37210,7 @@ "license": "BSD-3-Clause", "dependencies": { "@salesforce/aura-language-server": "4.8.0", - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/lightning-lsp-common": "4.8.0", "@salesforce/salesforcedx-utils-vscode": "60.7.0", "applicationinsights": "1.0.7", @@ -37297,7 +37312,7 @@ "version": "60.7.0", "license": "BSD-3-Clause", "dependencies": { - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/eslint-config-lwc": "3.5.1", "@salesforce/lightning-lsp-common": "4.8.0", "@salesforce/lwc-language-server": "4.8.0", @@ -37419,7 +37434,7 @@ "license": "BSD-3-Clause", "dependencies": { "@salesforce/apex-tmlanguage": "1.6.0", - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/soql-builder-ui": "0.2.0", "@salesforce/soql-data-view": "0.1.0", "@salesforce/soql-language-server": "0.7.1", diff --git a/packages/salesforcedx-apex-debugger/test/integration/adapter.test.ts b/packages/salesforcedx-apex-debugger/test/integration/adapter.test.ts deleted file mode 100644 index a8b1eea09c..0000000000 --- a/packages/salesforcedx-apex-debugger/test/integration/adapter.test.ts +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as util from '@salesforce/salesforcedx-test-utils-vscode/out/src/orgUtils'; -import { - CliCommandExecutor, - CommandExecution, - SfCommandBuilder -} from '@salesforce/salesforcedx-utils-vscode'; -import { expect } from 'chai'; -import * as path from 'path'; -import * as rimraf from 'rimraf'; -import { DebugClient } from 'vscode-debugadapter-testsupport'; -import { DebugProtocol } from 'vscode-debugprotocol'; -import Uri from 'vscode-uri'; -import { LaunchRequestArguments } from '../../src/adapter/apexDebug'; -import { LineBreakpointInfo } from '../../src/breakpoints/lineBreakpoint'; - -const PROJECT_NAME = `project_${new Date().getTime()}`; -const SIMPLE_VARIABLES_DIR = path.join( - __dirname, - '..', - '..', - '..', - 'test', - 'integration', - 'config', - 'variables' -); -const SOURCE_FOLDER = path.join(SIMPLE_VARIABLES_DIR, 'source'); -const APEX_EXEC_FILE = path.join(SIMPLE_VARIABLES_DIR, 'apexExec', 'test.apex'); -const LINE_BREAKPOINT_INFO: LineBreakpointInfo[] = []; - -/** - * These integration tests assume the environment has authenticated to - * a Dev Hub and it is set as the target Dev Hub. - */ -describe.skip('Interactive debugger adapter - integration', () => { - jest.setTimeout(320000); - let dc: DebugClient; - let userName: string; - let projectPath: string; - let apexClassUri: string; - - beforeAll(async () => { - // Generate SFDX Project - projectPath = path.join(process.cwd(), PROJECT_NAME); - console.log(`projectPath: ${projectPath}`); - await util.generateSFProject(PROJECT_NAME); - // Create scratch org with Debug Apex enabled - util.addFeatureToScratchOrgConfig(PROJECT_NAME, 'DebugApex'); - apexClassUri = Uri.file( - `${projectPath}/force-app/main/default/classes/BasicVariables.cls` - ).toString(); - if (process.platform === 'win32') { - apexClassUri = apexClassUri.replace('%3A', ':'); - } - console.log(`apexClassUri: ${apexClassUri}`); - LINE_BREAKPOINT_INFO.push({ - uri: apexClassUri, - typeref: 'BasicVariables', - lines: [ - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 30, 31, 32, 33, - 34, 36, 37, 39, 40, 42 - ] - }); - LINE_BREAKPOINT_INFO.push({ - uri: apexClassUri, - typeref: 'BasicVariables$MyInnerClass', - lines: [6, 7] - }); - userName = await util.createScratchOrg(PROJECT_NAME); - // Push source to scratch org - await util.pushSource(SOURCE_FOLDER, PROJECT_NAME, userName); - // Assign Debug Apex permission to user - await util.assignPermissionSet('DebugApex', userName); - // Start debugger client - // Use dc.start(4711) to debug the adapter during - // tests (adapter needs to be launched in debug mode separately). - dc = new DebugClient('node', './out/src/adapter/apexDebug.js', 'apex'); - await dc.start(); - dc.defaultTimeout = 10000; - }); - - afterAll(async () => { - if (userName) { - await util.deleteScratchOrg(PROJECT_NAME, userName); - } - rimraf.sync(projectPath); - if (dc) { - await dc.stop(); - } - }); - - it('Should not attach', async () => { - try { - await dc.attachRequest({}); - expect.fail('Debugger client should have thrown an error'); - // tslint:disable-next-line:no-empty - } catch (error) {} - }); - - it('End-to-end flow', async () => { - // Launch Apex Debugger session - const launchResponse = await dc.launchRequest({ - salesforceProject: projectPath - } as LaunchRequestArguments); - expect(launchResponse.success).to.equal(true); - try { - // Add breakpoint - const apexClassPath = Uri.parse(apexClassUri).fsPath; - console.log(`apexClassPath: ${apexClassPath}`); - const addBreakpointsResponse = await dc.setBreakpointsRequest({ - source: { - path: apexClassPath - }, - lines: [42] - }); - expect(addBreakpointsResponse.success).to.equal(true); - expect(addBreakpointsResponse.body.breakpoints.length).to.equal(1); - expect(addBreakpointsResponse.body.breakpoints[0]).to.deep.equal({ - verified: true, - source: { - path: apexClassPath - }, - line: 42 - } as DebugProtocol.Breakpoint); - // Invoke Apex method - execApexNoWait(APEX_EXEC_FILE, userName); - // Verify stack - const stackTraceResponse = await dc.assertStoppedLocation('', { - path: apexClassPath, - line: 42 - }); - expect(stackTraceResponse.success).to.equal(true); - expect(stackTraceResponse.body.stackFrames.length).to.equal(2); - expect(stackTraceResponse.body.stackFrames[0].name).to.equal( - 'BasicVariables.testAll()' - ); - expect(stackTraceResponse.body.stackFrames[1].name).to.equal( - 'anon.execute()' - ); - // Verify threads - const threadResponse = await dc.threadsRequest(); - expect(threadResponse.success).to.equal(true); - expect(threadResponse.body.threads.length).to.equal(1); - // Verify scopes - const scopesResponse = await dc.scopesRequest({ - frameId: stackTraceResponse.body.stackFrames[0].id - }); - expect(scopesResponse.success).to.equal(true); - expect(scopesResponse.body.scopes.length).to.equal(3); - expect(scopesResponse.body.scopes[0].name).to.equal('Local'); - expect(scopesResponse.body.scopes[1].name).to.equal('Static'); - expect(scopesResponse.body.scopes[2].name).to.equal('Global'); - // Verify variables - const variablesResponse = await dc.variablesRequest({ - variablesReference: scopesResponse.body.scopes[0].variablesReference - }); - expect(variablesResponse.success).to.equal(true); - expect(variablesResponse.body.variables.length).is.greaterThan(0); - // Expand variables - for (const variable of variablesResponse.body.variables) { - if (variable.variablesReference === 0) { - continue; - } - const expandResponse = await dc.variablesRequest({ - variablesReference: variable.variablesReference - }); - expect(expandResponse.success).to.equal(true); - expect(expandResponse.body.variables.length).is.greaterThan(0); - } - // Finish the debugged request - const nextResponse = await dc.nextRequest({ - threadId: threadResponse.body.threads[0].id - }); - expect(nextResponse.success).to.equal(true); - // Delete breakpoint - const deleteBreakpointsResponse = await dc.setBreakpointsRequest({ - source: { - path: apexClassPath - }, - lines: [] - }); - expect(deleteBreakpointsResponse.success).to.equal(true); - expect(deleteBreakpointsResponse.body.breakpoints.length).to.equal(0); - } finally { - // Disconnect Apex Debugger session - const disconnectResponse = await dc.disconnectRequest({}); - expect(disconnectResponse.success).to.equal(true); - } - }); -}); - -const execApexNoWait = ( - apexExecFilePath: string, - userName: string -): CommandExecution => { - return new CliCommandExecutor( - new SfCommandBuilder() - .withArg('apex:run') - .withFlag('--file', apexExecFilePath) - .withFlag('--target-org', userName) - .withJson() - .build(), - { cwd: process.cwd() } - ).execute(); -}; diff --git a/packages/salesforcedx-apex-debugger/test/integration/config/variables/apexExec/test.apex b/packages/salesforcedx-apex-debugger/test/integration/config/variables/apexExec/test.apex deleted file mode 100644 index 5b06a01a6d..0000000000 --- a/packages/salesforcedx-apex-debugger/test/integration/config/variables/apexExec/test.apex +++ /dev/null @@ -1 +0,0 @@ -BasicVariables.testAll(); \ No newline at end of file diff --git a/packages/salesforcedx-apex-debugger/test/integration/config/variables/source/classes/BasicVariables.cls b/packages/salesforcedx-apex-debugger/test/integration/config/variables/source/classes/BasicVariables.cls deleted file mode 100644 index cbb1e21fe4..0000000000 --- a/packages/salesforcedx-apex-debugger/test/integration/config/variables/source/classes/BasicVariables.cls +++ /dev/null @@ -1,44 +0,0 @@ -public class BasicVariables { - class MyInnerClass { - Integer myInteger; - String myString; - public MyInnerClass(Integer myInteger, String myString) { - this.myInteger = myInteger; - this.myString = myString; - } - } - - public enum Season {WINTER, SPRING, SUMMER, FALL} - - public static void testAll() { - Blob blobVar = Blob.valueOf('Blob'); - Boolean booleanVar = true; - Date dateVar = Date.newInstance(1990, 1, 3); - Datetime datetimeVar = Datetime.newInstance(1980, 10, 1); - Decimal decimalVar = 0.002; - Double doubleVar = 3.14159; - Season enumVar = Season.SUMMER; - ID idVar = UserInfo.getUserId(); - Integer integerVar = 42; - Long longVar = 123456789L; - String stringVar = 'Lorem ipsum dolor sit amet, consectetur adipis; elit. Aliquam dictum cursus nulla'; - Time timeVar = Time.newInstance(1, 2, 3, 4); - - MyInnerClass myClass = new MyInnerClass(1, 'One'); - - List mySimpleList = new List {1, 2}; - List myComplexList = new List {new MyInnerClass(1, 'One'), new MyInnerClass(2, 'Two')}; - List> myNestedList = new List>(); - myNestedList.add(new List {'a', 'b'}); - myNestedList.add(new List {'c', 'e'}); - myNestedList.add(new List {'d', 'f'}); - - Map mySimpleMap = new Map {1 => 'One', 2 => 'Two'}; - Map myComplexMap = new Map {1 => new MyInnerClass(1, 'One'), 2 => new MyInnerClass(2, 'Two')}; - - Set mySimpleSet = new Set(new List {1, 2, 1}); - Set myComplexSet = new Set(new List {new MyInnerClass(1, 'One'), new MyInnerClass(2, 'Two')}); - - System.debug('End placeholder for setting breakpoint'); - } -} diff --git a/packages/salesforcedx-apex-debugger/test/integration/config/variables/source/classes/BasicVariables.cls-meta.xml b/packages/salesforcedx-apex-debugger/test/integration/config/variables/source/classes/BasicVariables.cls-meta.xml deleted file mode 100644 index f3bac1f88c..0000000000 --- a/packages/salesforcedx-apex-debugger/test/integration/config/variables/source/classes/BasicVariables.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 41.0 - Active - diff --git a/packages/salesforcedx-apex-debugger/test/integration/config/variables/source/permissionsets/DebugApex.permissionset-meta.xml b/packages/salesforcedx-apex-debugger/test/integration/config/variables/source/permissionsets/DebugApex.permissionset-meta.xml deleted file mode 100644 index 0df4192d25..0000000000 --- a/packages/salesforcedx-apex-debugger/test/integration/config/variables/source/permissionsets/DebugApex.permissionset-meta.xml +++ /dev/null @@ -1,634 +0,0 @@ - - - false - - - true - true - true - true - true - Account - true - - - true - true - true - true - true - Address - true - - - true - true - true - true - true - Asset - true - - - true - true - true - true - true - Campaign - true - - - true - true - true - true - true - Case - true - - - true - true - true - true - true - Contact - true - - - true - true - true - true - true - Contract - true - - - true - true - true - true - true - DandBCompany - true - - - true - true - true - true - true - Document - true - - - true - true - true - true - true - DuplicateRecordSet - true - - - true - true - true - true - true - Goal - true - - - true - true - true - true - true - GoalLink - true - - - true - true - true - true - false - Idea - false - - - true - true - true - true - true - Lead - true - - - true - true - true - true - true - Location - true - - - true - true - true - true - true - Macro - true - - - true - true - true - true - true - MaintenancePlan - true - - - true - true - true - true - true - Metric - true - - - true - true - true - true - true - MetricDataLink - true - - - true - true - true - true - true - OperatingHours - true - - - true - true - true - true - true - Opportunity - true - - - true - true - true - true - true - Order - true - - - true - true - true - true - false - Pricebook2 - false - - - true - true - true - true - false - Product2 - false - - - true - true - true - true - true - ProductItem - true - - - true - true - true - true - true - ProductRequest - true - - - true - true - true - true - true - ProductTransfer - true - - - true - true - true - true - false - PushTopic - false - - - true - true - true - true - true - QuickText - true - - - true - true - true - true - true - ReturnOrder - true - - - true - true - true - true - true - Scorecard - true - - - true - true - true - true - true - ScorecardAssociation - true - - - true - true - true - true - true - ScorecardMetric - true - - - true - true - true - true - true - ServiceAppointment - true - - - true - true - true - true - true - ServiceCrew - true - - - true - true - true - true - true - ServiceResource - true - - - true - true - true - true - true - ServiceTerritory - true - - - true - true - true - true - true - Shipment - true - - - true - true - true - true - true - Solution - true - - - true - true - true - true - true - StreamingChannel - true - - - true - true - true - true - true - TimeSheet - true - - - true - true - true - true - true - WorkCoaching - true - - - true - true - true - true - true - WorkFeedback - true - - - true - true - true - true - true - WorkFeedbackQuestion - true - - - true - true - true - true - true - WorkFeedbackQuestionSet - true - - - true - true - true - true - true - WorkFeedbackRequest - true - - - true - true - true - true - true - WorkFeedbackTemplate - true - - - true - true - true - true - true - WorkOrder - true - - - true - true - true - true - true - WorkPerformanceCycle - true - - - true - true - true - true - true - WorkReward - true - - - true - true - true - true - true - WorkRewardFund - true - - - true - true - true - true - true - WorkRewardFundType - true - - - true - true - true - true - true - WorkType - true - - - true - AssignTopics - - - true - AuthorApex - - - true - ConnectOrgToEnvironmentHub - - - true - ConvertLeads - - - true - CreateCustomizeDashboards - - - true - CreateCustomizeFilters - - - true - CreateCustomizeReports - - - true - CreateDashboardFolders - - - true - CreateReportFolders - - - true - CreateTopics - - - true - DebugApex - - - true - DeleteTopics - - - true - EditEvent - - - true - EditMyDashboards - - - true - EditMyReports - - - true - EditPublicDocuments - - - true - EditPublicFilters - - - true - EditPublicTemplates - - - true - EditTask - - - true - EditTopics - - - true - ImportLeads - - - true - ManageCategories - - - true - ManageDashbdsInPubFolders - - - true - ManageNetworks - - - true - ManageReportsInPubFolders - - - true - ModifyAllData - - - true - ModifyMetadata - - - true - RunReports - - - true - SolutionImport - - - true - TransferAnyEntity - - - true - TransferAnyLead - - - true - UseTeamReassignWizards - - - true - ViewAllData - - - true - ViewEventLogFiles - - - true - ViewPublicDashboards - - - true - ViewPublicReports - - - true - ViewRoles - - - true - ViewSetup - - diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/adapter.test.ts b/packages/salesforcedx-apex-replay-debugger/test/integration/adapter.test.ts deleted file mode 100644 index dbd770c373..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/adapter.test.ts +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as path from 'path'; -import { DebugClient } from 'vscode-debugadapter-testsupport'; -import { DebugProtocol } from 'vscode-debugprotocol'; -import Uri from 'vscode-uri'; -import { - ApexReplayDebug, - LaunchRequestArguments -} from '../../src/adapter/apexReplayDebug'; -import { LineBreakpointInfo } from '../../src/breakpoints'; -import { GoldFileUtil } from './goldFileUtil'; - -const PROJECT_NAME = `project_${new Date().getTime()}`; -const CONFIG_DIR = path.join( - __dirname, - '..', - '..', - 'test', - 'integration', - 'config' -); -const LOG_FOLDER = path.join(CONFIG_DIR, 'logs'); - -// tslint:disable:no-unused-expression -describe('Replay debugger adapter - integration', () => { - jest.setTimeout(320000); - let goldFileUtil: GoldFileUtil; - let dc: DebugClient; - let projectPath: string; - let lineBpInfo: LineBreakpointInfo[]; - - beforeAll(async () => { - projectPath = path.join(process.cwd(), PROJECT_NAME); - lineBpInfo = []; - console.log(`projectPath: ${projectPath}`); - - // Use dc.start(4712) to debug the adapter during - // tests (adapter needs to be launched in debug mode separately). - dc = new DebugClient( - 'node', - './out/src/adapter/apexReplayDebug.js', - 'apex-replay' - ); - await dc.start(); - dc.defaultTimeout = 10000; - }); - - afterAll(async () => { - if (dc) { - await dc.stop(); - } - }); - - it('Should not attach', async () => { - try { - await dc.attachRequest({}); - expect.fail('Debugger client should have thrown an error'); - // tslint:disable-next-line:no-empty - } catch (error) {} - }); - - it('Recursive stack', async () => { - let classA = Uri.file( - `${projectPath}/force-app/main/default/classes/A.cls` - ).toString(); - let classB = Uri.file( - `${projectPath}/force-app/main/default/classes/B.cls` - ).toString(); - let classRecursive = Uri.file( - `${projectPath}/force-app/main/default/classes/RecursiveTest.cls` - ).toString(); - const classAValidLines = [42]; - const classBValidLines = [42]; - const classRecursiveValidLines = [7]; - if (process.platform === 'win32') { - classA = classA.replace('%3A', ':'); - classB = classB.replace('%3A', ':'); - classRecursive = classRecursive.replace('%3A', ':'); - } - console.log( - `classA: ${classA}. classB: ${classB}. classRecursive: ${classRecursive}` - ); - lineBpInfo.push( - { - uri: classA, - typeref: 'A', - lines: classAValidLines - }, - { - uri: classB, - typeref: 'B', - lines: classBValidLines - }, - { - uri: classRecursive, - typeref: 'RecursiveTest', - lines: classRecursiveValidLines - } - ); - const testName = 'recursive'; - const logFilePath = path.join(LOG_FOLDER, `${testName}.log`); - goldFileUtil = new GoldFileUtil( - dc, - path.join(LOG_FOLDER, `${testName}.gold`) - ); - - const launchResponse = await dc.launchRequest({ - salesforceProject: projectPath, - logFile: logFilePath, - stopOnEntry: true, - trace: true, - lineBreakpointInfo: lineBpInfo, - projectPath: undefined - } as LaunchRequestArguments); - expect(launchResponse.success).to.equal(true); - - try { - const classAPath = Uri.parse(classA).fsPath; - const classBPath = Uri.parse(classB).fsPath; - const classRecursivePath = Uri.parse(classRecursive).fsPath; - console.log( - `classAPath: ${classAPath}. classBPath: ${classBPath}. classRecursivePath: ${classRecursivePath}` - ); - let addBreakpointsResponse = await dc.setBreakpointsRequest( - createBreakpointsArgs(classAPath, classAValidLines) - ); - assertBreakpointsCreated( - addBreakpointsResponse, - 1, - classAPath, - classAValidLines - ); - addBreakpointsResponse = await dc.setBreakpointsRequest( - createBreakpointsArgs(classBPath, classBValidLines) - ); - assertBreakpointsCreated( - addBreakpointsResponse, - 1, - classBPath, - classBValidLines - ); - // tslint:disable-next-line:no-floating-promises - dc.configurationDoneRequest({}); - // Verify stopped on the first line of debug log - const stackTraceResponse = await dc.assertStoppedLocation('entry', { - path: logFilePath, - line: 1 - }); - expect(stackTraceResponse.body.stackFrames.length).to.equal(1); - // Verify stopped on first breakpoint - await dc.continueRequest({ - threadId: ApexReplayDebug.THREAD_ID - }); - await goldFileUtil.assertTopState( - 'breakpoint', - classBPath, - classBValidLines[0] - ); - // Verify stopped on second breakpoint - await dc.continueRequest({ - threadId: ApexReplayDebug.THREAD_ID - }); - await goldFileUtil.assertTopState( - 'breakpoint', - classAPath, - classAValidLines[0] - ); - // Step out to test class - await dc.stepOutRequest({ - threadId: ApexReplayDebug.THREAD_ID - }); - await goldFileUtil.assertTopState( - 'step', - classRecursivePath, - classRecursiveValidLines[0] - ); - } finally { - const disconnectResponse = await dc.disconnectRequest({}); - expect(disconnectResponse.success).to.equal(true); - } - }); - - it('Static variable of one class in different frames', async () => { - let classStaticVarsA = Uri.file( - `${projectPath}/force-app/main/default/classes/StaticVarsA.cls` - ).toString(); - const classStaticVarsAValidLines = [9]; - if (process.platform === 'win32') { - classStaticVarsA = classStaticVarsA.replace('%3A', ':'); - } - console.log(`classStaticVarsA: ${classStaticVarsA}`); - lineBpInfo.push({ - uri: classStaticVarsA, - typeref: 'StaticVarsA', - lines: classStaticVarsAValidLines - }); - const testName = 'statics'; - const logFilePath = path.join(LOG_FOLDER, `${testName}.log`); - goldFileUtil = new GoldFileUtil( - dc, - path.join(LOG_FOLDER, `${testName}.gold`) - ); - - const launchResponse = await dc.launchRequest({ - salesforceProject: projectPath, - logFile: logFilePath, - stopOnEntry: true, - trace: true, - lineBreakpointInfo: lineBpInfo, - projectPath: undefined - } as LaunchRequestArguments); - expect(launchResponse.success).to.equal(true); - - try { - const classStaticVarsAPath = Uri.parse(classStaticVarsA).fsPath; - console.log(`classStaticVarsAPath: ${classStaticVarsAPath}`); - const addBreakpointsResponse = await dc.setBreakpointsRequest( - createBreakpointsArgs(classStaticVarsAPath, classStaticVarsAValidLines) - ); - assertBreakpointsCreated( - addBreakpointsResponse, - 1, - classStaticVarsAPath, - classStaticVarsAValidLines - ); - - // tslint:disable-next-line:no-floating-promises - dc.configurationDoneRequest({}); - - // Verify stopped on the first line of debug log - const stackTraceResponse = await dc.assertStoppedLocation('entry', { - path: logFilePath, - line: 1 - }); - expect(stackTraceResponse.body.stackFrames.length).to.equal(1); - // Verify stopped on first breakpoint - await dc.continueRequest({ - threadId: ApexReplayDebug.THREAD_ID - }); - await goldFileUtil.assertEntireState( - 'breakpoint', - classStaticVarsAPath, - classStaticVarsAValidLines[0] - ); - } finally { - const disconnectResponse = await dc.disconnectRequest({}); - expect(disconnectResponse.success).to.equal(true); - } - }); -}); - -const createBreakpointsArgs = ( - classPath: string, - lineNumbers: number[] -): DebugProtocol.SetBreakpointsArguments => { - const result: DebugProtocol.SetBreakpointsArguments = { - source: { - path: classPath - }, - lines: lineNumbers, - breakpoints: [] - }; - lineNumbers.forEach(lineNumber => - result.breakpoints!.push({ line: lineNumber }) - ); - return result; -}; - -const assertBreakpointsCreated = ( - response: DebugProtocol.SetBreakpointsResponse, - expectedNumOfBreakpoints: number, - expectedSourcePath: string, - expectedLineNumbers: number[] -) => { - expect(response.success).to.equal(true); - expect(response.body.breakpoints.length).to.equal(expectedNumOfBreakpoints); - response.body.breakpoints.forEach(bp => { - expect(bp.verified).to.be.true; - expect(bp.source!.path).to.equal(expectedSourcePath); - expect(expectedLineNumbers).to.include(bp.line!); - }); -}; diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/recursive.gold b/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/recursive.gold deleted file mode 100644 index 53e5b272ca..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/recursive.gold +++ /dev/null @@ -1,395 +0,0 @@ -[ - { - "id": 1004, - "source": { - "name": "B.cls", - "path": "", - "sourceReference": 0 - }, - "line": 42, - "column": 0, - "name": "B.B" - }, - { - "id": 1000, - "source": { - "name": "RecursiveTest.cls", - "path": "", - "sourceReference": 0 - }, - "line": 5, - "column": 0, - "name": "RecursiveTest.testMain()" - } -] -==================== -[ - { - "name": "this", - "value": "", - "variablesReference": 1001, - "type": "B", - "evaluateName": "" - }, - { - "name": "myClass", - "value": "", - "variablesReference": 1003, - "type": "B.MyInnerClassB", - "evaluateName": "" - }, - { - "name": "mySimpleList", - "value": "[1,2]", - "variablesReference": 0, - "type": "List", - "evaluateName": "[1,2]" - }, - { - "name": "myComplexList", - "value": "[{\"myInteger\":1,\"myString\":\"One\"},{\"myInteger\":2,\"myString\":\"Two\"}]", - "variablesReference": 0, - "type": "List", - "evaluateName": "[{\"myInteger\":1,\"myString\":\"One\"},{\"myInteger\":2,\"myString\":\"Two\"}]" - }, - { - "name": "myNestedList", - "value": "[]", - "variablesReference": 0, - "type": "List>", - "evaluateName": "[]" - }, - { - "name": "mySimpleMap", - "value": "{\"1\":\"One\",\"2\":\"Two\"}", - "variablesReference": 0, - "type": "Map", - "evaluateName": "{\"1\":\"One\",\"2\":\"Two\"}" - }, - { - "name": "myComplexMap", - "value": "{\"1\":{\"myInteger\":1,\"myString\":\"One\"},\"2\":{\"myInteger\":2,\"myString\":\"Two\"}}", - "variablesReference": 0, - "type": "Map", - "evaluateName": "{\"1\":{\"myInteger\":1,\"myString\":\"One\"},\"2\":{\"myInteger\":2,\"myString\":\"Two\"}}" - }, - { - "name": "mySimpleSet", - "value": "[1,2]", - "variablesReference": 0, - "type": "Set", - "evaluateName": "[1,2]" - }, - { - "name": "myComplexSet", - "value": "[{\"myInteger\":1,\"myString\":\"One\"},{\"myInteger\":2,\"myString\":\"Two\"}]", - "variablesReference": 0, - "type": "Set", - "evaluateName": "[{\"myInteger\":1,\"myString\":\"One\"},{\"myInteger\":2,\"myString\":\"Two\"}]" - } -] -==================== -[ - { - "name": "blobVar", - "value": "BLOB(4 bytes)", - "variablesReference": 0, - "type": "Blob", - "evaluateName": "BLOB(4 bytes)" - }, - { - "name": "booleanVar", - "value": "true", - "variablesReference": 0, - "type": "Boolean", - "evaluateName": "true" - }, - { - "name": "dateVar", - "value": "'1990-01-03T00:00:00.000Z'", - "variablesReference": 0, - "type": "Date", - "evaluateName": "'1990-01-03T00:00:00.000Z'" - }, - { - "name": "datetimeVar", - "value": "'1980-10-01T07:00:00.000Z'", - "variablesReference": 0, - "type": "Datetime", - "evaluateName": "'1980-10-01T07:00:00.000Z'" - }, - { - "name": "decimalVar", - "value": "0.002", - "variablesReference": 0, - "type": "Decimal", - "evaluateName": "0.002" - }, - { - "name": "doubleVar", - "value": "3.14159", - "variablesReference": 0, - "type": "Double", - "evaluateName": "3.14159" - }, - { - "name": "enumVar", - "value": "", - "variablesReference": 1000, - "type": "B.Season", - "evaluateName": "" - }, - { - "name": "idVar", - "value": "'0050S0000014rYkQAI'", - "variablesReference": 0, - "type": "Id", - "evaluateName": "'0050S0000014rYkQAI'" - }, - { - "name": "integerVar", - "value": "42", - "variablesReference": 0, - "type": "Integer", - "evaluateName": "42" - }, - { - "name": "longVar", - "value": "123456789", - "variablesReference": 0, - "type": "Long", - "evaluateName": "123456789" - }, - { - "name": "stringVar", - "value": "'Lorem ipsum dolor si (61 more) ...'", - "variablesReference": 0, - "type": "String", - "evaluateName": "'Lorem ipsum dolor si (61 more) ...'" - }, - { - "name": "timeVar", - "value": "3723004", - "variablesReference": 0, - "type": "Time", - "evaluateName": "3723004" - } -] -==================== -[ - { - "id": 1020, - "source": { - "name": "A.cls", - "path": "", - "sourceReference": 0 - }, - "line": 42, - "column": 0, - "name": "A.A" - }, - { - "id": 1000, - "source": { - "name": "RecursiveTest.cls", - "path": "", - "sourceReference": 0 - }, - "line": 6, - "column": 0, - "name": "RecursiveTest.testMain()" - } -] -==================== -[ - { - "name": "this", - "value": "", - "variablesReference": 1022, - "type": "A", - "evaluateName": "" - }, - { - "name": "myB", - "value": "", - "variablesReference": 1023, - "type": "B", - "evaluateName": "" - }, - { - "name": "blobVar", - "value": "BLOB(4 bytes)", - "variablesReference": 0, - "type": "Blob", - "evaluateName": "BLOB(4 bytes)" - }, - { - "name": "booleanVar", - "value": "true", - "variablesReference": 0, - "type": "Boolean", - "evaluateName": "true" - }, - { - "name": "dateVar", - "value": "'1990-01-03T00:00:00.000Z'", - "variablesReference": 0, - "type": "Date", - "evaluateName": "'1990-01-03T00:00:00.000Z'" - }, - { - "name": "datetimeVar", - "value": "'1980-10-01T07:00:00.000Z'", - "variablesReference": 0, - "type": "Datetime", - "evaluateName": "'1980-10-01T07:00:00.000Z'" - }, - { - "name": "decimalVar", - "value": "0.002", - "variablesReference": 0, - "type": "Decimal", - "evaluateName": "0.002" - }, - { - "name": "doubleVar", - "value": "3.14159", - "variablesReference": 0, - "type": "Double", - "evaluateName": "3.14159" - }, - { - "name": "enumVar", - "value": "", - "variablesReference": 1027, - "type": "A.Season", - "evaluateName": "" - }, - { - "name": "idVar", - "value": "'0050S0000014rYkQAI'", - "variablesReference": 0, - "type": "Id", - "evaluateName": "'0050S0000014rYkQAI'" - }, - { - "name": "integerVar", - "value": "42", - "variablesReference": 0, - "type": "Integer", - "evaluateName": "42" - }, - { - "name": "longVar", - "value": "123456789", - "variablesReference": 0, - "type": "Long", - "evaluateName": "123456789" - }, - { - "name": "stringVar", - "value": "'Lorem ipsum dolor si (61 more) ...'", - "variablesReference": 0, - "type": "String", - "evaluateName": "'Lorem ipsum dolor si (61 more) ...'" - }, - { - "name": "timeVar", - "value": "3723004", - "variablesReference": 0, - "type": "Time", - "evaluateName": "3723004" - } -] -==================== -[ - { - "name": "myClass", - "value": "", - "variablesReference": 1015, - "type": "A.MyInnerClassA", - "evaluateName": "" - }, - { - "name": "myComplexList", - "value": "[{\"myInteger\":1,\"myString\":\"One\"},{\"myInteger\":2,\"myString\":\"Two\"}]", - "variablesReference": 0, - "type": "List", - "evaluateName": "[{\"myInteger\":1,\"myString\":\"One\"},{\"myInteger\":2,\"myString\":\"Two\"}]" - }, - { - "name": "myComplexMap", - "value": "{\"1\":{\"myInteger\":1,\"myString\":\"One\"},\"2\":{\"myInteger\":2,\"myString\":\"Two\"}}", - "variablesReference": 0, - "type": "Map", - "evaluateName": "{\"1\":{\"myInteger\":1,\"myString\":\"One\"},\"2\":{\"myInteger\":2,\"myString\":\"Two\"}}" - }, - { - "name": "myComplexSet", - "value": "[{\"myInteger\":1,\"myString\":\"One\"},{\"myInteger\":2,\"myString\":\"Two\"}]", - "variablesReference": 0, - "type": "Set", - "evaluateName": "[{\"myInteger\":1,\"myString\":\"One\"},{\"myInteger\":2,\"myString\":\"Two\"}]" - }, - { - "name": "myNestedList", - "value": "[]", - "variablesReference": 0, - "type": "List>", - "evaluateName": "[]" - }, - { - "name": "mySimpleList", - "value": "[1,2]", - "variablesReference": 0, - "type": "List", - "evaluateName": "[1,2]" - }, - { - "name": "mySimpleMap", - "value": "{\"1\":\"One\",\"2\":\"Two\"}", - "variablesReference": 0, - "type": "Map", - "evaluateName": "{\"1\":\"One\",\"2\":\"Two\"}" - }, - { - "name": "mySimpleSet", - "value": "[1,2]", - "variablesReference": 0, - "type": "Set", - "evaluateName": "[1,2]" - } -] -==================== -[ - { - "id": 1000, - "source": { - "name": "RecursiveTest.cls", - "path": "", - "sourceReference": 0 - }, - "line": 7, - "column": 0, - "name": "RecursiveTest.testMain()" - } -] -==================== -[ - { - "name": "myB", - "value": "", - "variablesReference": 1013, - "type": "B", - "evaluateName": "" - }, - { - "name": "myA", - "value": "", - "variablesReference": 1032, - "type": "A", - "evaluateName": "" - } -] -==================== -[] \ No newline at end of file diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/recursive.log b/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/recursive.log deleted file mode 100644 index 722012b897..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/recursive.log +++ /dev/null @@ -1,581 +0,0 @@ -43.0 APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;NBA,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,FINER;WAVE,INFO;WORKFLOW,INFO -13:50:14.2 (2362018)|USER_INFO|[EXTERNAL]|0050S0000014rYk|test-0gvmsswedqap@example.com|Pacific Standard Time|GMT-07:00 -13:50:14.2 (2415221)|EXECUTION_STARTED -13:50:14.2 (2420589)|CODE_UNIT_STARTED|[EXTERNAL]|01p0S000000SPIt|RecursiveTest.testMain() -13:50:14.2 (3068719)|HEAP_ALLOCATE|[72]|Bytes:3 -13:50:14.2 (3129946)|HEAP_ALLOCATE|[77]|Bytes:152 -13:50:14.2 (3147614)|HEAP_ALLOCATE|[342]|Bytes:408 -13:50:14.2 (3160549)|HEAP_ALLOCATE|[355]|Bytes:408 -13:50:14.2 (3171975)|HEAP_ALLOCATE|[467]|Bytes:48 -13:50:14.2 (3484384)|HEAP_ALLOCATE|[139]|Bytes:6 -13:50:14.2 (3510848)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:5 -13:50:14.2 (3590861)|METHOD_ENTRY|[2]|01p0S000000SPIt|RecursiveTest.RecursiveTest() -13:50:14.2 (3600209)|STATEMENT_EXECUTE|[2] -13:50:14.2 (3606412)|STATEMENT_EXECUTE|[2] -13:50:14.2 (3624303)|METHOD_EXIT|[2]|RecursiveTest -13:50:14.2 (3744017)|HEAP_ALLOCATE|[50]|Bytes:5 -13:50:14.2 (3786885)|HEAP_ALLOCATE|[56]|Bytes:5 -13:50:14.2 (3808296)|HEAP_ALLOCATE|[64]|Bytes:7 -13:50:14.2 (3866777)|STATEMENT_EXECUTE|[4] -13:50:14.2 (3869447)|STATEMENT_EXECUTE|[5] -13:50:14.2 (5496508)|VARIABLE_SCOPE_BEGIN|[14]|B.blobVar|Blob|false|true -13:50:14.2 (5514305)|VARIABLE_SCOPE_BEGIN|[15]|B.booleanVar|Boolean|false|true -13:50:14.2 (5538343)|VARIABLE_SCOPE_BEGIN|[16]|B.dateVar|Date|false|true -13:50:14.2 (5551029)|VARIABLE_SCOPE_BEGIN|[17]|B.datetimeVar|Datetime|false|true -13:50:14.2 (5562244)|VARIABLE_SCOPE_BEGIN|[18]|B.decimalVar|Decimal|false|true -13:50:14.2 (5570781)|VARIABLE_SCOPE_BEGIN|[19]|B.doubleVar|Double|false|true -13:50:14.2 (6897297)|VARIABLE_SCOPE_BEGIN|[20]|B.enumVar|B.Season|true|true -13:50:14.2 (6915880)|VARIABLE_SCOPE_BEGIN|[21]|B.idVar|Id|false|true -13:50:14.2 (6924954)|VARIABLE_SCOPE_BEGIN|[22]|B.integerVar|Integer|false|true -13:50:14.2 (6936046)|VARIABLE_SCOPE_BEGIN|[23]|B.longVar|Long|false|true -13:50:14.2 (6944406)|VARIABLE_SCOPE_BEGIN|[24]|B.stringVar|String|false|true -13:50:14.2 (6960711)|VARIABLE_SCOPE_BEGIN|[25]|B.timeVar|Time|false|true -13:50:14.2 (6972198)|HEAP_ALLOCATE|[5]|Bytes:20 -13:50:14.2 (6981406)|HEAP_ALLOCATE|[5]|Bytes:80 -13:50:14.2 (6986333)|HEAP_ALLOCATE|[5]|Bytes:5 -13:50:14.2 (6991333)|HEAP_ALLOCATE|[5]|Bytes:2 -13:50:14.2 (7063114)|METHOD_ENTRY|[1]|01p0S000000SPIK|B.B() -13:50:14.2 (7071612)|STATEMENT_EXECUTE|[1] -13:50:14.2 (7075609)|STATEMENT_EXECUTE|[1] -13:50:14.2 (7077263)|STATEMENT_EXECUTE|[2] -13:50:14.2 (7078811)|STATEMENT_EXECUTE|[14] -13:50:14.2 (7083276)|HEAP_ALLOCATE|[14]|Bytes:4 -13:50:14.2 (7157383)|HEAP_ALLOCATE|[14]|Bytes:4 -13:50:14.2 (7224153)|VARIABLE_ASSIGNMENT|[14]|B.blobVar|BLOB(4 bytes) -13:50:14.2 (7231388)|STATEMENT_EXECUTE|[15] -13:50:14.2 (7244761)|HEAP_ALLOCATE|[15]|Bytes:5 -13:50:14.2 (7255733)|VARIABLE_ASSIGNMENT|[15]|B.booleanVar|true -13:50:14.2 (7260689)|STATEMENT_EXECUTE|[16] -13:50:14.2 (7314389)|HEAP_ALLOCATE|[16]|Bytes:4 -13:50:14.2 (7360382)|VARIABLE_ASSIGNMENT|[16]|B.dateVar|"1990-01-03T00:00:00.000Z" -13:50:14.2 (7365984)|STATEMENT_EXECUTE|[17] -13:50:14.2 (7405491)|HEAP_ALLOCATE|[17]|Bytes:56 -13:50:14.2 (7434781)|VARIABLE_ASSIGNMENT|[17]|B.datetimeVar|"1980-10-01T07:00:00.000Z" -13:50:14.2 (7440786)|STATEMENT_EXECUTE|[18] -13:50:14.2 (7444632)|HEAP_ALLOCATE|[18]|Bytes:5 -13:50:14.2 (7465250)|HEAP_ALLOCATE|[18]|Bytes:28 -13:50:14.2 (7479779)|VARIABLE_ASSIGNMENT|[18]|B.decimalVar|0.002 -13:50:14.2 (7484360)|STATEMENT_EXECUTE|[19] -13:50:14.2 (7487377)|HEAP_ALLOCATE|[19]|Bytes:7 -13:50:14.2 (7494206)|HEAP_ALLOCATE|[19]|Bytes:28 -13:50:14.2 (7502735)|HEAP_ALLOCATE|[19]|Bytes:12 -13:50:14.2 (7515036)|VARIABLE_ASSIGNMENT|[19]|B.doubleVar|3.14159 -13:50:14.2 (7520702)|STATEMENT_EXECUTE|[20] -13:50:14.2 (7587554)|HEAP_ALLOCATE|[20]|Bytes:12 -13:50:14.2 (7595827)|HEAP_ALLOCATE|[20]|Bytes:6 -13:50:14.2 (7712288)|HEAP_ALLOCATE|[20]|Bytes:12 -13:50:14.2 (7722044)|HEAP_ALLOCATE|[20]|Bytes:6 -13:50:14.2 (7740152)|HEAP_ALLOCATE|[20]|Bytes:12 -13:50:14.2 (7744600)|HEAP_ALLOCATE|[20]|Bytes:6 -13:50:14.2 (7755148)|HEAP_ALLOCATE|[20]|Bytes:12 -13:50:14.2 (7759219)|HEAP_ALLOCATE|[20]|Bytes:4 -13:50:14.2 (7793381)|VARIABLE_ASSIGNMENT|[20]|B.enumVar|"SUMMER"|0x7d74262f -13:50:14.2 (7800375)|STATEMENT_EXECUTE|[21] -13:50:14.2 (7852157)|HEAP_ALLOCATE|[21]|Bytes:89 -13:50:14.2 (7889202)|SYSTEM_METHOD_ENTRY|[1]|UserInfo.UserInfo() -13:50:14.2 (7896886)|STATEMENT_EXECUTE|[1] -13:50:14.2 (7911574)|SYSTEM_METHOD_EXIT|[1]|UserInfo -13:50:14.2 (7931201)|METHOD_ENTRY|[21]||System.UserInfo.getUserId() -13:50:14.2 (8041096)|METHOD_EXIT|[21]||System.UserInfo.getUserId() -13:50:14.2 (8061082)|HEAP_ALLOCATE|[21]|Bytes:4 -13:50:14.2 (8426690)|VARIABLE_ASSIGNMENT|[21]|B.idVar|"0050S0000014rYkQAI" -13:50:14.2 (8435920)|STATEMENT_EXECUTE|[22] -13:50:14.2 (8441897)|HEAP_ALLOCATE|[22]|Bytes:4 -13:50:14.2 (8456152)|VARIABLE_ASSIGNMENT|[22]|B.integerVar|42 -13:50:14.2 (8460841)|STATEMENT_EXECUTE|[23] -13:50:14.2 (8487239)|HEAP_ALLOCATE|[74]|Bytes:4 -13:50:14.2 (8511359)|HEAP_ALLOCATE|[23]|Bytes:12 -13:50:14.2 (8524149)|VARIABLE_ASSIGNMENT|[23]|B.longVar|123456789 -13:50:14.2 (8528938)|STATEMENT_EXECUTE|[24] -13:50:14.2 (8531824)|HEAP_ALLOCATE|[24]|Bytes:81 -13:50:14.2 (8546961)|VARIABLE_ASSIGNMENT|[24]|B.stringVar|"Lorem ipsum dolor si (61 more) ..." -13:50:14.2 (8551234)|STATEMENT_EXECUTE|[25] -13:50:14.2 (8629962)|HEAP_ALLOCATE|[25]|Bytes:4 -13:50:14.2 (8835617)|VARIABLE_ASSIGNMENT|[25]|B.timeVar|3723004 -13:50:14.2 (8878170)|METHOD_EXIT|[1]|B -13:50:14.2 (11366759)|VARIABLE_SCOPE_BEGIN|[14]|A.myClass|A.MyInnerClassA|true|true -13:50:14.2 (11438377)|VARIABLE_SCOPE_BEGIN|[16]|A.myComplexList|List|true|true -13:50:14.2 (11481953)|VARIABLE_SCOPE_BEGIN|[19]|A.myComplexMap|Map|true|true -13:50:14.2 (11509627)|VARIABLE_SCOPE_BEGIN|[21]|A.myComplexSet|Set|true|true -13:50:14.2 (11520263)|VARIABLE_SCOPE_BEGIN|[17]|A.myNestedList|List>|true|true -13:50:14.2 (11529896)|VARIABLE_SCOPE_BEGIN|[15]|A.mySimpleList|List|true|true -13:50:14.2 (11539646)|VARIABLE_SCOPE_BEGIN|[18]|A.mySimpleMap|Map|true|true -13:50:14.2 (11549664)|VARIABLE_SCOPE_BEGIN|[20]|A.mySimpleSet|Set|true|true -13:50:14.2 (11567350)|HEAP_ALLOCATE|[5]|Bytes:8 -13:50:14.2 (11584654)|CONSTRUCTOR_ENTRY|[5]|01p0S000000SPIK|()|B -13:50:14.2 (11620563)|VARIABLE_SCOPE_BEGIN|[29]|this|B|true|false -13:50:14.2 (11662625)|VARIABLE_ASSIGNMENT|[29]|this|{}|0x6ed02744 -13:50:14.2 (11672132)|STATEMENT_EXECUTE|[1] -13:50:14.2 (11674295)|STATEMENT_EXECUTE|[12] -13:50:14.2 (11683555)|HEAP_ALLOCATE|[30]|Bytes:6 -13:50:14.2 (11717654)|STATEMENT_EXECUTE|[29] -13:50:14.2 (11719712)|STATEMENT_EXECUTE|[30] -13:50:14.2 (12547803)|HEAP_ALLOCATE|[30]|Bytes:1 -13:50:14.2 (12572817)|HEAP_ALLOCATE|[30]|Bytes:12 -13:50:14.2 (12581072)|HEAP_ALLOCATE|[30]|Bytes:3 -13:50:14.2 (12603751)|CONSTRUCTOR_ENTRY|[30]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (12662490)|VARIABLE_SCOPE_BEGIN|[6]|this|B.MyInnerClassB|true|false -13:50:14.2 (12698642)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x33614d7e -13:50:14.2 (12707093)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (12716676)|VARIABLE_ASSIGNMENT|[6]|myInteger|1 -13:50:14.2 (12721881)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (12732233)|VARIABLE_ASSIGNMENT|[6]|myString|"One" -13:50:14.2 (12738544)|STATEMENT_EXECUTE|[2] -13:50:14.2 (12740701)|STATEMENT_EXECUTE|[3] -13:50:14.2 (12742387)|STATEMENT_EXECUTE|[4] -13:50:14.2 (12760106)|STATEMENT_EXECUTE|[6] -13:50:14.2 (12761999)|STATEMENT_EXECUTE|[7] -13:50:14.2 (12766021)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (12791401)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|1|0x33614d7e -13:50:14.2 (12797679)|STATEMENT_EXECUTE|[8] -13:50:14.2 (12804417)|VARIABLE_ASSIGNMENT|[8]|this.myString|"One"|0x33614d7e -13:50:14.2 (12817501)|CONSTRUCTOR_EXIT|[30]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (12825939)|VARIABLE_SCOPE_BEGIN|[30]|myClass|B.MyInnerClassB|true|false -13:50:14.2 (12857314)|VARIABLE_ASSIGNMENT|[30]|myClass|{"myInteger":1,"myString":"One"}|0x33614d7e -13:50:14.2 (12863653)|STATEMENT_EXECUTE|[31] -13:50:14.2 (12879011)|HEAP_ALLOCATE|[31]|Bytes:4 -13:50:14.2 (12917514)|HEAP_ALLOCATE|[31]|Bytes:4 -13:50:14.2 (12928879)|HEAP_ALLOCATE|[31]|Bytes:4 -13:50:14.2 (12933571)|VARIABLE_SCOPE_BEGIN|[31]|mySimpleList|List|true|false -13:50:14.2 (12967812)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 -13:50:14.2 (12985268)|VARIABLE_ASSIGNMENT|[31]|mySimpleList|[1,2]|0x5671c45a -13:50:14.2 (12990850)|STATEMENT_EXECUTE|[32] -13:50:14.2 (13011399)|HEAP_ALLOCATE|[32]|Bytes:4 -13:50:14.2 (13077172)|HEAP_ALLOCATE|[32]|Bytes:12 -13:50:14.2 (13091904)|CONSTRUCTOR_ENTRY|[32]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (13102396)|VARIABLE_SCOPE_BEGIN|[6]|this|B.MyInnerClassB|true|false -13:50:14.2 (13122034)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x3c5f2c6a -13:50:14.2 (13128467)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (13136491)|VARIABLE_ASSIGNMENT|[6]|myInteger|1 -13:50:14.2 (13140520)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (13148950)|VARIABLE_ASSIGNMENT|[6]|myString|"One" -13:50:14.2 (13153923)|STATEMENT_EXECUTE|[2] -13:50:14.2 (13155727)|STATEMENT_EXECUTE|[3] -13:50:14.2 (13157315)|STATEMENT_EXECUTE|[4] -13:50:14.2 (13171616)|STATEMENT_EXECUTE|[6] -13:50:14.2 (13173403)|STATEMENT_EXECUTE|[7] -13:50:14.2 (13176050)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (13184073)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|1|0x3c5f2c6a -13:50:14.2 (13188982)|STATEMENT_EXECUTE|[8] -13:50:14.2 (13193845)|VARIABLE_ASSIGNMENT|[8]|this.myString|"One"|0x3c5f2c6a -13:50:14.2 (13204106)|CONSTRUCTOR_EXIT|[32]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (13215729)|HEAP_ALLOCATE|[32]|Bytes:12 -13:50:14.2 (13221664)|HEAP_ALLOCATE|[32]|Bytes:3 -13:50:14.2 (13229198)|CONSTRUCTOR_ENTRY|[32]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (13237494)|VARIABLE_SCOPE_BEGIN|[6]|this|B.MyInnerClassB|true|false -13:50:14.2 (13252870)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x642e17ee -13:50:14.2 (13258342)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (13266072)|VARIABLE_ASSIGNMENT|[6]|myInteger|2 -13:50:14.2 (13269882)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (13277668)|VARIABLE_ASSIGNMENT|[6]|myString|"Two" -13:50:14.2 (13282694)|STATEMENT_EXECUTE|[2] -13:50:14.2 (13284451)|STATEMENT_EXECUTE|[3] -13:50:14.2 (13286170)|STATEMENT_EXECUTE|[4] -13:50:14.2 (13296921)|STATEMENT_EXECUTE|[6] -13:50:14.2 (13298670)|STATEMENT_EXECUTE|[7] -13:50:14.2 (13300872)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (13307976)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|2|0x642e17ee -13:50:14.2 (13312663)|STATEMENT_EXECUTE|[8] -13:50:14.2 (13317208)|VARIABLE_ASSIGNMENT|[8]|this.myString|"Two"|0x642e17ee -13:50:14.2 (13325961)|CONSTRUCTOR_EXIT|[32]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (13334858)|VARIABLE_SCOPE_BEGIN|[32]|myComplexList|List|true|false -13:50:14.2 (13353431)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 -13:50:14.2 (13378624)|VARIABLE_ASSIGNMENT|[32]|myComplexList|[{"myInteger":1,"myString":"One"},{"myInteger":2,"myString":"Two"}]|0x3c254c25 -13:50:14.2 (13385408)|STATEMENT_EXECUTE|[33] -13:50:14.2 (13397617)|HEAP_ALLOCATE|[33]|Bytes:4 -13:50:14.2 (13421790)|VARIABLE_SCOPE_BEGIN|[33]|myNestedList|List>|true|false -13:50:14.2 (13444720)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4 -13:50:14.2 (13452919)|VARIABLE_ASSIGNMENT|[33]|myNestedList|[]|0x795c1bb7 -13:50:14.2 (13458468)|STATEMENT_EXECUTE|[34] -13:50:14.2 (13467286)|HEAP_ALLOCATE|[34]|Bytes:4 -13:50:14.2 (13487384)|HEAP_ALLOCATE|[34]|Bytes:1 -13:50:14.2 (13497512)|HEAP_ALLOCATE|[34]|Bytes:1 -13:50:14.2 (13524468)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 -13:50:14.2 (13547924)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4 -13:50:14.2 (13557887)|STATEMENT_EXECUTE|[35] -13:50:14.2 (13564824)|HEAP_ALLOCATE|[35]|Bytes:4 -13:50:14.2 (13580277)|HEAP_ALLOCATE|[35]|Bytes:1 -13:50:14.2 (13586658)|HEAP_ALLOCATE|[35]|Bytes:1 -13:50:14.2 (13602619)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 -13:50:14.2 (13613644)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4 -13:50:14.2 (13620643)|STATEMENT_EXECUTE|[36] -13:50:14.2 (13626907)|HEAP_ALLOCATE|[36]|Bytes:4 -13:50:14.2 (13640124)|HEAP_ALLOCATE|[36]|Bytes:1 -13:50:14.2 (13646094)|HEAP_ALLOCATE|[36]|Bytes:1 -13:50:14.2 (13659988)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 -13:50:14.2 (13670054)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4 -13:50:14.2 (13676428)|STATEMENT_EXECUTE|[37] -13:50:14.2 (13690117)|HEAP_ALLOCATE|[37]|Bytes:4 -13:50:14.2 (13739142)|HEAP_ALLOCATE|[37]|Bytes:4 -13:50:14.2 (13756690)|HEAP_ALLOCATE|[37]|Bytes:4 -13:50:14.2 (13763506)|VARIABLE_SCOPE_BEGIN|[37]|mySimpleMap|Map|true|false -13:50:14.2 (13793044)|VARIABLE_ASSIGNMENT|[37]|mySimpleMap|{"1":"One","2":"Two"}|0x492d9e59 -13:50:14.2 (13799486)|STATEMENT_EXECUTE|[38] -13:50:14.2 (13836550)|HEAP_ALLOCATE|[38]|Bytes:4 -13:50:14.2 (13868110)|HEAP_ALLOCATE|[38]|Bytes:12 -13:50:14.2 (13880805)|CONSTRUCTOR_ENTRY|[38]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (13902504)|VARIABLE_SCOPE_BEGIN|[6]|this|B.MyInnerClassB|true|false -13:50:14.2 (13923912)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x5d2861f5 -13:50:14.2 (13929948)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (13937909)|VARIABLE_ASSIGNMENT|[6]|myInteger|1 -13:50:14.2 (13941576)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (13949958)|VARIABLE_ASSIGNMENT|[6]|myString|"One" -13:50:14.2 (13954997)|STATEMENT_EXECUTE|[2] -13:50:14.2 (13956824)|STATEMENT_EXECUTE|[3] -13:50:14.2 (13958445)|STATEMENT_EXECUTE|[4] -13:50:14.2 (13972520)|STATEMENT_EXECUTE|[6] -13:50:14.2 (13974331)|STATEMENT_EXECUTE|[7] -13:50:14.2 (13977223)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (13985575)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|1|0x5d2861f5 -13:50:14.2 (13990444)|STATEMENT_EXECUTE|[8] -13:50:14.2 (13995435)|VARIABLE_ASSIGNMENT|[8]|this.myString|"One"|0x5d2861f5 -13:50:14.2 (14005516)|CONSTRUCTOR_EXIT|[38]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (14021778)|HEAP_ALLOCATE|[38]|Bytes:4 -13:50:14.2 (14033527)|HEAP_ALLOCATE|[38]|Bytes:12 -13:50:14.2 (14042064)|CONSTRUCTOR_ENTRY|[38]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (14050883)|VARIABLE_SCOPE_BEGIN|[6]|this|B.MyInnerClassB|true|false -13:50:14.2 (14066959)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x5262717a -13:50:14.2 (14072632)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (14080857)|VARIABLE_ASSIGNMENT|[6]|myInteger|2 -13:50:14.2 (14084519)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (14092544)|VARIABLE_ASSIGNMENT|[6]|myString|"Two" -13:50:14.2 (14096945)|STATEMENT_EXECUTE|[2] -13:50:14.2 (14098650)|STATEMENT_EXECUTE|[3] -13:50:14.2 (14100420)|STATEMENT_EXECUTE|[4] -13:50:14.2 (14111208)|STATEMENT_EXECUTE|[6] -13:50:14.2 (14113071)|STATEMENT_EXECUTE|[7] -13:50:14.2 (14115351)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (14122463)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|2|0x5262717a -13:50:14.2 (14144135)|STATEMENT_EXECUTE|[8] -13:50:14.2 (14153117)|VARIABLE_ASSIGNMENT|[8]|this.myString|"Two"|0x5262717a -13:50:14.2 (14171821)|CONSTRUCTOR_EXIT|[38]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (14190062)|HEAP_ALLOCATE|[38]|Bytes:4 -13:50:14.2 (14208436)|VARIABLE_SCOPE_BEGIN|[38]|myComplexMap|Map|true|false -13:50:14.2 (14266686)|VARIABLE_ASSIGNMENT|[38]|myComplexMap|{"1":{"myInteger":1,"myString":"One"},"2":{"myInteger":2,"myString":"Two"}}|0x7798f239 -13:50:14.2 (14280482)|STATEMENT_EXECUTE|[39] -13:50:14.2 (14298679)|HEAP_ALLOCATE|[39]|Bytes:4 -13:50:14.2 (14313213)|HEAP_ALLOCATE|[39]|Bytes:4 -13:50:14.2 (14349141)|HEAP_ALLOCATE|[39]|Bytes:4 -13:50:14.2 (14360874)|HEAP_ALLOCATE|[39]|Bytes:4 -13:50:14.2 (14367418)|HEAP_ALLOCATE|[39]|Bytes:4 -13:50:14.2 (14432249)|VARIABLE_SCOPE_BEGIN|[39]|mySimpleSet|Set|true|false -13:50:14.2 (14487262)|VARIABLE_ASSIGNMENT|[39]|mySimpleSet|[1,2]|0x692112f6 -13:50:14.2 (14499448)|STATEMENT_EXECUTE|[40] -13:50:14.2 (14533590)|HEAP_ALLOCATE|[40]|Bytes:4 -13:50:14.2 (14543183)|HEAP_ALLOCATE|[40]|Bytes:4 -13:50:14.2 (14567145)|HEAP_ALLOCATE|[40]|Bytes:12 -13:50:14.2 (14616140)|CONSTRUCTOR_ENTRY|[40]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (14629716)|VARIABLE_SCOPE_BEGIN|[6]|this|B.MyInnerClassB|true|false -13:50:14.2 (14651940)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x7092f711 -13:50:14.2 (14657867)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (14667100)|VARIABLE_ASSIGNMENT|[6]|myInteger|1 -13:50:14.2 (14671114)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (14679485)|VARIABLE_ASSIGNMENT|[6]|myString|"One" -13:50:14.2 (14684379)|STATEMENT_EXECUTE|[2] -13:50:14.2 (14686641)|STATEMENT_EXECUTE|[3] -13:50:14.2 (14700094)|STATEMENT_EXECUTE|[4] -13:50:14.2 (14716373)|STATEMENT_EXECUTE|[6] -13:50:14.2 (14718199)|STATEMENT_EXECUTE|[7] -13:50:14.2 (14721150)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (14731263)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|1|0x7092f711 -13:50:14.2 (14736143)|STATEMENT_EXECUTE|[8] -13:50:14.2 (14741523)|VARIABLE_ASSIGNMENT|[8]|this.myString|"One"|0x7092f711 -13:50:14.2 (14752307)|CONSTRUCTOR_EXIT|[40]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (14764652)|HEAP_ALLOCATE|[40]|Bytes:12 -13:50:14.2 (14773813)|CONSTRUCTOR_ENTRY|[40]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (14782390)|VARIABLE_SCOPE_BEGIN|[6]|this|B.MyInnerClassB|true|false -13:50:14.2 (14799316)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x313ab1d8 -13:50:14.2 (14805144)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (14813197)|VARIABLE_ASSIGNMENT|[6]|myInteger|2 -13:50:14.2 (14816790)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (14824792)|VARIABLE_ASSIGNMENT|[6]|myString|"Two" -13:50:14.2 (14829387)|STATEMENT_EXECUTE|[2] -13:50:14.2 (14836441)|STATEMENT_EXECUTE|[3] -13:50:14.2 (14838118)|STATEMENT_EXECUTE|[4] -13:50:14.2 (14850132)|STATEMENT_EXECUTE|[6] -13:50:14.2 (14851930)|STATEMENT_EXECUTE|[7] -13:50:14.2 (14854305)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (14862040)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|2|0x313ab1d8 -13:50:14.2 (14867270)|STATEMENT_EXECUTE|[8] -13:50:14.2 (14871884)|VARIABLE_ASSIGNMENT|[8]|this.myString|"Two"|0x313ab1d8 -13:50:14.2 (14881007)|CONSTRUCTOR_EXIT|[40]|01p0S000000SPIK|(Integer,String)|B.MyInnerClassB -13:50:14.2 (15018351)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this|{"myInteger":1,"myString":"One"}|0x7092f711 -13:50:14.2 (15200434)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this|{"myInteger":2,"myString":"Two"}|0x313ab1d8 -13:50:14.2 (15262943)|VARIABLE_SCOPE_BEGIN|[40]|myComplexSet|Set|true|false -13:50:14.2 (15323598)|VARIABLE_ASSIGNMENT|[40]|myComplexSet|[{"myInteger":1,"myString":"One"},{"myInteger":2,"myString":"Two"}]|0x18384fc -13:50:14.2 (15335689)|STATEMENT_EXECUTE|[42] -13:50:14.2 (15341980)|HEAP_ALLOCATE|[42]|Bytes:38 -13:50:14.2 (15394088)|USER_DEBUG|[42]|DEBUG|End placeholder for setting breakpoint -13:50:14.2 (15413615)|CONSTRUCTOR_EXIT|[5]|01p0S000000SPIK|()|B -13:50:14.2 (15423613)|VARIABLE_SCOPE_BEGIN|[5]|myB|B|true|false -13:50:14.2 (15454724)|VARIABLE_ASSIGNMENT|[5]|myB|{}|0x6ed02744 -13:50:14.2 (15465127)|STATEMENT_EXECUTE|[6] -13:50:14.2 (15472735)|HEAP_ALLOCATE|[6]|Bytes:20 -13:50:14.2 (15485883)|HEAP_ALLOCATE|[6]|Bytes:2 -13:50:14.2 (15492994)|HEAP_ALLOCATE|[6]|Bytes:2 -13:50:14.2 (15532839)|METHOD_ENTRY|[1]|01p0S000000SPIP|A.A() -13:50:14.2 (15543111)|STATEMENT_EXECUTE|[1] -13:50:14.2 (15547173)|STATEMENT_EXECUTE|[1] -13:50:14.2 (15549754)|STATEMENT_EXECUTE|[2] -13:50:14.2 (15552603)|STATEMENT_EXECUTE|[14] -13:50:14.2 (15557885)|HEAP_ALLOCATE|[14]|Bytes:1 -13:50:14.2 (15582002)|HEAP_ALLOCATE|[14]|Bytes:12 -13:50:14.2 (15606438)|CONSTRUCTOR_ENTRY|[14]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (15652679)|VARIABLE_SCOPE_BEGIN|[6]|this|A.MyInnerClassA|true|false -13:50:14.2 (15686458)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x7e70c057 -13:50:14.2 (15697409)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (15710900)|VARIABLE_ASSIGNMENT|[6]|myInteger|1 -13:50:14.2 (15718121)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (15731354)|VARIABLE_ASSIGNMENT|[6]|myString|"One" -13:50:14.2 (15740239)|STATEMENT_EXECUTE|[2] -13:50:14.2 (15743074)|STATEMENT_EXECUTE|[3] -13:50:14.2 (15745501)|STATEMENT_EXECUTE|[4] -13:50:14.2 (15766015)|STATEMENT_EXECUTE|[6] -13:50:14.2 (15768686)|STATEMENT_EXECUTE|[7] -13:50:14.2 (15773435)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (15786872)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|1|0x7e70c057 -13:50:14.2 (15795470)|STATEMENT_EXECUTE|[8] -13:50:14.2 (15803888)|VARIABLE_ASSIGNMENT|[8]|this.myString|"One"|0x7e70c057 -13:50:14.2 (15820031)|CONSTRUCTOR_EXIT|[14]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (15861120)|VARIABLE_ASSIGNMENT|[14]|A.myClass|{"myInteger":1,"myString":"One"}|0x7e70c057 -13:50:14.2 (15872373)|STATEMENT_EXECUTE|[15] -13:50:14.2 (15884778)|HEAP_ALLOCATE|[15]|Bytes:4 -13:50:14.2 (15916390)|HEAP_ALLOCATE|[15]|Bytes:4 -13:50:14.2 (15925506)|HEAP_ALLOCATE|[15]|Bytes:4 -13:50:14.2 (15955434)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 -13:50:14.2 (15974015)|VARIABLE_ASSIGNMENT|[15]|A.mySimpleList|[1,2]|0x3a644f41 -13:50:14.2 (15983554)|STATEMENT_EXECUTE|[16] -13:50:14.2 (15993268)|HEAP_ALLOCATE|[16]|Bytes:4 -13:50:14.2 (16064150)|HEAP_ALLOCATE|[16]|Bytes:12 -13:50:14.2 (16082360)|CONSTRUCTOR_ENTRY|[16]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (16097374)|VARIABLE_SCOPE_BEGIN|[6]|this|A.MyInnerClassA|true|false -13:50:14.2 (16123817)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x73fb2758 -13:50:14.2 (16134270)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (16147010)|VARIABLE_ASSIGNMENT|[6]|myInteger|1 -13:50:14.2 (16153432)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (16166884)|VARIABLE_ASSIGNMENT|[6]|myString|"One" -13:50:14.2 (16174459)|STATEMENT_EXECUTE|[2] -13:50:14.2 (16177016)|STATEMENT_EXECUTE|[3] -13:50:14.2 (16179409)|STATEMENT_EXECUTE|[4] -13:50:14.2 (16197460)|STATEMENT_EXECUTE|[6] -13:50:14.2 (16200073)|STATEMENT_EXECUTE|[7] -13:50:14.2 (16203965)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (16215831)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|1|0x73fb2758 -13:50:14.2 (16224262)|STATEMENT_EXECUTE|[8] -13:50:14.2 (16231631)|VARIABLE_ASSIGNMENT|[8]|this.myString|"One"|0x73fb2758 -13:50:14.2 (16247081)|CONSTRUCTOR_EXIT|[16]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (16264350)|HEAP_ALLOCATE|[16]|Bytes:12 -13:50:14.2 (16277777)|CONSTRUCTOR_ENTRY|[16]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (16290533)|VARIABLE_SCOPE_BEGIN|[6]|this|A.MyInnerClassA|true|false -13:50:14.2 (16314016)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x58fc39bd -13:50:14.2 (16323512)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (16335889)|VARIABLE_ASSIGNMENT|[6]|myInteger|2 -13:50:14.2 (16341853)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (16354582)|VARIABLE_ASSIGNMENT|[6]|myString|"Two" -13:50:14.2 (16361776)|STATEMENT_EXECUTE|[2] -13:50:14.2 (16364295)|STATEMENT_EXECUTE|[3] -13:50:14.2 (16366683)|STATEMENT_EXECUTE|[4] -13:50:14.2 (16381933)|STATEMENT_EXECUTE|[6] -13:50:14.2 (16384429)|STATEMENT_EXECUTE|[7] -13:50:14.2 (16387759)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (16399145)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|2|0x58fc39bd -13:50:14.2 (16406867)|STATEMENT_EXECUTE|[8] -13:50:14.2 (16433791)|VARIABLE_ASSIGNMENT|[8]|this.myString|"Two"|0x58fc39bd -13:50:14.2 (16451480)|CONSTRUCTOR_EXIT|[16]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (16481934)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 -13:50:14.2 (16518387)|VARIABLE_ASSIGNMENT|[16]|A.myComplexList|[{"myInteger":1,"myString":"One"},{"myInteger":2,"myString":"Two"}]|0x20f6388d -13:50:14.2 (16529636)|STATEMENT_EXECUTE|[17] -13:50:14.2 (16546950)|HEAP_ALLOCATE|[17]|Bytes:4 -13:50:14.2 (16594560)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4 -13:50:14.2 (16608462)|VARIABLE_ASSIGNMENT|[17]|A.myNestedList|[]|0x38f06595 -13:50:14.2 (16617390)|STATEMENT_EXECUTE|[18] -13:50:14.2 (16631223)|HEAP_ALLOCATE|[18]|Bytes:4 -13:50:14.2 (16686791)|HEAP_ALLOCATE|[18]|Bytes:4 -13:50:14.2 (16709660)|HEAP_ALLOCATE|[18]|Bytes:4 -13:50:14.2 (16742678)|VARIABLE_ASSIGNMENT|[18]|A.mySimpleMap|{"1":"One","2":"Two"}|0x129b4434 -13:50:14.2 (16753057)|STATEMENT_EXECUTE|[19] -13:50:14.2 (16766332)|HEAP_ALLOCATE|[19]|Bytes:4 -13:50:14.2 (16803986)|HEAP_ALLOCATE|[19]|Bytes:12 -13:50:14.2 (16820258)|CONSTRUCTOR_ENTRY|[19]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (16856640)|VARIABLE_SCOPE_BEGIN|[6]|this|A.MyInnerClassA|true|false -13:50:14.2 (16885291)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x2b13b60b -13:50:14.2 (16894775)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (16920462)|VARIABLE_ASSIGNMENT|[6]|myInteger|1 -13:50:14.2 (16926639)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (16939419)|VARIABLE_ASSIGNMENT|[6]|myString|"One" -13:50:14.2 (16946588)|STATEMENT_EXECUTE|[2] -13:50:14.2 (16949275)|STATEMENT_EXECUTE|[3] -13:50:14.2 (16951689)|STATEMENT_EXECUTE|[4] -13:50:14.2 (16970402)|STATEMENT_EXECUTE|[6] -13:50:14.2 (16973005)|STATEMENT_EXECUTE|[7] -13:50:14.2 (16976759)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (16989441)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|1|0x2b13b60b -13:50:14.2 (16997642)|STATEMENT_EXECUTE|[8] -13:50:14.2 (17007705)|VARIABLE_ASSIGNMENT|[8]|this.myString|"One"|0x2b13b60b -13:50:14.2 (17024821)|CONSTRUCTOR_EXIT|[19]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (17050930)|HEAP_ALLOCATE|[19]|Bytes:4 -13:50:14.2 (17067029)|HEAP_ALLOCATE|[19]|Bytes:12 -13:50:14.2 (17079385)|CONSTRUCTOR_ENTRY|[19]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (17093360)|VARIABLE_SCOPE_BEGIN|[6]|this|A.MyInnerClassA|true|false -13:50:14.2 (17117099)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x1d7d7ba -13:50:14.2 (17126463)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (17138728)|VARIABLE_ASSIGNMENT|[6]|myInteger|2 -13:50:14.2 (17145093)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (17157632)|VARIABLE_ASSIGNMENT|[6]|myString|"Two" -13:50:14.2 (17164882)|STATEMENT_EXECUTE|[2] -13:50:14.2 (17167424)|STATEMENT_EXECUTE|[3] -13:50:14.2 (17169788)|STATEMENT_EXECUTE|[4] -13:50:14.2 (17185443)|STATEMENT_EXECUTE|[6] -13:50:14.2 (17188145)|STATEMENT_EXECUTE|[7] -13:50:14.2 (17191898)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (17203123)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|2|0x1d7d7ba -13:50:14.2 (17211715)|STATEMENT_EXECUTE|[8] -13:50:14.2 (17218757)|VARIABLE_ASSIGNMENT|[8]|this.myString|"Two"|0x1d7d7ba -13:50:14.2 (17233177)|CONSTRUCTOR_EXIT|[19]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (17250097)|HEAP_ALLOCATE|[19]|Bytes:4 -13:50:14.2 (17299271)|VARIABLE_ASSIGNMENT|[19]|A.myComplexMap|{"1":{"myInteger":1,"myString":"One"},"2":{"myInteger":2,"myString":"Two"}}|0x49258950 -13:50:14.2 (17311325)|STATEMENT_EXECUTE|[20] -13:50:14.2 (17324750)|HEAP_ALLOCATE|[20]|Bytes:4 -13:50:14.2 (17337960)|HEAP_ALLOCATE|[20]|Bytes:4 -13:50:14.2 (17371305)|HEAP_ALLOCATE|[20]|Bytes:4 -13:50:14.2 (17382203)|HEAP_ALLOCATE|[20]|Bytes:4 -13:50:14.2 (17388954)|HEAP_ALLOCATE|[20]|Bytes:4 -13:50:14.2 (17435132)|VARIABLE_ASSIGNMENT|[20]|A.mySimpleSet|[1,2]|0x7f30cd91 -13:50:14.2 (17442871)|STATEMENT_EXECUTE|[21] -13:50:14.2 (17450525)|HEAP_ALLOCATE|[21]|Bytes:4 -13:50:14.2 (17458340)|HEAP_ALLOCATE|[21]|Bytes:4 -13:50:14.2 (17477972)|HEAP_ALLOCATE|[21]|Bytes:12 -13:50:14.2 (17490451)|CONSTRUCTOR_ENTRY|[21]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (17501609)|VARIABLE_SCOPE_BEGIN|[6]|this|A.MyInnerClassA|true|false -13:50:14.2 (17520007)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x43319eb2 -13:50:14.2 (17525977)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (17534525)|VARIABLE_ASSIGNMENT|[6]|myInteger|1 -13:50:14.2 (17538313)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (17546554)|VARIABLE_ASSIGNMENT|[6]|myString|"One" -13:50:14.2 (17551186)|STATEMENT_EXECUTE|[2] -13:50:14.2 (17553014)|STATEMENT_EXECUTE|[3] -13:50:14.2 (17554636)|STATEMENT_EXECUTE|[4] -13:50:14.2 (17567858)|STATEMENT_EXECUTE|[6] -13:50:14.2 (17569793)|STATEMENT_EXECUTE|[7] -13:50:14.2 (17572551)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (17580510)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|1|0x43319eb2 -13:50:14.2 (17585550)|STATEMENT_EXECUTE|[8] -13:50:14.2 (17590788)|VARIABLE_ASSIGNMENT|[8]|this.myString|"One"|0x43319eb2 -13:50:14.2 (17600714)|CONSTRUCTOR_EXIT|[21]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (17612202)|HEAP_ALLOCATE|[21]|Bytes:12 -13:50:14.2 (17620348)|CONSTRUCTOR_ENTRY|[21]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (17628350)|VARIABLE_SCOPE_BEGIN|[6]|this|A.MyInnerClassA|true|false -13:50:14.2 (17662504)|VARIABLE_ASSIGNMENT|[6]|this|{}|0x7ce4eb69 -13:50:14.2 (17673845)|VARIABLE_SCOPE_BEGIN|[6]|myInteger|Integer|false|false -13:50:14.2 (17687067)|VARIABLE_ASSIGNMENT|[6]|myInteger|2 -13:50:14.2 (17693600)|VARIABLE_SCOPE_BEGIN|[6]|myString|String|false|false -13:50:14.2 (17706767)|VARIABLE_ASSIGNMENT|[6]|myString|"Two" -13:50:14.2 (17714489)|STATEMENT_EXECUTE|[2] -13:50:14.2 (17717013)|STATEMENT_EXECUTE|[3] -13:50:14.2 (17719289)|STATEMENT_EXECUTE|[4] -13:50:14.2 (17743520)|STATEMENT_EXECUTE|[6] -13:50:14.2 (17746988)|STATEMENT_EXECUTE|[7] -13:50:14.2 (17751115)|HEAP_ALLOCATE|[7]|Bytes:4 -13:50:14.2 (17765964)|VARIABLE_ASSIGNMENT|[7]|this.myInteger|2|0x7ce4eb69 -13:50:14.2 (17774507)|STATEMENT_EXECUTE|[8] -13:50:14.2 (17783043)|VARIABLE_ASSIGNMENT|[8]|this.myString|"Two"|0x7ce4eb69 -13:50:14.2 (17801246)|CONSTRUCTOR_EXIT|[21]|01p0S000000SPIP|(Integer,String)|A.MyInnerClassA -13:50:14.2 (17922138)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this|{"myInteger":1,"myString":"One"}|0x43319eb2 -13:50:14.2 (18033831)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this|{"myInteger":2,"myString":"Two"}|0x7ce4eb69 -13:50:14.2 (18147377)|VARIABLE_ASSIGNMENT|[21]|A.myComplexSet|[{"myInteger":1,"myString":"One"},{"myInteger":2,"myString":"Two"}]|0x19ee82ac -13:50:14.2 (18175689)|METHOD_EXIT|[1]|A -13:50:14.2 (18202569)|HEAP_ALLOCATE|[6]|Bytes:8 -13:50:14.2 (18222816)|CONSTRUCTOR_ENTRY|[6]|01p0S000000SPIP|(B)|A -13:50:14.2 (18291431)|VARIABLE_SCOPE_BEGIN|[25]|this|A|true|false -13:50:14.2 (18327523)|VARIABLE_ASSIGNMENT|[25]|this|{}|0x2f405ee0 -13:50:14.2 (18339683)|VARIABLE_SCOPE_BEGIN|[25]|myB|B|true|false -13:50:14.2 (18364040)|VARIABLE_ASSIGNMENT|[25]|myB|{}|0x6ed02744 -13:50:14.2 (18376433)|STATEMENT_EXECUTE|[1] -13:50:14.2 (18379556)|STATEMENT_EXECUTE|[12] -13:50:14.2 (18405030)|STATEMENT_EXECUTE|[25] -13:50:14.2 (18408371)|STATEMENT_EXECUTE|[26] -13:50:14.2 (18418344)|VARIABLE_ASSIGNMENT|[26]|this.myB|0x6ed02744|0x2f405ee0 -13:50:14.2 (18428561)|STATEMENT_EXECUTE|[27] -13:50:14.2 (18597406)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this|{}|0x6ed02744 -13:50:14.2 (18618137)|VARIABLE_ASSIGNMENT|[EXTERNAL]|value|{"myB":"0x6ed02744"}|0x2f405ee0 -13:50:14.2 (18632610)|VARIABLE_ASSIGNMENT|[12]|this.myA|0x2f405ee0|0x6ed02744 -13:50:14.2 (18644526)|STATEMENT_EXECUTE|[29] -13:50:14.2 (18691130)|HEAP_ALLOCATE|[29]|Bytes:4 -13:50:14.2 (18704814)|VARIABLE_SCOPE_BEGIN|[29]|blobVar|Blob|false|false -13:50:14.2 (18727725)|VARIABLE_ASSIGNMENT|[29]|blobVar|BLOB(4 bytes) -13:50:14.2 (18732755)|STATEMENT_EXECUTE|[30] -13:50:14.2 (18737120)|VARIABLE_SCOPE_BEGIN|[30]|booleanVar|Boolean|false|false -13:50:14.2 (18751049)|HEAP_ALLOCATE|[30]|Bytes:5 -13:50:14.2 (18770494)|VARIABLE_ASSIGNMENT|[30]|booleanVar|true -13:50:14.2 (18774990)|STATEMENT_EXECUTE|[31] -13:50:14.2 (18840052)|HEAP_ALLOCATE|[31]|Bytes:4 -13:50:14.2 (18855358)|VARIABLE_SCOPE_BEGIN|[31]|dateVar|Date|false|false -13:50:14.2 (18890937)|VARIABLE_ASSIGNMENT|[31]|dateVar|"1990-01-03T00:00:00.000Z" -13:50:14.2 (18898028)|STATEMENT_EXECUTE|[32] -13:50:14.2 (18939621)|HEAP_ALLOCATE|[32]|Bytes:56 -13:50:14.2 (18953954)|VARIABLE_SCOPE_BEGIN|[32]|datetimeVar|Datetime|false|false -13:50:14.2 (18976888)|VARIABLE_ASSIGNMENT|[32]|datetimeVar|"1980-10-01T07:00:00.000Z" -13:50:14.2 (18981687)|STATEMENT_EXECUTE|[33] -13:50:14.2 (18997353)|HEAP_ALLOCATE|[33]|Bytes:28 -13:50:14.2 (19003089)|VARIABLE_SCOPE_BEGIN|[33]|decimalVar|Decimal|false|false -13:50:14.2 (19017609)|VARIABLE_ASSIGNMENT|[33]|decimalVar|0.002 -13:50:14.2 (19022102)|STATEMENT_EXECUTE|[34] -13:50:14.2 (19027816)|HEAP_ALLOCATE|[34]|Bytes:28 -13:50:14.2 (19036509)|HEAP_ALLOCATE|[34]|Bytes:12 -13:50:14.2 (19040462)|VARIABLE_SCOPE_BEGIN|[34]|doubleVar|Double|false|false -13:50:14.2 (19053367)|VARIABLE_ASSIGNMENT|[34]|doubleVar|3.14159 -13:50:14.2 (19057334)|STATEMENT_EXECUTE|[35] -13:50:14.2 (20307556)|HEAP_ALLOCATE|[35]|Bytes:12 -13:50:14.2 (20399167)|HEAP_ALLOCATE|[35]|Bytes:12 -13:50:14.2 (20431260)|HEAP_ALLOCATE|[35]|Bytes:12 -13:50:14.2 (20445882)|HEAP_ALLOCATE|[35]|Bytes:12 -13:50:14.2 (20462749)|VARIABLE_SCOPE_BEGIN|[35]|enumVar|A.Season|true|false -13:50:14.2 (20485893)|VARIABLE_ASSIGNMENT|[35]|enumVar|"SUMMER"|0x770a94ec -13:50:14.2 (20491772)|STATEMENT_EXECUTE|[36] -13:50:14.2 (20505163)|METHOD_ENTRY|[36]||System.UserInfo.getUserId() -13:50:14.2 (20566545)|METHOD_EXIT|[36]||System.UserInfo.getUserId() -13:50:14.2 (20580126)|HEAP_ALLOCATE|[36]|Bytes:4 -13:50:14.2 (20586736)|VARIABLE_SCOPE_BEGIN|[36]|idVar|Id|false|false -13:50:14.2 (20756211)|VARIABLE_ASSIGNMENT|[36]|idVar|"0050S0000014rYkQAI" -13:50:14.2 (20763675)|STATEMENT_EXECUTE|[37] -13:50:14.2 (20768827)|VARIABLE_SCOPE_BEGIN|[37]|integerVar|Integer|false|false -13:50:14.2 (20775919)|HEAP_ALLOCATE|[37]|Bytes:4 -13:50:14.2 (20784756)|VARIABLE_ASSIGNMENT|[37]|integerVar|42 -13:50:14.2 (20788952)|STATEMENT_EXECUTE|[38] -13:50:14.2 (20796613)|HEAP_ALLOCATE|[38]|Bytes:12 -13:50:14.2 (20800995)|VARIABLE_SCOPE_BEGIN|[38]|longVar|Long|false|false -13:50:14.2 (20809934)|VARIABLE_ASSIGNMENT|[38]|longVar|123456789 -13:50:14.2 (20813701)|STATEMENT_EXECUTE|[39] -13:50:14.2 (20816739)|VARIABLE_SCOPE_BEGIN|[39]|stringVar|String|false|false -13:50:14.2 (20828558)|VARIABLE_ASSIGNMENT|[39]|stringVar|"Lorem ipsum dolor si (61 more) ..." -13:50:14.2 (20838428)|STATEMENT_EXECUTE|[40] -13:50:14.2 (20885935)|HEAP_ALLOCATE|[40]|Bytes:4 -13:50:14.2 (20903462)|VARIABLE_SCOPE_BEGIN|[40]|timeVar|Time|false|false -13:50:14.2 (20922234)|VARIABLE_ASSIGNMENT|[40]|timeVar|3723004 -13:50:14.2 (20926981)|STATEMENT_EXECUTE|[42] -13:50:14.2 (20958017)|USER_DEBUG|[42]|DEBUG|End placeholder for setting breakpoint -13:50:14.2 (20973397)|CONSTRUCTOR_EXIT|[6]|01p0S000000SPIP|(B)|A -13:50:14.2 (20983271)|VARIABLE_SCOPE_BEGIN|[6]|myA|A|true|false -13:50:14.2 (21008929)|VARIABLE_ASSIGNMENT|[6]|myA|{"myB":"0x6ed02744"}|0x2f405ee0 -13:50:14.2 (21016273)|STATEMENT_EXECUTE|[7] -13:50:14.2 (21021648)|HEAP_ALLOCATE|[7]|Bytes:11 -13:50:14.2 (21041936)|USER_DEBUG|[7]|DEBUG|placeholder -13:50:14.21 (21056394)|CUMULATIVE_LIMIT_USAGE -13:50:14.21 (21056394)|LIMIT_USAGE_FOR_NS|(default)| - Number of SOQL queries: 0 out of 100 - Number of query rows: 0 out of 50000 - Number of SOSL queries: 0 out of 20 - Number of DML statements: 0 out of 150 - Number of DML rows: 0 out of 10000 - Maximum CPU time: 0 out of 10000 - Maximum heap size: 0 out of 6000000 - Number of callouts: 0 out of 100 - Number of Email Invocations: 0 out of 10 - Number of future calls: 0 out of 50 - Number of queueable jobs added to the queue: 0 out of 50 - Number of Mobile Apex push calls: 0 out of 10 - -13:50:14.21 (21056394)|CUMULATIVE_LIMIT_USAGE_END - -13:50:14.2 (21092256)|CODE_UNIT_FINISHED|RecursiveTest.testMain() -13:50:14.2 (22291054)|EXECUTION_FINISHED diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/statics.gold b/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/statics.gold deleted file mode 100644 index b98efe9ee6..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/statics.gold +++ /dev/null @@ -1,81 +0,0 @@ -[ - { - "id": 1005, - "source": { - "name": "StaticVarsA.cls", - "path": "", - "sourceReference": 0 - }, - "line": 9, - "column": 0, - "name": "StaticVarsA.method2()" - }, - { - "id": 1004, - "line": 5, - "column": 0, - "name": "StaticVarsB.method1()" - }, - { - "id": 1002, - "source": { - "name": "StaticVarsA.cls", - "path": "", - "sourceReference": 0 - }, - "line": 5, - "column": 0, - "name": "StaticVarsA.method1()" - }, - { - "id": 1000, - "source": { - "name": "statics.log", - "path": "", - "sourceReference": 0 - }, - "line": 2, - "column": 0, - "name": "execute_anonymous_apex" - } -] -==================== -[] -==================== -[ - { - "name": "className", - "value": "'StaticVarsA'", - "variablesReference": 0, - "type": "String", - "evaluateName": "'StaticVarsA'" - } -] -==================== -[] -==================== -[ - { - "name": "className", - "value": "'StaticVarsB'", - "variablesReference": 0, - "type": "String", - "evaluateName": "'StaticVarsB'" - } -] -==================== -[] -==================== -[ - { - "name": "className", - "value": "'StaticVarsA'", - "variablesReference": 0, - "type": "String", - "evaluateName": "'StaticVarsA'" - } -] -==================== -[] -==================== -[] \ No newline at end of file diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/statics.log b/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/statics.log deleted file mode 100644 index 2d93297f7e..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/logs/statics.log +++ /dev/null @@ -1,72 +0,0 @@ -43.0 APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;NBA,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,FINER;WAVE,INFO;WORKFLOW,INFO -Execute Anonymous: StaticVarsA.method1(); -11:52:23.9 (9765388)|USER_INFO|[EXTERNAL]|0051F0000015Tq7|test-pbea4tamqmwj@example.com|Pacific Standard Time|GMT-07:00 -11:52:23.9 (9791431)|EXECUTION_STARTED -11:52:23.9 (9795789)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex -11:52:23.9 (10843960)|HEAP_ALLOCATE|[72]|Bytes:3 -11:52:23.9 (10887493)|HEAP_ALLOCATE|[77]|Bytes:152 -11:52:23.9 (10905613)|HEAP_ALLOCATE|[342]|Bytes:408 -11:52:23.9 (10920910)|HEAP_ALLOCATE|[355]|Bytes:408 -11:52:23.9 (10934632)|HEAP_ALLOCATE|[467]|Bytes:48 -11:52:23.9 (10960996)|HEAP_ALLOCATE|[139]|Bytes:6 -11:52:23.9 (10984649)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:1 -11:52:23.9 (11059875)|STATEMENT_EXECUTE|[1] -11:52:23.9 (11063458)|STATEMENT_EXECUTE|[1] -11:52:23.9 (11111572)|HEAP_ALLOCATE|[50]|Bytes:5 -11:52:23.9 (11135245)|HEAP_ALLOCATE|[56]|Bytes:5 -11:52:23.9 (11143149)|HEAP_ALLOCATE|[64]|Bytes:7 -11:52:23.9 (11172754)|SYSTEM_MODE_ENTER|false -11:52:23.9 (11194779)|HEAP_ALLOCATE|[1]|Bytes:5 -11:52:23.9 (12070308)|VARIABLE_SCOPE_BEGIN|[2]|StaticVarsA.className|String|false|true -11:52:23.9 (12116764)|HEAP_ALLOCATE|[1]|Bytes:3 -11:52:23.9 (12123986)|HEAP_ALLOCATE|[1]|Bytes:1 -11:52:23.9 (12137802)|METHOD_ENTRY|[1]|01p1F000000zRIV|StaticVarsA.StaticVarsA() -11:52:23.9 (12143603)|STATEMENT_EXECUTE|[1] -11:52:23.9 (12147592)|STATEMENT_EXECUTE|[1] -11:52:23.9 (12149197)|STATEMENT_EXECUTE|[2] -11:52:23.9 (12152258)|HEAP_ALLOCATE|[2]|Bytes:11 -11:52:23.9 (12177390)|VARIABLE_ASSIGNMENT|[2]|StaticVarsA.className|"StaticVarsA" -11:52:23.9 (12186564)|METHOD_EXIT|[1]|StaticVarsA -11:52:23.9 (12205903)|METHOD_ENTRY|[1]|01p1F000000zRIV|StaticVarsA.method1() -11:52:23.9 (12237116)|STATEMENT_EXECUTE|[4] -11:52:23.9 (12239236)|STATEMENT_EXECUTE|[5] -11:52:23.9 (17902465)|VARIABLE_SCOPE_BEGIN|[2]|StaticVarsB.className|String|false|true -11:52:23.9 (17920524)|HEAP_ALLOCATE|[5]|Bytes:1 -11:52:23.9 (17935954)|METHOD_ENTRY|[1]|01p1F000000zRIa|StaticVarsB.StaticVarsB() -11:52:23.9 (17941523)|STATEMENT_EXECUTE|[1] -11:52:23.9 (17944959)|STATEMENT_EXECUTE|[1] -11:52:23.9 (17946659)|STATEMENT_EXECUTE|[2] -11:52:23.9 (17949907)|HEAP_ALLOCATE|[2]|Bytes:11 -11:52:23.9 (17964427)|VARIABLE_ASSIGNMENT|[2]|StaticVarsB.className|"StaticVarsB" -11:52:23.9 (17971935)|METHOD_EXIT|[1]|StaticVarsB -11:52:23.9 (17985375)|METHOD_ENTRY|[5]|01p1F000000zRIa|StaticVarsB.method1() -11:52:23.9 (18035301)|STATEMENT_EXECUTE|[4] -11:52:23.9 (18038051)|STATEMENT_EXECUTE|[5] -11:52:23.9 (18045476)|METHOD_ENTRY|[5]|01p1F000000zRIV|StaticVarsA.method2() -11:52:23.9 (18072658)|STATEMENT_EXECUTE|[8] -11:52:23.9 (18074806)|STATEMENT_EXECUTE|[9] -11:52:23.9 (18077400)|HEAP_ALLOCATE|[9]|Bytes:11 -11:52:23.9 (18119288)|USER_DEBUG|[9]|DEBUG|placeholder -11:52:23.9 (18132304)|METHOD_EXIT|[5]|01p1F000000zRIV|StaticVarsA.method2() -11:52:23.9 (18138411)|METHOD_EXIT|[5]|01p1F000000zRIa|StaticVarsB.method1() -11:52:23.9 (18142915)|METHOD_EXIT|[1]|01p1F000000zRIV|StaticVarsA.method1() -11:52:23.9 (18151101)|SYSTEM_MODE_EXIT|false -11:52:23.18 (18180949)|CUMULATIVE_LIMIT_USAGE -11:52:23.18 (18180949)|LIMIT_USAGE_FOR_NS|(default)| - Number of SOQL queries: 0 out of 100 - Number of query rows: 0 out of 50000 - Number of SOSL queries: 0 out of 20 - Number of DML statements: 0 out of 150 - Number of DML rows: 0 out of 10000 - Maximum CPU time: 0 out of 10000 - Maximum heap size: 0 out of 6000000 - Number of callouts: 0 out of 100 - Number of Email Invocations: 0 out of 10 - Number of future calls: 0 out of 50 - Number of queueable jobs added to the queue: 0 out of 50 - Number of Mobile Apex push calls: 0 out of 10 - -11:52:23.18 (18180949)|CUMULATIVE_LIMIT_USAGE_END - -11:52:23.9 (18214560)|CODE_UNIT_FINISHED|execute_anonymous_apex -11:52:23.9 (19346039)|EXECUTION_FINISHED diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/A.cls b/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/A.cls deleted file mode 100644 index 7709dde761..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/A.cls +++ /dev/null @@ -1,44 +0,0 @@ -public class A { - public class MyInnerClassA { - private Integer myInteger; - private String myString; - - public MyInnerClassA(Integer myInteger, String myString) { - this.myInteger = myInteger; - this.myString = myString; - } - } - - B myB; - - public static MyInnerClassA myClass = new MyInnerClassA(1, 'One'); - public static List mySimpleList = new List {1, 2}; - public static List myComplexList = new List {new MyInnerClassA(1, 'One'), new MyInnerClassA(2, 'Two')}; - public static List> myNestedList = new List>(); - public static Map mySimpleMap = new Map {1 => 'One', 2 => 'Two'}; - public static Map myComplexMap = new Map {1 => new MyInnerClassA(1, 'One'), 2 => new MyInnerClassA(2, 'Two')}; - public static Set mySimpleSet = new Set(new List {1, 2, 1}); - public static Set myComplexSet = new Set(new List {new MyInnerClassA(1, 'One'), new MyInnerClassA(2, 'Two')}); - - public enum Season {WINTER, SPRING, SUMMER, FALL} - - public A(B myB) { - this.myB = myB; - myB.myA = this; - - Blob blobVar = Blob.valueOf('Blob'); - Boolean booleanVar = true; - Date dateVar = Date.newInstance(1990, 1, 3); - Datetime datetimeVar = Datetime.newInstance(1980, 10, 1); - Decimal decimalVar = 0.002; - Double doubleVar = 3.14159; - Season enumVar = Season.SUMMER; - ID idVar = UserInfo.getUserId(); - Integer integerVar = 42; - Long longVar = 123456789L; - String stringVar = 'Lorem ipsum dolor sit amet, consectetur adipis; elit. Aliquam dictum cursus nulla'; - Time timeVar = Time.newInstance(1, 2, 3, 4); - - System.debug('End placeholder for setting breakpoint'); - } -} \ No newline at end of file diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/A.cls-meta.xml b/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/A.cls-meta.xml deleted file mode 100644 index 800e53cff0..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/A.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 43.0 - Active - diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/B.cls b/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/B.cls deleted file mode 100644 index e554a3117d..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/B.cls +++ /dev/null @@ -1,44 +0,0 @@ -public class B { - public class MyInnerClassB { - private Integer myInteger; - private String myString; - - public MyInnerClassB(Integer myInteger, String myString) { - this.myInteger = myInteger; - this.myString = myString; - } - } - - public A myA { get; set; } - - public static Blob blobVar = Blob.valueOf('Blob'); - public static Boolean booleanVar = true; - public static Date dateVar = Date.newInstance(1990, 1, 3); - public static Datetime datetimeVar = Datetime.newInstance(1980, 10, 1); - public static Decimal decimalVar = 0.002; - public static Double doubleVar = 3.14159; - public static Season enumVar = Season.SUMMER; - public static ID idVar = UserInfo.getUserId(); - public static Integer integerVar = 42; - public static Long longVar = 123456789L; - public static String stringVar = 'Lorem ipsum dolor sit amet, consectetur adipis; elit. Aliquam dictum cursus nulla'; - public static Time timeVar = Time.newInstance(1, 2, 3, 4); - - public enum Season {WINTER, SPRING, SUMMER, FALL} - - public B() { - MyInnerClassB myClass = new MyInnerClassB(1, 'One'); - List mySimpleList = new List {1, 2}; - List myComplexList = new List {new MyInnerClassB(1, 'One'), new MyInnerClassB(2, 'Two')}; - List> myNestedList = new List>(); - myNestedList.add(new List {'a', 'b'}); - myNestedList.add(new List {'c', 'e'}); - myNestedList.add(new List {'d', 'f'}); - Map mySimpleMap = new Map {1 => 'One', 2 => 'Two'}; - Map myComplexMap = new Map {1 => new MyInnerClassB(1, 'One'), 2 => new MyInnerClassB(2, 'Two')}; - Set mySimpleSet = new Set(new List {1, 2, 1}); - Set myComplexSet = new Set(new List {new MyInnerClassB(1, 'One'), new MyInnerClassB(2, 'Two')}); - - System.debug('End placeholder for setting breakpoint'); - } -} \ No newline at end of file diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/B.cls-meta.xml b/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/B.cls-meta.xml deleted file mode 100644 index 800e53cff0..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/B.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 43.0 - Active - diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/RecursiveTest.cls b/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/RecursiveTest.cls deleted file mode 100644 index 0121a3b158..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/RecursiveTest.cls +++ /dev/null @@ -1,9 +0,0 @@ -@IsTest -public class RecursiveTest { - @IsTest - public static void testMain() { - B myB = new B(); - A myA = new A(myB); - System.debug('placeholder'); - } -} \ No newline at end of file diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/RecursiveTest.cls-meta.xml b/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/RecursiveTest.cls-meta.xml deleted file mode 100644 index 800e53cff0..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/recursive/classes/RecursiveTest.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 43.0 - Active - diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsA.cls b/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsA.cls deleted file mode 100644 index 42d94d58a5..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsA.cls +++ /dev/null @@ -1,11 +0,0 @@ -public class StaticVarsA { - public static String className = 'StaticVarsA'; - - public static void method1() { - StaticVarsB.method1(); - } - - public static void method2() { - System.debug('placeholder'); - } -} \ No newline at end of file diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsA.cls-meta.xml b/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsA.cls-meta.xml deleted file mode 100644 index 800e53cff0..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsA.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 43.0 - Active - diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsB.cls b/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsB.cls deleted file mode 100644 index d910a59ce5..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsB.cls +++ /dev/null @@ -1,7 +0,0 @@ -public class StaticVarsB { - public static String className = 'StaticVarsB'; - - public static void method1() { - StaticVarsA.method2(); - } -} \ No newline at end of file diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsB.cls-meta.xml b/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsB.cls-meta.xml deleted file mode 100644 index 800e53cff0..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/config/statics/classes/StaticVarsB.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 43.0 - Active - diff --git a/packages/salesforcedx-apex-replay-debugger/test/integration/goldFileUtil.ts b/packages/salesforcedx-apex-replay-debugger/test/integration/goldFileUtil.ts deleted file mode 100644 index 617dc96be4..0000000000 --- a/packages/salesforcedx-apex-replay-debugger/test/integration/goldFileUtil.ts +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2018, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import * as fs from 'fs'; -import { DebugClient } from 'vscode-debugadapter-testsupport'; -import { DebugProtocol } from 'vscode-debugprotocol/lib/debugProtocol'; - -export class GoldFileUtil { - private readonly delimiter = '===================='; - private readonly dc: DebugClient; - private readonly goldFilePath: string; - private golds: string[] = []; - private goldIndex: number = 0; - - constructor(dc: DebugClient, goldFilePath: string) { - this.dc = dc; - this.goldFilePath = goldFilePath; - this.golds = fs - .readFileSync(this.goldFilePath, 'utf-8') - .split(this.delimiter); - this.golds = this.golds.map(gold => { - return gold.trim(); - }); - } - - public close(): void { - fs.writeFileSync(this.goldFilePath, this.golds.join('\n'), { - encoding: 'utf8' - }); - } - - public async assertTopState( - stoppedReason: string, - stoppedFilePath: string, - stoppedLine: number - ): Promise { - const stackTraceResponse = await this.assertStackTrace( - stoppedReason, - stoppedFilePath, - stoppedLine - ); - - const scopesResponse = await this.dc.scopesRequest({ - frameId: stackTraceResponse.body.stackFrames[0].id - }); - expect(scopesResponse.body.scopes.length).to.equal(3); - expect(scopesResponse.body.scopes[0].name).to.equal('Local'); - expect(scopesResponse.body.scopes[1].name).to.equal('Static'); - expect(scopesResponse.body.scopes[2].name).to.equal('Global'); - - const localScope = scopesResponse.body.scopes[0]; - await this.assertVariables(localScope); - - const staticScope = scopesResponse.body.scopes[1]; - await this.assertVariables(staticScope); - } - - public async assertEntireState( - stoppedReason: string, - stoppedFilePath: string, - stoppedLine: number - ): Promise { - const stackTraceResponse = await this.assertStackTrace( - stoppedReason, - stoppedFilePath, - stoppedLine - ); - - for (const frame of stackTraceResponse.body.stackFrames) { - const scopesResponse = await this.dc.scopesRequest({ - frameId: frame.id - }); - expect(scopesResponse.body.scopes.length).to.equal(3); - expect(scopesResponse.body.scopes[0].name).to.equal('Local'); - expect(scopesResponse.body.scopes[1].name).to.equal('Static'); - expect(scopesResponse.body.scopes[2].name).to.equal('Global'); - - const localScope = scopesResponse.body.scopes[0]; - await this.assertVariables(localScope); - - const staticScope = scopesResponse.body.scopes[1]; - await this.assertVariables(staticScope); - } - } - - private async assertStackTrace( - stoppedReason: string, - stoppedFilePath: string, - stoppedLine: number - ): Promise { - const stackTraceResponse = await this.dc.assertStoppedLocation( - stoppedReason, - { - path: stoppedFilePath, - line: stoppedLine - } - ); - stackTraceResponse.body.stackFrames.forEach(frame => { - if (frame.source && frame.source.path) { - frame.source.path = ''; - } - }); - const actualStack = JSON.stringify( - stackTraceResponse.body.stackFrames, - null, - 2 - ); - this.compareGoldValue(actualStack); - return stackTraceResponse; - } - - private async assertVariables(scope: DebugProtocol.Scope) { - const variablesResponse = await this.dc.variablesRequest({ - variablesReference: scope.variablesReference - }); - const actualVariables = JSON.stringify( - variablesResponse.body.variables, - null, - 2 - ); - this.compareGoldValue(actualVariables); - } - - private compareGoldValue(actual: string) { - if (this.goldIndex < this.golds.length) { - const expected = this.golds[this.goldIndex++]; - expect(actual).to.equal(expected); - } - } -} diff --git a/packages/salesforcedx-sobjects-faux-generator/package.json b/packages/salesforcedx-sobjects-faux-generator/package.json index 78f1081f02..e9a3206f10 100644 --- a/packages/salesforcedx-sobjects-faux-generator/package.json +++ b/packages/salesforcedx-sobjects-faux-generator/package.json @@ -10,7 +10,7 @@ }, "main": "out/src", "dependencies": { - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/salesforcedx-utils-vscode": "60.7.0", "jsforce": "2.0.0-beta.29", "shelljs": "0.8.5" diff --git a/packages/salesforcedx-sobjects-faux-generator/scripts/regenerateMinsSObjects.ts b/packages/salesforcedx-sobjects-faux-generator/scripts/regenerateMinsSObjects.ts index e673d61d2d..0c4f9b84aa 100755 --- a/packages/salesforcedx-sobjects-faux-generator/scripts/regenerateMinsSObjects.ts +++ b/packages/salesforcedx-sobjects-faux-generator/scripts/regenerateMinsSObjects.ts @@ -19,7 +19,7 @@ import { SObjectShortDescription } from '../src/describe'; import { OrgObjectDetailRetriever } from '../src/retriever'; import { SObject } from '../src/types'; -import { Connection, Org } from '@salesforce/core'; +import { Connection, Org } from '@salesforce/core-bundle'; // tslint:disable-next-line:no-floating-promises (async () => { diff --git a/packages/salesforcedx-sobjects-faux-generator/src/describe/sObjectDescribe.ts b/packages/salesforcedx-sobjects-faux-generator/src/describe/sObjectDescribe.ts index 66c6dc0740..8910cceef8 100644 --- a/packages/salesforcedx-sobjects-faux-generator/src/describe/sObjectDescribe.ts +++ b/packages/salesforcedx-sobjects-faux-generator/src/describe/sObjectDescribe.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { DescribeGlobalResult, DescribeSObjectResult, Field } from 'jsforce'; import { CLIENT_ID } from '../constants'; import { BatchRequest, BatchResponse, SObject } from '../types'; diff --git a/packages/salesforcedx-sobjects-faux-generator/src/retriever/orgObjectRetriever.ts b/packages/salesforcedx-sobjects-faux-generator/src/retriever/orgObjectRetriever.ts index 826715479f..e46439c2f4 100644 --- a/packages/salesforcedx-sobjects-faux-generator/src/retriever/orgObjectRetriever.ts +++ b/packages/salesforcedx-sobjects-faux-generator/src/retriever/orgObjectRetriever.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { SObjectDescribe, SObjectSelector, diff --git a/packages/salesforcedx-sobjects-faux-generator/src/transformer/transformerFactory.ts b/packages/salesforcedx-sobjects-faux-generator/src/transformer/transformerFactory.ts index 537d574ca7..6c26b3fc52 100644 --- a/packages/salesforcedx-sobjects-faux-generator/src/transformer/transformerFactory.ts +++ b/packages/salesforcedx-sobjects-faux-generator/src/transformer/transformerFactory.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { AuthInfo, Connection, SfProject } from '@salesforce/core'; +import { AuthInfo, Connection, SfProject } from '@salesforce/core-bundle'; import { ConfigUtil, WorkspaceContextUtil diff --git a/packages/salesforcedx-sobjects-faux-generator/test/integration/integrationTestUtil.ts b/packages/salesforcedx-sobjects-faux-generator/test/integration/integrationTestUtil.ts deleted file mode 100644 index 076f3f5a89..0000000000 --- a/packages/salesforcedx-sobjects-faux-generator/test/integration/integrationTestUtil.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2017, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { CancellationToken } from '../../src/transformer'; - -// Added to be able to test cancellation of FauxClassGenerator.generate -// mimic of vscode but shouldn't depend on vscode in this package - -class StandardCancellationToken implements CancellationToken { - public isCancellationRequested = false; -} -export class CancellationTokenSource { - public token: CancellationToken = new StandardCancellationToken(); - - public cancel(): void { - this.token.isCancellationRequested = true; - } - - public dispose(): void { - this.cancel(); - } -} diff --git a/packages/salesforcedx-sobjects-faux-generator/test/integration/mockData.ts b/packages/salesforcedx-sobjects-faux-generator/test/integration/mockData.ts deleted file mode 100644 index 1cec13c412..0000000000 --- a/packages/salesforcedx-sobjects-faux-generator/test/integration/mockData.ts +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { SObject } from '../../src/types'; - -export const mockAPIResponse = { - hasErrors: false, - results: [ - { - statusCode: 200, - result: { - actionOverrides: [], - activateable: false, - childRelationships: [], - compactLayoutable: false, - createable: false, - custom: false, - customSetting: false, - deletable: false, - deprecatedAndHidden: false, - feedEnabled: false, - fields: [ - { - aggregatable: true, - aiPredictionField: false, - autoNumber: false, - byteLength: 18, - calculated: false, - calculatedFormula: null, - cascadeDelete: false, - caseSensitive: false, - compoundFieldName: null, - controllerName: null, - createable: false, - custom: false, - defaultValue: null, - defaultValueFormula: null, - defaultedOnCreate: true, - dependentPicklist: false, - deprecatedAndHidden: false, - digits: 0, - displayLocationInDecimal: false, - encrypted: false, - externalId: false, - extraTypeInfo: null, - filterable: true, - filteredLookupInfo: null, - formulaTreatNullNumberAsZero: false, - groupable: true, - highScaleNumber: false, - htmlFormatted: false, - idLookup: true, - inlineHelpText: null, - label: 'Apex Page Info ID', - length: 18, - mask: null, - maskType: null, - name: 'Id', - nameField: false, - namePointing: false, - nillable: false, - permissionable: false, - picklistValues: [], - polymorphicForeignKey: false, - precision: 0, - queryByDistance: false, - referenceTargetField: null, - referenceTo: [], - relationshipName: null, - relationshipOrder: null, - restrictedDelete: false, - restrictedPicklist: false, - scale: 0, - searchPrefilterable: false, - soapType: 'tns:ID', - sortable: true, - type: 'id', - unique: false, - updateable: false, - writeRequiresMasterRead: false - } - ], - hasSubtypes: false, - isSubtype: false, - keyPrefix: '4ve', - label: 'Apex Page Info', - labelPlural: 'Apex Pages Info', - layoutable: false, - listviewable: null, - lookupLayoutable: null, - mergeable: false, - mruEnabled: false, - name: 'ApexPageInfo', - namedLayoutInfos: [], - networkScopeFieldName: null, - queryable: true, - recordTypeInfos: [], - replicateable: false, - retrieveable: false, - searchLayoutable: false, - searchable: false, - supportedScopes: [{ label: 'All apex pages info', name: 'everything' }], - triggerable: false, - undeletable: false, - updateable: false, - urls: { - rowTemplate: '/services/data/v50.0/sobjects/ApexPageInfo/{ID}', - defaultValues: - '/services/data/v50.0/sobjects/ApexPageInfo/defaultValues?recordTypeId&fields', - describe: '/services/data/v50.0/sobjects/ApexPageInfo/describe', - sobject: '/services/data/v50.0/sobjects/ApexPageInfo' - } - } - } - ] -}; - -// Minimal version of result[0] above, using smaller SObject representation -export const mockMinimizedResponseResult: SObject = { - childRelationships: [], - custom: false, - fields: [ - { - aggregatable: true, - custom: false, - defaultValue: null, - extraTypeInfo: null, - filterable: true, - groupable: true, - inlineHelpText: null, - label: 'Apex Page Info ID', - name: 'Id', - nillable: false, - picklistValues: [], - referenceTo: [], - relationshipName: null, - sortable: true, - type: 'id' - } - ], - label: 'Apex Page Info', - name: 'ApexPageInfo', - queryable: true -}; - -export const mockBatchResponse = { - hasErrors: false, - results: [ - { - statusCode: 200, - result: { name: 'Account' } - }, - { - statusCode: 200, - result: { name: 'Attachment' } - }, - { - statusCode: 200, - result: { name: 'Case' } - }, - { - statusCode: 200, - result: { name: 'Contact' } - }, - { - statusCode: 200, - result: { name: 'Contract' } - }, - { - statusCode: 200, - result: { name: 'Lead' } - }, - { - statusCode: 200, - result: { name: 'Note' } - }, - { - statusCode: 200, - result: { name: 'Opportunity' } - }, - { - statusCode: 200, - result: { name: 'Order' } - }, - { - statusCode: 200, - result: { name: 'Pricebook2' } - }, - { - statusCode: 200, - result: { name: 'PricebookEntry' } - }, - { - statusCode: 200, - result: { name: 'Product2' } - }, - { - statusCode: 200, - result: { name: 'RecordType' } - }, - { - statusCode: 200, - result: { name: 'Report' } - }, - { - statusCode: 200, - result: { name: 'Task' } - }, - { - statusCode: 200, - result: { name: 'User' } - } - ] -}; diff --git a/packages/salesforcedx-sobjects-faux-generator/test/integration/sObjectDescribe.test.ts b/packages/salesforcedx-sobjects-faux-generator/test/integration/sObjectDescribe.test.ts deleted file mode 100644 index 1ffcf91163..0000000000 --- a/packages/salesforcedx-sobjects-faux-generator/test/integration/sObjectDescribe.test.ts +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { AuthInfo, Connection } from '@salesforce/core'; -import { fail } from 'assert'; -import { expect } from 'chai'; -import { createSandbox } from 'sinon'; -import { SObjectDescribe } from '../../src/describe'; -import { mockAPIResponse, mockMinimizedResponseResult } from './mockData'; - -const CONNECTION_DATA = { - accessToken: '00Dxx000thisIsATestToken', - instanceUrl: 'https://na1.salesforce.com' -}; - -const SOBJECTS_DESCRIBE_SAMPLE = { - sobjects: [ - { custom: true, name: 'MyCustomObj1' }, - { custom: true, name: 'MyCustomObj2' }, - { custom: true, name: 'Custom_History_Obj' }, - { custom: true, name: 'MyCustomObj1Share' }, - { custom: true, name: 'MyCustomObj2History' }, - { custom: true, name: 'MyCustomObj1Feed' }, - { custom: true, name: 'MyCustomObj2Event' }, - { custom: false, name: 'Account' }, - { custom: false, name: 'Contact' }, - { custom: false, name: 'Lead' }, - { custom: false, name: 'Event' } - ] -}; -const env = createSandbox(); - -// tslint:disable:no-unused-expression -describe('Fetch sObjects', () => { - const USERNAME = 'test@example.com'; - let connection: Connection; - let sobjectdescribe: SObjectDescribe; - let describeGlobalStub: any; - - beforeEach(async () => { - env.stub(AuthInfo, 'create').resolves({ - getConnectionOptions: () => CONNECTION_DATA, - getUsername: () => USERNAME - }); - connection = await Connection.create({ - authInfo: await AuthInfo.create({ - username: USERNAME - }) - }); - sobjectdescribe = new SObjectDescribe(connection); - describeGlobalStub = env.stub(connection, 'describeGlobal'); - }); - - afterEach(() => env.restore()); - - it('Should throw exception when describeGlobal fails', async () => { - describeGlobalStub.throws( - new Error('Unexpected error when running describeGlobal') - ); - try { - await sobjectdescribe.describeGlobal(); - fail('test should have failed with an api exception'); - } catch (e) { - expect(e.message).contains( - 'Unexpected error when running describeGlobal' - ); - } - }); - - it('Should return all sobjects when running describeGlobal', async () => { - describeGlobalStub.resolves({ - sobjects: [ - { custom: true, name: 'MyCustomObj1' }, - { custom: true, name: 'MyCustomObj2' }, - { custom: false, name: 'Account' }, - { custom: false, name: 'Contact' } - ] - }); - - const results = await sobjectdescribe.describeGlobal(); - expect(results.length).to.eql(4); - expect(results).to.deep.equal([ - { custom: true, name: 'MyCustomObj1' }, - { custom: true, name: 'MyCustomObj2' }, - { custom: false, name: 'Account' }, - { custom: false, name: 'Contact' } - ]); - }); - - it('Should build the sobject describe url', () => { - expect(sobjectdescribe.buildSObjectDescribeURL('testObject')).to.equal( - 'v50.0/sobjects/testObject/describe' - ); - }); - - it('Should build the batch request url', async () => { - expect(sobjectdescribe.buildBatchRequestURL()).to.equal( - 'https://na1.salesforce.com/services/data/v50.0/composite/batch' - ); - }); - - it('Should build the api version', () => { - expect(sobjectdescribe.getVersion()).to.equal('v50.0'); - }); - - it('Should create batch request body', () => { - const sobjectTypes = ['object1', 'object2', 'object3']; - const testBatchReq = { - batchRequests: [ - { method: 'GET', url: 'v50.0/sobjects/object1/describe' }, - { method: 'GET', url: 'v50.0/sobjects/object2/describe' }, - { method: 'GET', url: 'v50.0/sobjects/object3/describe' } - ] - }; - const requestBody = sobjectdescribe.buildBatchRequestBody(sobjectTypes); - expect(requestBody).to.deep.equals(testBatchReq); - }); - - it('Should create the correct request options', async () => { - const testBatchReq = { - batchRequests: [ - { method: 'GET', url: 'v50.0/sobjects/object1/describe' }, - { method: 'GET', url: 'v50.0/sobjects/object2/describe' }, - { method: 'GET', url: 'v50.0/sobjects/object3/describe' } - ] - }; - const requestStub = env.stub(connection, 'request'); - await sobjectdescribe.runRequest(testBatchReq); - expect(requestStub.firstCall.args[0]).to.deep.equal({ - method: 'POST', - url: `${connection.instanceUrl}/services/data/v50.0/composite/batch`, - body: JSON.stringify(testBatchReq), - headers: { - 'User-Agent': 'salesforcedx-extension', - 'Sforce-Call-Options': 'client=sfdx-vscode' - } - }); - }); - - it('Should return sobjects when calling describeSObjectBatch', async () => { - const sobjectTypes = ['ApexPageInfo']; - env.stub(connection, 'request').resolves(mockAPIResponse); - - const batchResponse = await sobjectdescribe.describeSObjectBatchRequest( - sobjectTypes - ); - - expect(batchResponse.length).to.be.equal(1); - expect(batchResponse[0]).to.deep.equal(mockMinimizedResponseResult); - }); - - it('Should handle describe call returning no sobjects when calling describeSObjectBatch', async () => { - const sobjectTypes = ['ApexPageInfo']; - env.stub(connection, 'request').resolves({ - results: undefined - }); - - const batchResponse = await sobjectdescribe.describeSObjectBatchRequest( - sobjectTypes - ); - - expect(batchResponse.length).to.be.equal(0); - }); - - it('Should handle empty describe calls responses when calling describeSObjectBatch', async () => { - const sobjectTypes = ['ApexPageInfo']; - env.stub(connection, 'request').resolves({}); - - const batchResponse = await sobjectdescribe.describeSObjectBatchRequest( - sobjectTypes - ); - - expect(batchResponse.length).to.be.equal(0); - }); - - it('Should throw error when response errors out', async () => { - const sobjectTypes = ['ApexPageInfo']; - env.stub(connection, 'request').rejects({ - status: 400, - body: 'Unexpected error' - }); - - try { - await sobjectdescribe.describeSObjectBatchRequest(sobjectTypes); - fail('An error was expected'); - } catch (err) { - expect(err).to.be.equal('Unexpected error'); - } - }); -}); diff --git a/packages/salesforcedx-sobjects-faux-generator/test/integration/sobjectTransformer.test.ts b/packages/salesforcedx-sobjects-faux-generator/test/integration/sobjectTransformer.test.ts deleted file mode 100644 index 4750d51539..0000000000 --- a/packages/salesforcedx-sobjects-faux-generator/test/integration/sobjectTransformer.test.ts +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { AuthInfo } from '@salesforce/core'; -import { projectPaths } from '@salesforce/salesforcedx-utils-vscode'; -import { fail } from 'assert'; -import { expect } from 'chai'; -import { EventEmitter } from 'events'; -import * as fs from 'fs'; -import * as os from 'os'; -import * as path from 'path'; -import { createSandbox } from 'sinon'; -import { SObjectTransformer } from '../../src'; -import { - ERROR_EVENT, - EXIT_EVENT, - FAILURE_CODE, - STDERR_EVENT, - STDOUT_EVENT, - SUCCESS_CODE -} from '../../src/constants'; -import { nls } from '../../src/messages'; -import { MinObjectRetriever } from '../../src/retriever'; -import { CancellationTokenSource } from './integrationTestUtil'; - -const PROJECT_NAME = `project_${new Date().getTime()}`; -const CONNECTION_DATA = { - accessToken: '00Dxx000thisIsATestToken', - instanceUrl: 'https://na1.salesforce.com' -}; - -const env = createSandbox(); -const tempFolder = path.join(os.tmpdir(), PROJECT_NAME); - -// tslint:disable:no-unused-expression -describe('Transform sobject definitions', () => { - let cancellationTokenSource: CancellationTokenSource; - let emitter: EventEmitter; - - beforeEach(() => { - env.stub(projectPaths, 'stateFolder').returns(tempFolder); - emitter = new EventEmitter(); - cancellationTokenSource = new CancellationTokenSource(); - env.stub(AuthInfo, 'create').returns({ - getConnectionOptions: () => CONNECTION_DATA - }); - }); - - afterEach(() => env.restore()); - - it('Should emit an error event on retriever failure', async () => { - env.stub(fs, 'existsSync').returns(true); - - let errorMessage = ''; - let exitCode: number = SUCCESS_CODE; - let rejectOutput: any; - const transformer = new SObjectTransformer( - emitter, - [ - { - retrieve: () => { - throw new Error('Retrieve Error'); - } - } - ], - [], - cancellationTokenSource.token - ); - emitter.addListener(ERROR_EVENT, (data: Error) => { - errorMessage = data.message; - }); - emitter.addListener(EXIT_EVENT, (data: number) => { - exitCode = data; - }); - - try { - await transformer.transform(); - } catch ({ error }) { - rejectOutput = error; - } - - expect(rejectOutput.message).to.contain('Retrieve Error'); - expect(errorMessage).to.contain('Retrieve Error'); - expect(exitCode).to.equal(FAILURE_CODE); - }); - - it('Should emit an error event on generator failure', async () => { - env.stub(fs, 'existsSync').returns(true); - - let errorMessage = ''; - let exitCode: number = SUCCESS_CODE; - let rejectOutput: any; - const transformer = new SObjectTransformer( - emitter, - [], - [ - { - generate: () => { - throw new Error('Generate Error'); - } - } - ], - cancellationTokenSource.token - ); - emitter.addListener(ERROR_EVENT, (data: Error) => { - errorMessage = data.message; - }); - emitter.addListener(EXIT_EVENT, (data: number) => { - exitCode = data; - }); - - try { - await transformer.transform(); - } catch ({ error }) { - rejectOutput = error; - } - - expect(rejectOutput.message).to.contain('Generate Error'); - expect(errorMessage).to.contain('Generate Error'); - expect(exitCode).to.equal(FAILURE_CODE); - }); - - it('Should fail if outside a DX project', async () => { - env.stub(fs, 'existsSync').returns(false); - - const transformer = new SObjectTransformer( - emitter, - [], - [], - cancellationTokenSource.token - ); - - try { - await transformer.transform(); - fail('transformer should have thrown an error'); - } catch ({ error }) { - expect(error.message).to.contain( - nls.localize('no_generate_if_not_in_project', '') - ); - return; - } - }); - - it('Should be cancellable', async () => { - env.stub(fs, 'existsSync').returns(true); - env.stub(MinObjectRetriever.prototype, 'retrieve').returns([]); - - const transformer = new SObjectTransformer( - emitter, - [new MinObjectRetriever()], - [], - cancellationTokenSource.token - ); - cancellationTokenSource.cancel(); - - const result = await transformer.transform(); - expect(result.data.cancelled).to.be.true; - }); - - it('Should emit message to stderr on failure', async () => { - env.stub(fs, 'existsSync').returns(true); - - let stderrInfo = ''; - let rejectOutput: any; - const transformer = new SObjectTransformer( - emitter, - [], - [ - { - generate: () => { - throw new Error('Broken Generator'); - } - } - ], - cancellationTokenSource.token - ); - emitter.addListener(STDERR_EVENT, (data: string) => { - stderrInfo = data; - }); - - try { - await transformer.transform(); - } catch ({ error }) { - rejectOutput = error; - } - - expect(rejectOutput.message).to.contain('Broken Generator'); - expect(stderrInfo).to.contain('Broken Generator'); - }); - - describe('Check results', () => { - beforeEach(() => { - env.stub(fs, 'existsSync').returns(true); - }); - - it('Should emit an exit event with code success code 0 on success', async () => { - let exitCode = FAILURE_CODE; - - const transformer = new SObjectTransformer( - emitter, - [], - [], - cancellationTokenSource.token - ); - emitter.addListener(EXIT_EVENT, (data: number) => { - exitCode = data; - }); - - const result = await transformer.transform(); - expect(result.error).to.be.undefined; - expect(exitCode).to.equal(SUCCESS_CODE); - }); - - it('Should log the number of standard objects processed on success', async () => { - const transformer = new SObjectTransformer( - emitter, - [ - { - retrieve: out => { - out.addStandard([ - { - name: 'Account', - label: 'Account', - queryable: true, - custom: false, - fields: [], - childRelationships: [] - } - ]); - return Promise.resolve(); - } - } - ], - [], - cancellationTokenSource.token - ); - - let stdoutInfo = ''; - emitter.addListener(STDOUT_EVENT, (data: string) => { - stdoutInfo = data; - }); - - const result = await transformer.transform(); - - expect(result.error).to.be.undefined; - expect(result.data.standardObjects).to.eql(1); - expect(stdoutInfo).to.contain( - nls.localize('processed_sobjects_length_text', 1, 'Standard') - ); - }); - - it('Should log the number of custom objects processed on success', async () => { - const transformer = new SObjectTransformer( - emitter, - [ - { - retrieve: out => { - out.addCustom([ - { - name: 'Custom_1', - label: 'Custom_1', - queryable: true, - custom: true, - fields: [], - childRelationships: [] - } - ]); - return Promise.resolve(); - } - } - ], - [], - cancellationTokenSource.token - ); - - let stdoutInfo = ''; - emitter.addListener(STDOUT_EVENT, (data: string) => { - stdoutInfo = data; - }); - - const result = await transformer.transform(); - - expect(result.error).to.be.undefined; - expect(result.data.customObjects).to.eql(1); - expect(stdoutInfo).to.contain( - nls.localize('processed_sobjects_length_text', 1, 'Custom') - ); - }); - }); -}); diff --git a/packages/salesforcedx-utils-vscode/package.json b/packages/salesforcedx-utils-vscode/package.json index 278c3f5bab..5f9d26b322 100644 --- a/packages/salesforcedx-utils-vscode/package.json +++ b/packages/salesforcedx-utils-vscode/package.json @@ -10,9 +10,9 @@ ], "main": "out/src", "dependencies": { - "@salesforce/core": "6.5.2", - "@salesforce/source-deploy-retrieve": "10.3.3", - "@salesforce/source-tracking": "5.1.11", + "@salesforce/core-bundle": "6.7.4", + "@salesforce/source-deploy-retrieve-bundle": "10.9.0", + "@salesforce/source-tracking-bundle": "5.2.2", "applicationinsights": "1.0.7", "cross-spawn": "7.0.3", "rxjs": "^5.4.1", diff --git a/packages/salesforcedx-utils-vscode/src/config/configUtil.ts b/packages/salesforcedx-utils-vscode/src/config/configUtil.ts index d750f2f2ef..26ca5e19b6 100644 --- a/packages/salesforcedx-utils-vscode/src/config/configUtil.ts +++ b/packages/salesforcedx-utils-vscode/src/config/configUtil.ts @@ -11,7 +11,7 @@ import { Org, OrgConfigProperties, StateAggregator -} from '@salesforce/core'; +} from '@salesforce/core-bundle'; import { workspaceUtils } from '..'; import { SF_CONFIG_DISABLE_TELEMETRY, diff --git a/packages/salesforcedx-utils-vscode/src/context/workspaceContextUtil.ts b/packages/salesforcedx-utils-vscode/src/context/workspaceContextUtil.ts index ee0f7fa21a..e8f3783c44 100644 --- a/packages/salesforcedx-utils-vscode/src/context/workspaceContextUtil.ts +++ b/packages/salesforcedx-utils-vscode/src/context/workspaceContextUtil.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { AuthInfo, Connection, StateAggregator } from '@salesforce/core'; +import { AuthInfo, Connection, StateAggregator } from '@salesforce/core-bundle'; import * as vscode from 'vscode'; import { ConfigAggregatorProvider, TelemetryService } from '..'; import { ConfigUtil } from '../config/configUtil'; diff --git a/packages/salesforcedx-utils-vscode/src/helpers/paths.ts b/packages/salesforcedx-utils-vscode/src/helpers/paths.ts index 73bb0b1280..3b7ea97480 100644 --- a/packages/salesforcedx-utils-vscode/src/helpers/paths.ts +++ b/packages/salesforcedx-utils-vscode/src/helpers/paths.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Global } from '@salesforce/core'; +import { Global } from '@salesforce/core-bundle'; import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; diff --git a/packages/salesforcedx-utils-vscode/src/helpers/traceFlags.ts b/packages/salesforcedx-utils-vscode/src/helpers/traceFlags.ts index 7fcba5bb5c..7984847c73 100644 --- a/packages/salesforcedx-utils-vscode/src/helpers/traceFlags.ts +++ b/packages/salesforcedx-utils-vscode/src/helpers/traceFlags.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { TraceFlagsRemover } from '../helpers'; import { nls } from '../messages'; diff --git a/packages/salesforcedx-utils-vscode/src/helpers/traceFlagsRemover.ts b/packages/salesforcedx-utils-vscode/src/helpers/traceFlagsRemover.ts index 656d98fe0a..6c1a36bd7d 100644 --- a/packages/salesforcedx-utils-vscode/src/helpers/traceFlagsRemover.ts +++ b/packages/salesforcedx-utils-vscode/src/helpers/traceFlagsRemover.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; /** * TraceFlagsRemover is a singleton which deletes trace flags created by the extensions. diff --git a/packages/salesforcedx-utils-vscode/src/providers/configAggregatorProvider.ts b/packages/salesforcedx-utils-vscode/src/providers/configAggregatorProvider.ts index 9cb50ed01e..f311d9b227 100644 --- a/packages/salesforcedx-utils-vscode/src/providers/configAggregatorProvider.ts +++ b/packages/salesforcedx-utils-vscode/src/providers/configAggregatorProvider.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { ConfigAggregator } from '@salesforce/core'; +import { ConfigAggregator } from '@salesforce/core-bundle'; import { workspaceUtils } from '../workspaces'; /* diff --git a/packages/salesforcedx-utils-vscode/src/providers/sourceTrackingProvider.ts b/packages/salesforcedx-utils-vscode/src/providers/sourceTrackingProvider.ts index 58c4737efa..be1f369d27 100644 --- a/packages/salesforcedx-utils-vscode/src/providers/sourceTrackingProvider.ts +++ b/packages/salesforcedx-utils-vscode/src/providers/sourceTrackingProvider.ts @@ -5,11 +5,11 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection, Org, SfProject } from '@salesforce/core'; +import { Connection, Org, SfProject } from '@salesforce/core-bundle'; import { SourceTracking, SourceTrackingOptions -} from '@salesforce/source-tracking'; +} from '@salesforce/source-tracking-bundle'; /* * The SourceTrackingProvider class is used to instantiate diff --git a/packages/salesforcedx-utils-vscode/src/services/sourceTrackingService.ts b/packages/salesforcedx-utils-vscode/src/services/sourceTrackingService.ts index 5760398f4f..f6f9f02e04 100644 --- a/packages/salesforcedx-utils-vscode/src/services/sourceTrackingService.ts +++ b/packages/salesforcedx-utils-vscode/src/services/sourceTrackingService.ts @@ -5,9 +5,9 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; -import { RetrieveResult } from '@salesforce/source-deploy-retrieve'; -import { SourceTracking, StatusOutputRow } from '@salesforce/source-tracking'; +import { Connection } from '@salesforce/core-bundle'; +import { RetrieveResult } from '@salesforce/source-deploy-retrieve-bundle'; +import { SourceTracking, StatusOutputRow } from '@salesforce/source-tracking-bundle'; import { WorkspaceContextUtil } from '../context/workspaceContextUtil'; import { nls } from '../messages'; import { Row, Table } from '../output'; diff --git a/packages/salesforcedx-utils-vscode/test/jest/config/configUtil.test.ts b/packages/salesforcedx-utils-vscode/test/jest/config/configUtil.test.ts index dbeda5528c..f60aaa867f 100644 --- a/packages/salesforcedx-utils-vscode/test/jest/config/configUtil.test.ts +++ b/packages/salesforcedx-utils-vscode/test/jest/config/configUtil.test.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Config, Org, StateAggregator } from '@salesforce/core'; +import { Config, Org, StateAggregator } from '@salesforce/core-bundle'; import { ConfigUtil, TARGET_ORG_KEY, workspaceUtils } from '../../../src'; import { ConfigAggregatorProvider } from './../../../src/providers/configAggregatorProvider'; diff --git a/packages/salesforcedx-utils-vscode/test/jest/context/workspaceContextUtil.test.ts b/packages/salesforcedx-utils-vscode/test/jest/context/workspaceContextUtil.test.ts index 822141381b..c8d9f8028d 100644 --- a/packages/salesforcedx-utils-vscode/test/jest/context/workspaceContextUtil.test.ts +++ b/packages/salesforcedx-utils-vscode/test/jest/context/workspaceContextUtil.test.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { AuthInfo, Connection, StateAggregator } from '@salesforce/core'; +import { AuthInfo, Connection, StateAggregator } from '@salesforce/core-bundle'; import * as vscode from 'vscode'; import { ConfigAggregatorProvider, @@ -15,7 +15,7 @@ import { import { ConfigUtil } from '../../../src/config/configUtil'; import { WORKSPACE_CONTEXT_ORG_ID_ERROR } from '../../../src/context/workspaceContextUtil'; import { nls } from '../../../src/messages'; -jest.mock('@salesforce/core'); +jest.mock('@salesforce/core-bundle'); jest.mock('../../../src/config/configUtil'); const authInfoMock = jest.mocked(AuthInfo); diff --git a/packages/salesforcedx-utils-vscode/test/jest/helpers/paths.test.ts b/packages/salesforcedx-utils-vscode/test/jest/helpers/paths.test.ts index 433337d0ab..5bdf670cdb 100644 --- a/packages/salesforcedx-utils-vscode/test/jest/helpers/paths.test.ts +++ b/packages/salesforcedx-utils-vscode/test/jest/helpers/paths.test.ts @@ -25,7 +25,7 @@ import { TOOLS } from '../../../src/helpers/paths'; -jest.mock('@salesforce/core', () => { +jest.mock('@salesforce/core-bundle', () => { return { Global: { SFDX_STATE_FOLDER: '.sfdx', @@ -34,7 +34,7 @@ jest.mock('@salesforce/core', () => { }; }); -jest.mock('@salesforce/source-tracking', () => { +jest.mock('@salesforce/source-tracking-bundle', () => { return {}; }); diff --git a/packages/salesforcedx-utils-vscode/test/jest/services/source-tracking/sourceTrackingService.test.ts b/packages/salesforcedx-utils-vscode/test/jest/services/source-tracking/sourceTrackingService.test.ts index 55c4daadea..6f381b40b1 100644 --- a/packages/salesforcedx-utils-vscode/test/jest/services/source-tracking/sourceTrackingService.test.ts +++ b/packages/salesforcedx-utils-vscode/test/jest/services/source-tracking/sourceTrackingService.test.ts @@ -8,8 +8,8 @@ import { WorkspaceContextUtil } from '../../../../src'; import { SourceTrackingService } from '../../../../src/services'; import { testData } from './testData'; -jest.mock('@salesforce/core', () => ({ - ...jest.requireActual('@salesforce/core'), +jest.mock('@salesforce/core-bundle', () => ({ + ...jest.requireActual('@salesforce/core-bundle'), Org: { create: jest.fn() }, SfProject: { resolve: jest.fn() } })); diff --git a/packages/salesforcedx-vscode-apex-debugger/package.json b/packages/salesforcedx-vscode-apex-debugger/package.json index 4673123069..1f18e8ed99 100644 --- a/packages/salesforcedx-vscode-apex-debugger/package.json +++ b/packages/salesforcedx-vscode-apex-debugger/package.json @@ -59,7 +59,7 @@ "scripts": { "bundle:extension": "npm run bundle:extension:build && npm run bundle:extension:copy", "bundle:extension:copy": "cp ../salesforcedx-apex-debugger/dist/apexdebug.js ./dist/", - "bundle:extension:build": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core --external:@salesforce/source-tracking --minify", + "bundle:extension:build": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core-bundle --external:@salesforce/source-tracking-bundle --minify", "vscode:prepublish": "npm prune --production", "vscode:package": "ts-node ../../scripts/vsce-bundled-extension.ts", "vscode:sha256": "node ../../scripts/generate-sha256.js >> ../../SHA256", @@ -96,8 +96,8 @@ "main": "dist/index.js", "dependencies": { "applicationinsights": "1.0.7", - "@salesforce/core": "6.5.2", - "@salesforce/source-tracking": "5.1.11" + "@salesforce/core-bundle": "6.7.4", + "@salesforce/source-tracking-bundle": "5.2.2" }, "devDependencies": {} } diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/package.json b/packages/salesforcedx-vscode-apex-replay-debugger/package.json index be5f560a3f..aaab051aac 100644 --- a/packages/salesforcedx-vscode-apex-replay-debugger/package.json +++ b/packages/salesforcedx-vscode-apex-replay-debugger/package.json @@ -180,8 +180,8 @@ } }, "dependencies": { - "@salesforce/apex-node": "4.0.2", - "@salesforce/core": "6.5.2", + "@salesforce/apex-node-bundle": "4.0.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/salesforcedx-apex-replay-debugger": "60.7.0", "@salesforce/salesforcedx-utils": "60.7.0", "@salesforce/salesforcedx-utils-vscode": "60.7.0", @@ -248,8 +248,8 @@ ], "packageUpdates": { "dependencies": { - "@salesforce/core": "6.5.2", - "@salesforce/source-tracking": "5.1.11", + "@salesforce/core-bundle": "6.7.4", + "@salesforce/source-tracking-bundle": "5.2.2", "applicationinsights": "1.0.7" }, "devDependencies": {}, @@ -263,7 +263,7 @@ }, "scripts": { "bundle:extension": "npm run bundle:extension:build && npm run bundle:extension:copy", - "bundle:extension:build": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core --external:@salesforce/source-tracking --external:applicationinsights --minify", + "bundle:extension:build": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core-bundle --external:@salesforce/source-tracking-bundle --external:applicationinsights --minify", "bundle:extension:copy": "cp ../salesforcedx-apex-replay-debugger/dist/apexreplaydebug.js ./dist/", "clean": "shx rm -rf node_modules && shx rm -rf out && shx rm -rf coverage && shx rm -rf .nyc_output", "compile": "tsc -p ./", diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/src/commands/quickLaunch.ts b/packages/salesforcedx-vscode-apex-replay-debugger/src/commands/quickLaunch.ts index f1b87aa468..4b3e8e5798 100644 --- a/packages/salesforcedx-vscode-apex-replay-debugger/src/commands/quickLaunch.ts +++ b/packages/salesforcedx-vscode-apex-replay-debugger/src/commands/quickLaunch.ts @@ -12,8 +12,8 @@ import { TestLevel, TestResult, TestService -} from '@salesforce/apex-node'; -import { Connection } from '@salesforce/core'; +} from '@salesforce/apex-node-bundle'; +import { Connection } from '@salesforce/core-bundle'; import { ContinueResponse, LibraryCommandletExecutor, diff --git a/packages/salesforcedx-vscode-apex-replay-debugger/src/context/workspaceContext.ts b/packages/salesforcedx-vscode-apex-replay-debugger/src/context/workspaceContext.ts index 061818e460..c79257cde3 100644 --- a/packages/salesforcedx-vscode-apex-replay-debugger/src/context/workspaceContext.ts +++ b/packages/salesforcedx-vscode-apex-replay-debugger/src/context/workspaceContext.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { WorkspaceContextUtil } from '@salesforce/salesforcedx-utils-vscode'; import * as vscode from 'vscode'; diff --git a/packages/salesforcedx-vscode-apex/package.json b/packages/salesforcedx-vscode-apex/package.json index cb1d3bd180..9bb86fefaf 100644 --- a/packages/salesforcedx-vscode-apex/package.json +++ b/packages/salesforcedx-vscode-apex/package.json @@ -320,9 +320,9 @@ } }, "dependencies": { - "@salesforce/apex-node": "4.0.2", + "@salesforce/apex-node-bundle": "4.0.2", "@salesforce/apex-tmlanguage": "1.8.0", - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/salesforcedx-utils-vscode": "60.7.0", "expand-home-dir": "0.0.3", "find-java-home": "0.2.0", @@ -392,9 +392,9 @@ "packageUpdates": { "dependencies": { "@salesforce/apex-tmlanguage": "1.4.0", - "@salesforce/core": "6.5.2", - "@salesforce/source-tracking": "5.1.11", - "@salesforce/templates": "^60.1.0", + "@salesforce/core-bundle": "6.7.4", + "@salesforce/source-tracking-bundle": "5.2.2", + "@salesforce/templates-bundle": "60.1.1-beta", "applicationinsights": "1.0.7", "shelljs": "0.8.5" }, @@ -410,7 +410,7 @@ }, "scripts": { "bundle:extension": "npm run bundle:extension:build && npm run bundle:extension:copy", - "bundle:extension:build": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core --external:applicationinsights --external:shelljs --external:@salesforce/source-deploy-retrieve --external:@salesforce/source-tracking --minify", + "bundle:extension:build": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core-bundle --external:applicationinsights --external:shelljs --external:@salesforce/source-deploy-retrieve-bundle --external:@salesforce/source-tracking-bundle --minify", "bundle:extension:copy": "cp ./out/apex-jorje-lsp.jar ./dist/", "clean": "shx rm -rf node_modules && cd out && node ../../../scripts/clean-all-but-jar.js && shx rm -rf coverage && shx rm -rf .nyc_output", "compile": "tsc -p ./", diff --git a/packages/salesforcedx-vscode-apex/src/codecoverage/colorizer.ts b/packages/salesforcedx-vscode-apex/src/codecoverage/colorizer.ts index 37ad5fa1f1..d565a608c3 100644 --- a/packages/salesforcedx-vscode-apex/src/codecoverage/colorizer.ts +++ b/packages/salesforcedx-vscode-apex/src/codecoverage/colorizer.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { CodeCoverageResult } from '@salesforce/apex-node'; +import { CodeCoverageResult } from '@salesforce/apex-node-bundle'; import { SFDX_FOLDER, projectPaths diff --git a/packages/salesforcedx-vscode-apex/src/commands/anonApexExecute.ts b/packages/salesforcedx-vscode-apex/src/commands/anonApexExecute.ts index a1cba47039..02bdb0b470 100644 --- a/packages/salesforcedx-vscode-apex/src/commands/anonApexExecute.ts +++ b/packages/salesforcedx-vscode-apex/src/commands/anonApexExecute.ts @@ -7,8 +7,8 @@ import { ExecuteAnonymousResponse, ExecuteService -} from '@salesforce/apex-node'; -import { Connection } from '@salesforce/core'; +} from '@salesforce/apex-node-bundle'; +import { Connection } from '@salesforce/core-bundle'; import { CancelResponse, ContinueResponse, diff --git a/packages/salesforcedx-vscode-apex/src/commands/apexLogGet.ts b/packages/salesforcedx-vscode-apex/src/commands/apexLogGet.ts index f6b8a58606..c86ee5ff21 100644 --- a/packages/salesforcedx-vscode-apex/src/commands/apexLogGet.ts +++ b/packages/salesforcedx-vscode-apex/src/commands/apexLogGet.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { LogRecord, LogService } from '@salesforce/apex-node'; +import { LogRecord, LogService } from '@salesforce/apex-node-bundle'; import { CancelResponse, ContinueResponse, diff --git a/packages/salesforcedx-vscode-apex/src/commands/apexTestRun.ts b/packages/salesforcedx-vscode-apex/src/commands/apexTestRun.ts index f116fb0031..f00a0b484b 100644 --- a/packages/salesforcedx-vscode-apex/src/commands/apexTestRun.ts +++ b/packages/salesforcedx-vscode-apex/src/commands/apexTestRun.ts @@ -14,7 +14,7 @@ import { TestLevel, TestResult, TestService -} from '@salesforce/apex-node'; +} from '@salesforce/apex-node-bundle'; import { getRootWorkspacePath, hasRootWorkspace, diff --git a/packages/salesforcedx-vscode-apex/src/commands/apexTestRunCodeAction.ts b/packages/salesforcedx-vscode-apex/src/commands/apexTestRunCodeAction.ts index 2c67649472..405a3f7e15 100644 --- a/packages/salesforcedx-vscode-apex/src/commands/apexTestRunCodeAction.ts +++ b/packages/salesforcedx-vscode-apex/src/commands/apexTestRunCodeAction.ts @@ -13,9 +13,9 @@ import { TestLevel, TestResult, TestService -} from '@salesforce/apex-node'; -import { ApexDiagnostic } from '@salesforce/apex-node/lib/src/utils'; -import { NamedPackageDir, SfProject } from '@salesforce/core'; +} from '@salesforce/apex-node-bundle'; +import { ApexDiagnostic } from '@salesforce/apex-node-bundle/lib/src/utils'; +import { NamedPackageDir, SfProject } from '@salesforce/core-bundle'; import { notificationService } from '@salesforce/salesforcedx-utils-vscode'; import { ContinueResponse, diff --git a/packages/salesforcedx-vscode-apex/src/commands/apexTestSuite.ts b/packages/salesforcedx-vscode-apex/src/commands/apexTestSuite.ts index 2e72991e4f..259ada3d34 100644 --- a/packages/salesforcedx-vscode-apex/src/commands/apexTestSuite.ts +++ b/packages/salesforcedx-vscode-apex/src/commands/apexTestSuite.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { TestService } from '@salesforce/apex-node'; +import { TestService } from '@salesforce/apex-node-bundle'; import { CancelResponse, ContinueResponse, diff --git a/packages/salesforcedx-vscode-apex/src/context/workspaceContext.ts b/packages/salesforcedx-vscode-apex/src/context/workspaceContext.ts index 061818e460..c79257cde3 100644 --- a/packages/salesforcedx-vscode-apex/src/context/workspaceContext.ts +++ b/packages/salesforcedx-vscode-apex/src/context/workspaceContext.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { WorkspaceContextUtil } from '@salesforce/salesforcedx-utils-vscode'; import * as vscode from 'vscode'; diff --git a/packages/salesforcedx-vscode-apex/src/views/testOutlineProvider.ts b/packages/salesforcedx-vscode-apex/src/views/testOutlineProvider.ts index 25c02b09d8..734ba4ae68 100644 --- a/packages/salesforcedx-vscode-apex/src/views/testOutlineProvider.ts +++ b/packages/salesforcedx-vscode-apex/src/views/testOutlineProvider.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { TestResult } from '@salesforce/apex-node'; +import { TestResult } from '@salesforce/apex-node-bundle'; import { readFileSync } from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; diff --git a/packages/salesforcedx-vscode-core/package.json b/packages/salesforcedx-vscode-core/package.json index bd705392c7..d8306de3d9 100644 --- a/packages/salesforcedx-vscode-core/package.json +++ b/packages/salesforcedx-vscode-core/package.json @@ -24,12 +24,12 @@ "Other" ], "dependencies": { - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/salesforcedx-sobjects-faux-generator": "60.7.0", "@salesforce/salesforcedx-utils-vscode": "60.7.0", "@salesforce/schemas": "^1.6.1", - "@salesforce/source-deploy-retrieve": "10.3.3", - "@salesforce/templates": "^60.1.0", + "@salesforce/source-deploy-retrieve-bundle": "10.9.0", + "@salesforce/templates-bundle": "60.1.1-beta", "@salesforce/ts-types": "2.0.9", "adm-zip": "0.5.10", "applicationinsights": "1.0.7", @@ -96,17 +96,17 @@ "main": "dist/index.js", "dependencies": { "applicationinsights": "1.0.7", - "@salesforce/core": "6.5.2", - "@salesforce/source-tracking": "5.1.11", - "@salesforce/templates": "^60.1.0", - "@salesforce/source-deploy-retrieve": "10.3.3", + "@salesforce/core-bundle": "6.7.4", + "@salesforce/source-tracking-bundle": "5.2.2", + "@salesforce/templates-bundle": "60.1.1-beta", + "@salesforce/source-deploy-retrieve-bundle": "10.9.0", "shelljs": "0.8.5" }, "devDependencies": {} } }, "scripts": { - "bundle:extension": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core --external:applicationinsights --external:shelljs --external:@salesforce/source-tracking --external:@salesforce/templates --external:@salesforce/source-deploy-retrieve --minify", + "bundle:extension": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core-bundle --external:applicationinsights --external:shelljs --external:@salesforce/source-tracking-bundle --external:@salesforce/templates-bundle --external:@salesforce/source-deploy-retrieve-bundle --minify", "vscode:prepublish": "npm prune --production", "vscode:package": "ts-node ../../scripts/vsce-bundled-extension.ts", "vscode:sha256": "node ../../scripts/generate-sha256.js >> ../../SHA256", diff --git a/packages/salesforcedx-vscode-core/src/commands/auth/orgLoginAccessToken.ts b/packages/salesforcedx-vscode-core/src/commands/auth/orgLoginAccessToken.ts index 80ee1c8471..f1c8af2776 100644 --- a/packages/salesforcedx-vscode-core/src/commands/auth/orgLoginAccessToken.ts +++ b/packages/salesforcedx-vscode-core/src/commands/auth/orgLoginAccessToken.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { AuthInfo, AuthSideEffects } from '@salesforce/core'; +import { AuthInfo, AuthSideEffects } from '@salesforce/core-bundle'; import { LibraryCommandletExecutor } from '@salesforce/salesforcedx-utils-vscode'; import { ContinueResponse } from '@salesforce/salesforcedx-utils-vscode'; import * as vscode from 'vscode'; diff --git a/packages/salesforcedx-vscode-core/src/commands/auth/orgLogout.ts b/packages/salesforcedx-vscode-core/src/commands/auth/orgLogout.ts index 87183c1bb3..e1d920eae2 100644 --- a/packages/salesforcedx-vscode-core/src/commands/auth/orgLogout.ts +++ b/packages/salesforcedx-vscode-core/src/commands/auth/orgLogout.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { AuthRemover } from '@salesforce/core'; +import { AuthRemover } from '@salesforce/core-bundle'; import { Command, ConfigUtil, diff --git a/packages/salesforcedx-vscode-core/src/commands/baseDeployRetrieve.ts b/packages/salesforcedx-vscode-core/src/commands/baseDeployRetrieve.ts index 28261e20f0..0cf8f0ac1b 100644 --- a/packages/salesforcedx-vscode-core/src/commands/baseDeployRetrieve.ts +++ b/packages/salesforcedx-vscode-core/src/commands/baseDeployRetrieve.ts @@ -20,11 +20,11 @@ import { MetadataApiDeploy, MetadataApiRetrieve, RetrieveResult -} from '@salesforce/source-deploy-retrieve'; +} from '@salesforce/source-deploy-retrieve-bundle'; import { ComponentStatus, RequestStatus -} from '@salesforce/source-deploy-retrieve/lib/src/client/types'; +} from '@salesforce/source-deploy-retrieve-bundle/lib/src/client/types'; import { join } from 'path'; import * as vscode from 'vscode'; import { channelService, OUTPUT_CHANNEL } from '../channels'; diff --git a/packages/salesforcedx-vscode-core/src/commands/deployManifest.ts b/packages/salesforcedx-vscode-core/src/commands/deployManifest.ts index 660a24183d..790eaa6e17 100644 --- a/packages/salesforcedx-vscode-core/src/commands/deployManifest.ts +++ b/packages/salesforcedx-vscode-core/src/commands/deployManifest.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { ContinueResponse } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import { join } from 'path'; import * as vscode from 'vscode'; import { channelService } from '../channels'; diff --git a/packages/salesforcedx-vscode-core/src/commands/deploySourcePath.ts b/packages/salesforcedx-vscode-core/src/commands/deploySourcePath.ts index 6f59be1764..e97fd0e85a 100644 --- a/packages/salesforcedx-vscode-core/src/commands/deploySourcePath.ts +++ b/packages/salesforcedx-vscode-core/src/commands/deploySourcePath.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { ContinueResponse } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import * as vscode from 'vscode'; import { channelService } from '../channels'; import { getConflictMessagesFor } from '../conflict/messages'; diff --git a/packages/salesforcedx-vscode-core/src/commands/projectGenerate.ts b/packages/salesforcedx-vscode-core/src/commands/projectGenerate.ts index 3d24477881..e608136337 100644 --- a/packages/salesforcedx-vscode-core/src/commands/projectGenerate.ts +++ b/packages/salesforcedx-vscode-core/src/commands/projectGenerate.ts @@ -11,7 +11,7 @@ import { ParametersGatherer, PostconditionChecker } from '@salesforce/salesforcedx-utils-vscode'; -import { ProjectOptions, TemplateType } from '@salesforce/templates'; +import { ProjectOptions, TemplateType } from '@salesforce/templates-bundle'; import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; diff --git a/packages/salesforcedx-vscode-core/src/commands/projectGenerateManifest.ts b/packages/salesforcedx-vscode-core/src/commands/projectGenerateManifest.ts index 35f4e1dc5f..faff6fc4fe 100644 --- a/packages/salesforcedx-vscode-core/src/commands/projectGenerateManifest.ts +++ b/packages/salesforcedx-vscode-core/src/commands/projectGenerateManifest.ts @@ -7,7 +7,7 @@ import { LibraryCommandletExecutor } from '@salesforce/salesforcedx-utils-vscode'; import { ContinueResponse } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import * as fs from 'fs'; import { join, parse } from 'path'; import { format } from 'util'; diff --git a/packages/salesforcedx-vscode-core/src/commands/renameLightningComponent.ts b/packages/salesforcedx-vscode-core/src/commands/renameLightningComponent.ts index c507757cc2..4369683519 100644 --- a/packages/salesforcedx-vscode-core/src/commands/renameLightningComponent.ts +++ b/packages/salesforcedx-vscode-core/src/commands/renameLightningComponent.ts @@ -12,7 +12,7 @@ import { ContinueResponse, ParametersGatherer } from '@salesforce/salesforcedx-utils-vscode'; -import { CreateUtil } from '@salesforce/templates'; +import { CreateUtil } from '@salesforce/templates-bundle'; import * as fs from 'fs'; import * as path from 'path'; import { format } from 'util'; diff --git a/packages/salesforcedx-vscode-core/src/commands/retrieveManifest.ts b/packages/salesforcedx-vscode-core/src/commands/retrieveManifest.ts index 27312eb2fc..f2e563f2f5 100644 --- a/packages/salesforcedx-vscode-core/src/commands/retrieveManifest.ts +++ b/packages/salesforcedx-vscode-core/src/commands/retrieveManifest.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { ContinueResponse } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import { join } from 'path'; import * as vscode from 'vscode'; import { channelService } from '../channels'; diff --git a/packages/salesforcedx-vscode-core/src/commands/retrieveMetadata/libraryRetrieveSourcePathExecutor.ts b/packages/salesforcedx-vscode-core/src/commands/retrieveMetadata/libraryRetrieveSourcePathExecutor.ts index 9a4e28b67d..a6c593a6ef 100644 --- a/packages/salesforcedx-vscode-core/src/commands/retrieveMetadata/libraryRetrieveSourcePathExecutor.ts +++ b/packages/salesforcedx-vscode-core/src/commands/retrieveMetadata/libraryRetrieveSourcePathExecutor.ts @@ -12,8 +12,8 @@ import { import { ComponentSet, RetrieveResult -} from '@salesforce/source-deploy-retrieve'; -import { ComponentLike } from '@salesforce/source-deploy-retrieve/lib/src/resolve/types'; +} from '@salesforce/source-deploy-retrieve-bundle'; +import { ComponentLike } from '@salesforce/source-deploy-retrieve-bundle/lib/src/resolve/types'; import * as path from 'path'; import * as vscode from 'vscode'; import { nls } from '../../messages'; diff --git a/packages/salesforcedx-vscode-core/src/commands/retrieveSourcePath.ts b/packages/salesforcedx-vscode-core/src/commands/retrieveSourcePath.ts index 4801b06e84..9c876b3935 100644 --- a/packages/salesforcedx-vscode-core/src/commands/retrieveSourcePath.ts +++ b/packages/salesforcedx-vscode-core/src/commands/retrieveSourcePath.ts @@ -9,7 +9,7 @@ import { ContinueResponse, PostconditionChecker } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import * as vscode from 'vscode'; import { channelService } from '../channels'; import { nls } from '../messages'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/analyticsGenerateTemplate.ts b/packages/salesforcedx-vscode-core/src/commands/templates/analyticsGenerateTemplate.ts index 1277016412..cac66be7c1 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/analyticsGenerateTemplate.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/analyticsGenerateTemplate.ts @@ -11,7 +11,7 @@ import { DirFileNameSelection, ParametersGatherer } from '@salesforce/salesforcedx-utils-vscode'; -import { AnalyticsTemplateOptions, TemplateType } from '@salesforce/templates'; +import { AnalyticsTemplateOptions, TemplateType } from '@salesforce/templates-bundle'; import * as vscode from 'vscode'; import { nls } from '../../messages'; import { diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateClassExecutor.ts b/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateClassExecutor.ts index fc0610e9d2..2f4fc988d9 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateClassExecutor.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateClassExecutor.ts @@ -6,7 +6,7 @@ */ import { DirFileNameSelection } from '@salesforce/salesforcedx-utils-vscode'; -import { ApexClassOptions, TemplateType } from '@salesforce/templates'; +import { ApexClassOptions, TemplateType } from '@salesforce/templates-bundle'; import { nls } from '../../../messages'; import { LibraryBaseTemplateCommand } from '../libraryBaseTemplateCommand'; import { APEX_CLASS_TYPE } from '../metadataTypeConstants'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateTriggerExecutor.ts b/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateTriggerExecutor.ts index 57d22bdb0e..3f77ddc510 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateTriggerExecutor.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateTriggerExecutor.ts @@ -6,7 +6,7 @@ */ import { DirFileNameSelection } from '@salesforce/salesforcedx-utils-vscode'; -import { ApexTriggerOptions, TemplateType } from '@salesforce/templates'; +import { ApexTriggerOptions, TemplateType } from '@salesforce/templates-bundle'; import { nls } from '../../../messages'; import { LibraryBaseTemplateCommand } from '../libraryBaseTemplateCommand'; import { APEX_TRIGGER_TYPE } from '../metadataTypeConstants'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateUnitTestClassExecutor.ts b/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateUnitTestClassExecutor.ts index 90bc16f99c..cd2f0ae73a 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateUnitTestClassExecutor.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/executors/LibraryApexGenerateUnitTestClassExecutor.ts @@ -6,7 +6,7 @@ */ import { DirFileNameSelection } from '@salesforce/salesforcedx-utils-vscode'; -import { ApexClassOptions, TemplateType } from '@salesforce/templates'; +import { ApexClassOptions, TemplateType } from '@salesforce/templates-bundle'; import { nls } from '../../../messages'; import { LibraryBaseTemplateCommand } from '../libraryBaseTemplateCommand'; import { APEX_CLASS_TYPE } from '../metadataTypeConstants'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/libraryBaseTemplateCommand.ts b/packages/salesforcedx-vscode-core/src/commands/templates/libraryBaseTemplateCommand.ts index a749a7d4dd..f1ab11ce09 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/libraryBaseTemplateCommand.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/libraryBaseTemplateCommand.ts @@ -11,7 +11,7 @@ import { TemplateOptions, TemplateService, TemplateType -} from '@salesforce/templates'; +} from '@salesforce/templates-bundle'; import * as path from 'path'; import { ProgressLocation, window, workspace } from 'vscode'; import { channelService } from '../../channels'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateApp.ts b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateApp.ts index 9d75c3890a..858614b6be 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateApp.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateApp.ts @@ -9,7 +9,7 @@ import { DirFileNameSelection, LocalComponent } from '@salesforce/salesforcedx-utils-vscode'; -import { LightningAppOptions, TemplateType } from '@salesforce/templates'; +import { LightningAppOptions, TemplateType } from '@salesforce/templates-bundle'; import { Uri } from 'vscode'; import { nls } from '../../messages'; import { salesforceCoreSettings } from '../../settings'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateAuraComponent.ts b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateAuraComponent.ts index a5530af8ca..1b36b329af 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateAuraComponent.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateAuraComponent.ts @@ -9,7 +9,7 @@ import { DirFileNameSelection, LocalComponent } from '@salesforce/salesforcedx-utils-vscode'; -import { LightningComponentOptions, TemplateType } from '@salesforce/templates'; +import { LightningComponentOptions, TemplateType } from '@salesforce/templates-bundle'; import { Uri } from 'vscode'; import { nls } from '../../messages'; import { salesforceCoreSettings } from '../../settings'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateEvent.ts b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateEvent.ts index 00305e539f..55981e8035 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateEvent.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateEvent.ts @@ -9,7 +9,7 @@ import { DirFileNameSelection, LocalComponent } from '@salesforce/salesforcedx-utils-vscode'; -import { LightningEventOptions, TemplateType } from '@salesforce/templates'; +import { LightningEventOptions, TemplateType } from '@salesforce/templates-bundle'; import { Uri } from 'vscode'; import { nls } from '../../messages'; import { salesforceCoreSettings } from '../../settings'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateInterface.ts b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateInterface.ts index ef07b5b46e..d56a2143a5 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateInterface.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateInterface.ts @@ -9,7 +9,7 @@ import { DirFileNameSelection, LocalComponent } from '@salesforce/salesforcedx-utils-vscode'; -import { LightningInterfaceOptions, TemplateType } from '@salesforce/templates'; +import { LightningInterfaceOptions, TemplateType } from '@salesforce/templates-bundle'; import { Uri } from 'vscode'; import { nls } from '../../messages'; import { salesforceCoreSettings } from '../../settings'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateLwc.ts b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateLwc.ts index 2ad5b315c2..05346853ea 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateLwc.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/lightningGenerateLwc.ts @@ -9,7 +9,7 @@ import { DirFileNameSelection, LocalComponent } from '@salesforce/salesforcedx-utils-vscode'; -import { LightningComponentOptions, TemplateType } from '@salesforce/templates'; +import { LightningComponentOptions, TemplateType } from '@salesforce/templates-bundle'; import { Uri } from 'vscode'; import { nls } from '../../messages'; import { salesforceCoreSettings } from '../../settings'; diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/visualforceGenerateComponent.ts b/packages/salesforcedx-vscode-core/src/commands/templates/visualforceGenerateComponent.ts index 695e5a3493..c30e41d711 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/visualforceGenerateComponent.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/visualforceGenerateComponent.ts @@ -12,7 +12,7 @@ import { import { TemplateType, VisualforceComponentOptions -} from '@salesforce/templates'; +} from '@salesforce/templates-bundle'; import { nls } from '../../messages'; import { CompositeParametersGatherer, diff --git a/packages/salesforcedx-vscode-core/src/commands/templates/visualforceGeneratePage.ts b/packages/salesforcedx-vscode-core/src/commands/templates/visualforceGeneratePage.ts index 7f274fb76e..f1dbd11536 100644 --- a/packages/salesforcedx-vscode-core/src/commands/templates/visualforceGeneratePage.ts +++ b/packages/salesforcedx-vscode-core/src/commands/templates/visualforceGeneratePage.ts @@ -9,7 +9,7 @@ import { DirFileNameSelection, LocalComponent } from '@salesforce/salesforcedx-utils-vscode'; -import { TemplateType, VisualforcePageOptions } from '@salesforce/templates'; +import { TemplateType, VisualforcePageOptions } from '@salesforce/templates-bundle'; import { nls } from '../../messages'; import { CompositeParametersGatherer, diff --git a/packages/salesforcedx-vscode-core/src/commands/util/createComponentCount.ts b/packages/salesforcedx-vscode-core/src/commands/util/createComponentCount.ts index ca259489e4..e238b7e075 100644 --- a/packages/salesforcedx-vscode-core/src/commands/util/createComponentCount.ts +++ b/packages/salesforcedx-vscode-core/src/commands/util/createComponentCount.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { MetadataComponent } from '@salesforce/source-deploy-retrieve'; +import { MetadataComponent } from '@salesforce/source-deploy-retrieve-bundle'; export function createComponentCount(components: Iterable) { const quantities: { [type: string]: number } = {}; diff --git a/packages/salesforcedx-vscode-core/src/commands/util/parameterGatherers.ts b/packages/salesforcedx-vscode-core/src/commands/util/parameterGatherers.ts index 649c58ed4c..1ad1152d5f 100644 --- a/packages/salesforcedx-vscode-core/src/commands/util/parameterGatherers.ts +++ b/packages/salesforcedx-vscode-core/src/commands/util/parameterGatherers.ts @@ -10,7 +10,7 @@ import { LocalComponent, ParametersGatherer } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet, registry } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet, registry } from '@salesforce/source-deploy-retrieve-bundle'; import * as glob from 'glob'; import * as path from 'path'; import * as vscode from 'vscode'; diff --git a/packages/salesforcedx-vscode-core/src/conflict/componentDiffer.ts b/packages/salesforcedx-vscode-core/src/conflict/componentDiffer.ts index 97186afbdd..25b73bf17a 100644 --- a/packages/salesforcedx-vscode-core/src/conflict/componentDiffer.ts +++ b/packages/salesforcedx-vscode-core/src/conflict/componentDiffer.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { SourceComponent } from '@salesforce/source-deploy-retrieve'; +import { SourceComponent } from '@salesforce/source-deploy-retrieve-bundle'; import * as fs from 'fs'; import * as path from 'path'; diff --git a/packages/salesforcedx-vscode-core/src/conflict/directoryDiffer.ts b/packages/salesforcedx-vscode-core/src/conflict/directoryDiffer.ts index e1bbd5f498..4d3a2757bb 100644 --- a/packages/salesforcedx-vscode-core/src/conflict/directoryDiffer.ts +++ b/packages/salesforcedx-vscode-core/src/conflict/directoryDiffer.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { SourceComponent } from '@salesforce/source-deploy-retrieve'; +import { SourceComponent } from '@salesforce/source-deploy-retrieve-bundle'; import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; diff --git a/packages/salesforcedx-vscode-core/src/conflict/metadataCacheService.ts b/packages/salesforcedx-vscode-core/src/conflict/metadataCacheService.ts index a17a5dfd75..0bb3fa0846 100644 --- a/packages/salesforcedx-vscode-core/src/conflict/metadataCacheService.ts +++ b/packages/salesforcedx-vscode-core/src/conflict/metadataCacheService.ts @@ -11,7 +11,7 @@ import { MetadataApiRetrieve, RetrieveResult, SourceComponent -} from '@salesforce/source-deploy-retrieve'; +} from '@salesforce/source-deploy-retrieve-bundle'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; diff --git a/packages/salesforcedx-vscode-core/src/conflict/persistentStorageService.ts b/packages/salesforcedx-vscode-core/src/conflict/persistentStorageService.ts index 0ca72f3278..e0f175e540 100644 --- a/packages/salesforcedx-vscode-core/src/conflict/persistentStorageService.ts +++ b/packages/salesforcedx-vscode-core/src/conflict/persistentStorageService.ts @@ -12,7 +12,7 @@ import { import { DeployResult, FileProperties -} from '@salesforce/source-deploy-retrieve'; +} from '@salesforce/source-deploy-retrieve-bundle'; import { ExtensionContext, Memento } from 'vscode'; import { WorkspaceContext } from '../context'; import { nls } from '../messages'; diff --git a/packages/salesforcedx-vscode-core/src/context/workspaceContext.ts b/packages/salesforcedx-vscode-core/src/context/workspaceContext.ts index 2fbd2960bc..d349479db7 100644 --- a/packages/salesforcedx-vscode-core/src/context/workspaceContext.ts +++ b/packages/salesforcedx-vscode-core/src/context/workspaceContext.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { OrgUserInfo, WorkspaceContextUtil diff --git a/packages/salesforcedx-vscode-core/src/context/workspaceOrgType.ts b/packages/salesforcedx-vscode-core/src/context/workspaceOrgType.ts index 8f80b18ffb..43f0c7d30d 100644 --- a/packages/salesforcedx-vscode-core/src/context/workspaceOrgType.ts +++ b/packages/salesforcedx-vscode-core/src/context/workspaceOrgType.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Org } from '@salesforce/core'; +import { Org } from '@salesforce/core-bundle'; import * as vscode from 'vscode'; import { OrgAuthInfo, workspaceUtils } from '../util'; import { WorkspaceContext } from './workspaceContext'; diff --git a/packages/salesforcedx-vscode-core/src/diagnostics/diagnostics.ts b/packages/salesforcedx-vscode-core/src/diagnostics/diagnostics.ts index b84c15673e..93387dab0f 100644 --- a/packages/salesforcedx-vscode-core/src/diagnostics/diagnostics.ts +++ b/packages/salesforcedx-vscode-core/src/diagnostics/diagnostics.ts @@ -9,7 +9,7 @@ import { getRootWorkspacePath } from '@salesforce/salesforcedx-utils-vscode'; import { ComponentStatus, DeployResult -} from '@salesforce/source-deploy-retrieve'; +} from '@salesforce/source-deploy-retrieve-bundle'; import * as path from 'path'; import * as vscode from 'vscode'; import { SfCommandletExecutor } from '../commands/util'; diff --git a/packages/salesforcedx-vscode-core/src/orgBrowser/metadataCmp.ts b/packages/salesforcedx-vscode-core/src/orgBrowser/metadataCmp.ts index 96d5c11597..67aa27ddc8 100644 --- a/packages/salesforcedx-vscode-core/src/orgBrowser/metadataCmp.ts +++ b/packages/salesforcedx-vscode-core/src/orgBrowser/metadataCmp.ts @@ -4,13 +4,13 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { isNullOrUndefined, projectPaths, workspaceUtils } from '@salesforce/salesforcedx-utils-vscode'; -import { standardValueSet } from '@salesforce/source-deploy-retrieve/lib/src/registry'; +import { standardValueSet } from '@salesforce/source-deploy-retrieve-bundle/lib/src/registry'; import * as fs from 'fs'; import { ListMetadataQuery } from 'jsforce/api/metadata'; import * as path from 'path'; diff --git a/packages/salesforcedx-vscode-core/src/orgPicker/orgList.ts b/packages/salesforcedx-vscode-core/src/orgPicker/orgList.ts index 89251441e8..7e730ebc06 100644 --- a/packages/salesforcedx-vscode-core/src/orgPicker/orgList.ts +++ b/packages/salesforcedx-vscode-core/src/orgPicker/orgList.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { AuthFields, AuthInfo, OrgAuthorization } from '@salesforce/core'; +import { AuthFields, AuthInfo, OrgAuthorization } from '@salesforce/core-bundle'; import { CancelResponse, ConfigUtil, diff --git a/packages/salesforcedx-vscode-core/src/salesforceProject/salesforceProjectConfig.ts b/packages/salesforcedx-vscode-core/src/salesforceProject/salesforceProjectConfig.ts index 4c4860e3fa..0db020a173 100644 --- a/packages/salesforcedx-vscode-core/src/salesforceProject/salesforceProjectConfig.ts +++ b/packages/salesforcedx-vscode-core/src/salesforceProject/salesforceProjectConfig.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { SfProject, SfProjectJson } from '@salesforce/core'; +import { SfProject, SfProjectJson } from '@salesforce/core-bundle'; import { JsonArray } from '@salesforce/ts-types'; import * as path from 'path'; import * as vscode from 'vscode'; diff --git a/packages/salesforcedx-vscode-core/src/services/sdr/componentSetUtils.ts b/packages/salesforcedx-vscode-core/src/services/sdr/componentSetUtils.ts index 6a8f96a302..451fda8445 100644 --- a/packages/salesforcedx-vscode-core/src/services/sdr/componentSetUtils.ts +++ b/packages/salesforcedx-vscode-core/src/services/sdr/componentSetUtils.ts @@ -6,7 +6,7 @@ */ import { ConfigUtil } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import { WorkspaceContext } from '../../context/workspaceContext'; import { SalesforceProjectConfig } from '../../salesforceProject'; diff --git a/packages/salesforcedx-vscode-core/src/util/authInfo.ts b/packages/salesforcedx-vscode-core/src/util/authInfo.ts index 00a83df9ee..ad2cce0556 100644 --- a/packages/salesforcedx-vscode-core/src/util/authInfo.ts +++ b/packages/salesforcedx-vscode-core/src/util/authInfo.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { AuthInfo, Connection, StateAggregator } from '@salesforce/core'; +import { AuthInfo, Connection, StateAggregator } from '@salesforce/core-bundle'; import { ConfigSource, ConfigUtil diff --git a/packages/salesforcedx-vscode-core/src/util/orgUtil.ts b/packages/salesforcedx-vscode-core/src/util/orgUtil.ts index 49e2618e42..0afd0a23cc 100644 --- a/packages/salesforcedx-vscode-core/src/util/orgUtil.ts +++ b/packages/salesforcedx-vscode-core/src/util/orgUtil.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { AuthFields, AuthInfo } from '@salesforce/core'; +import { AuthFields, AuthInfo } from '@salesforce/core-bundle'; import { channelService } from '../channels'; import { nls } from '../messages'; import { notificationService } from '../notifications'; diff --git a/packages/salesforcedx-vscode-core/test/jest/commands/deployExecutor.test.ts b/packages/salesforcedx-vscode-core/test/jest/commands/deployExecutor.test.ts index 40e6e49862..631f7a4128 100644 --- a/packages/salesforcedx-vscode-core/test/jest/commands/deployExecutor.test.ts +++ b/packages/salesforcedx-vscode-core/test/jest/commands/deployExecutor.test.ts @@ -9,7 +9,7 @@ import { ContinueResponse, SourceTrackingService } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import * as fs from 'fs'; import { channelService } from '../../../src/channels'; import { @@ -23,9 +23,9 @@ import * as diagnostics from '../../../src/diagnostics'; import { SalesforcePackageDirectories } from '../../../src/salesforceProject'; import { DeployQueue, salesforceCoreSettings } from '../../../src/settings'; -jest.mock('@salesforce/source-deploy-retrieve', () => { +jest.mock('@salesforce/source-deploy-retrieve-bundle', () => { return { - ...jest.requireActual('@salesforce/source-deploy-retrieve'), + ...jest.requireActual('@salesforce/source-deploy-retrieve-bundle'), ComponentSet: jest.fn().mockImplementation(() => { return { deploy: jest.fn().mockImplementation(() => { diff --git a/packages/salesforcedx-vscode-core/test/jest/commands/retrieveExecutor.test.ts b/packages/salesforcedx-vscode-core/test/jest/commands/retrieveExecutor.test.ts index 91d0df628f..9889353da6 100644 --- a/packages/salesforcedx-vscode-core/test/jest/commands/retrieveExecutor.test.ts +++ b/packages/salesforcedx-vscode-core/test/jest/commands/retrieveExecutor.test.ts @@ -9,7 +9,7 @@ import { ContinueResponse, SourceTrackingService } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import * as fs from 'fs'; import { RetrieveExecutor } from '../../../src/commands/baseDeployRetrieve'; import { OrgType, workspaceContextUtils } from '../../../src/context'; diff --git a/packages/salesforcedx-vscode-core/test/jest/commands/templates/executors/LibraryApexGenerateUnitTestClassExecutor.test.ts b/packages/salesforcedx-vscode-core/test/jest/commands/templates/executors/LibraryApexGenerateUnitTestClassExecutor.test.ts index 6fef604b50..b8ee207a2c 100644 --- a/packages/salesforcedx-vscode-core/test/jest/commands/templates/executors/LibraryApexGenerateUnitTestClassExecutor.test.ts +++ b/packages/salesforcedx-vscode-core/test/jest/commands/templates/executors/LibraryApexGenerateUnitTestClassExecutor.test.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { TemplateType } from '@salesforce/templates'; +import { TemplateType } from '@salesforce/templates-bundle'; import { CREATE_UNIT_NAME_KEY, LibraryApexGenerateUnitTestClassExecutor, diff --git a/packages/salesforcedx-vscode-core/test/jest/conflict/metadataCacheService.test.ts b/packages/salesforcedx-vscode-core/test/jest/conflict/metadataCacheService.test.ts index 8f83ba3895..bacfe63ad3 100644 --- a/packages/salesforcedx-vscode-core/test/jest/conflict/metadataCacheService.test.ts +++ b/packages/salesforcedx-vscode-core/test/jest/conflict/metadataCacheService.test.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import { MetadataCacheService } from '../../../src/conflict'; import { WorkspaceContext } from '../../../src/context'; import { componentSetUtils } from '../../../src/services/sdr/componentSetUtils'; diff --git a/packages/salesforcedx-vscode-core/test/jest/context/workspaceOrgType.test.ts b/packages/salesforcedx-vscode-core/test/jest/context/workspaceOrgType.test.ts index 0677853744..e726a13536 100644 --- a/packages/salesforcedx-vscode-core/test/jest/context/workspaceOrgType.test.ts +++ b/packages/salesforcedx-vscode-core/test/jest/context/workspaceOrgType.test.ts @@ -4,7 +4,7 @@ * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Org } from '@salesforce/core'; +import { Org } from '@salesforce/core-bundle'; import { WorkspaceContext } from '../../../src/context'; import { getWorkspaceOrgType, diff --git a/packages/salesforcedx-vscode-core/test/jest/services/sdr/componentSetUtils.test.ts b/packages/salesforcedx-vscode-core/test/jest/services/sdr/componentSetUtils.test.ts index 8c4010b53c..1483691c2c 100644 --- a/packages/salesforcedx-vscode-core/test/jest/services/sdr/componentSetUtils.test.ts +++ b/packages/salesforcedx-vscode-core/test/jest/services/sdr/componentSetUtils.test.ts @@ -6,7 +6,7 @@ */ import { ConfigUtil } from '@salesforce/salesforcedx-utils-vscode'; -import { ComponentSet } from '@salesforce/source-deploy-retrieve'; +import { ComponentSet } from '@salesforce/source-deploy-retrieve-bundle'; import { WorkspaceContext } from '../../../../src/context/workspaceContext'; import { SalesforceProjectConfig } from '../../../../src/salesforceProject'; import { componentSetUtils } from '../../../../src/services/sdr/componentSetUtils'; diff --git a/packages/salesforcedx-vscode-lightning/package.json b/packages/salesforcedx-vscode-lightning/package.json index 8746dc1755..54a598be7c 100644 --- a/packages/salesforcedx-vscode-lightning/package.json +++ b/packages/salesforcedx-vscode-lightning/package.json @@ -25,7 +25,7 @@ ], "dependencies": { "@salesforce/aura-language-server": "4.8.0", - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/lightning-lsp-common": "4.8.0", "@salesforce/salesforcedx-utils-vscode": "60.7.0", "applicationinsights": "1.0.7", @@ -64,7 +64,7 @@ "salesforce.salesforcedx-vscode-core" ], "scripts": { - "bundle:extension": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core --external:@salesforce/source-tracking --external:applicationinsights --external:@salesforce/lightning-lsp-common --external:@salesforce/aura-language-server --minify", + "bundle:extension": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core-bundle --external:@salesforce/source-tracking-bundle --external:applicationinsights --external:@salesforce/lightning-lsp-common --external:@salesforce/aura-language-server --minify", "clean": "shx rm -rf node_modules && shx rm -rf out && shx rm -rf coverage && shx rm -rf .nyc_output", "compile": "tsc -p ./", "lint": "eslint .", @@ -118,8 +118,8 @@ ], "dependencies": { "applicationinsights": "1.0.7", - "@salesforce/core": "6.5.2", - "@salesforce/source-tracking": "5.1.11", + "@salesforce/core-bundle": "6.7.4", + "@salesforce/source-tracking-bundle": "5.2.2", "@salesforce/aura-language-server": "4.8.0", "@salesforce/lightning-lsp-common": "4.8.0" }, diff --git a/packages/salesforcedx-vscode-lwc/package.json b/packages/salesforcedx-vscode-lwc/package.json index f258d2059e..68dd6a6ec2 100644 --- a/packages/salesforcedx-vscode-lwc/package.json +++ b/packages/salesforcedx-vscode-lwc/package.json @@ -372,7 +372,7 @@ } ], "dependencies": { - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/eslint-config-lwc": "3.5.1", "@salesforce/lightning-lsp-common": "4.8.0", "@salesforce/lwc-language-server": "4.8.0", @@ -451,10 +451,10 @@ ], "packageUpdates": { "dependencies": { - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/lightning-lsp-common": "4.8.0", "@salesforce/lwc-language-server": "4.8.0", - "@salesforce/source-tracking": "5.1.11", + "@salesforce/source-tracking-bundle": "5.2.2", "applicationinsights": "1.0.7" }, "devDependencies": {}, @@ -474,7 +474,7 @@ "url": "https://github.com/forcedotcom/salesforcedx-vscode" }, "scripts": { - "bundle:extension": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --loader:.node=file --external:vscode --external:@salesforce/core --external:@salesforce/source-tracking --external:applicationinsights --external:@salesforce/lightning-lsp-common --external:@salesforce/lwc-language-serve --external:@babel/preset-typescript/package.json --minify", + "bundle:extension": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --loader:.node=file --external:vscode --external:@salesforce/core-bundle --external:@salesforce/source-tracking-bundle --external:applicationinsights --external:@salesforce/lightning-lsp-common --external:@salesforce/lwc-language-serve --external:@babel/preset-typescript/package.json --minify", "clean": "shx rm -rf node_modules && shx rm -rf out && shx rm -rf coverage && shx rm -rf .nyc_output", "compile": "tsc -p ./", "lint": "eslint .", diff --git a/packages/salesforcedx-vscode-soql/package.json b/packages/salesforcedx-vscode-soql/package.json index 751be6c012..db3f3ace72 100644 --- a/packages/salesforcedx-vscode-soql/package.json +++ b/packages/salesforcedx-vscode-soql/package.json @@ -32,7 +32,7 @@ ], "dependencies": { "@salesforce/apex-tmlanguage": "1.6.0", - "@salesforce/core": "6.5.2", + "@salesforce/core-bundle": "6.7.4", "@salesforce/soql-builder-ui": "0.2.0", "@salesforce/soql-data-view": "0.1.0", "@salesforce/soql-language-server": "0.7.1", @@ -82,7 +82,7 @@ "salesforce.salesforcedx-vscode-core" ], "scripts": { - "bundle:extension": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core --external:@salesforce/source-tracking --external:applicationinsights --external:shelljs --external:@salesforce/soql-model --external:@salesforce/soql-language-server --external:@salesforce/soql-data-view --external:@salesforce/soql-builder-ui --minify", + "bundle:extension": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=cjs --platform=node --external:vscode --external:@salesforce/core-bundle --external:@salesforce/source-tracking-bundle --external:applicationinsights --external:shelljs --external:@salesforce/soql-model --external:@salesforce/soql-language-server --external:@salesforce/soql-data-view --external:@salesforce/soql-builder-ui --minify", "build": "npm run compile", "compile": "tsc -p ./", "lint": "eslint .", @@ -138,8 +138,8 @@ "dependencies": { "applicationinsights": "1.0.7", "@salesforce/apex-tmlanguage": "1.6.0", - "@salesforce/core": "6.5.2", - "@salesforce/source-tracking": "5.1.11", + "@salesforce/core-bundle": "6.7.4", + "@salesforce/source-tracking-bundle": "5.2.2", "shelljs": "0.8.5", "@salesforce/soql-builder-ui": "0.2.0", "@salesforce/soql-data-view": "0.1.0", diff --git a/packages/salesforcedx-vscode-soql/src/editor/queryRunner.ts b/packages/salesforcedx-vscode-soql/src/editor/queryRunner.ts index aa1b9f0a57..6544a3f729 100644 --- a/packages/salesforcedx-vscode-soql/src/editor/queryRunner.ts +++ b/packages/salesforcedx-vscode-soql/src/editor/queryRunner.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { soqlComments } from '@salesforce/soql-common'; import { JsonMap } from '@salesforce/ts-types'; import { QueryResult } from 'jsforce'; diff --git a/packages/salesforcedx-vscode-soql/src/editor/soqlEditorInstance.ts b/packages/salesforcedx-vscode-soql/src/editor/soqlEditorInstance.ts index 03621ea621..81b608fa47 100644 --- a/packages/salesforcedx-vscode-soql/src/editor/soqlEditorInstance.ts +++ b/packages/salesforcedx-vscode-soql/src/editor/soqlEditorInstance.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { JsonMap } from '@salesforce/ts-types'; import { debounce } from 'debounce'; import { DescribeSObjectResult, QueryResult } from 'jsforce'; diff --git a/packages/salesforcedx-vscode-soql/src/sf.ts b/packages/salesforcedx-vscode-soql/src/sf.ts index bc7a1fa5f9..95a752ca9d 100644 --- a/packages/salesforcedx-vscode-soql/src/sf.ts +++ b/packages/salesforcedx-vscode-soql/src/sf.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import { Connection } from '@salesforce/core'; +import { Connection } from '@salesforce/core-bundle'; import { ChannelService, WorkspaceContextUtil