Files
azuredatastudio/extensions/agent/src/test/agentServiceTests/agentEnums.test.ts
Anthony Dresser ef0a92d83f Add compile options to a few extensions (#8252)
* add compile options to a few extensions

* move dep to dev dep

* fix return types
2019-11-07 11:41:31 -08:00

39 lines
2.0 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'mocha';
import * as should from 'should';
import { AgentSubSystem } from 'azdata';
import { JobStepDialog } from '../../dialogs/jobStepDialog';
import { JobStepData } from '../../data/jobStepData';
const subSytems: AgentSubSystem[] = [AgentSubSystem.TransactSql, AgentSubSystem.PowerShell,
AgentSubSystem.CmdExec, AgentSubSystem.Distribution, AgentSubSystem.Merge,
AgentSubSystem.QueueReader, AgentSubSystem.Snapshot, AgentSubSystem.LogReader, AgentSubSystem.AnalysisCommands,
AgentSubSystem.AnalysisQuery, AgentSubSystem.Ssis];
const subSystemDisplayNames: string[] = [JobStepDialog.TSQLScript, JobStepDialog.Powershell,
JobStepDialog.CmdExec, JobStepDialog.ReplicationDistributor, JobStepDialog.ReplicationMerge,
JobStepDialog.ReplicationQueueReader, JobStepDialog.ReplicationSnapshot, JobStepDialog.ReplicationTransactionLogReader,
JobStepDialog.AnalysisServicesCommand, JobStepDialog.AnalysisServicesQuery, JobStepDialog.ServicesPackage];
describe('Agent extension enum mapping sanity test', function (): void {
it('SubSystem to Display Name Mapping test', () => {
for (let i = 0; i < subSytems.length; i++) {
let subSystem = subSytems[i];
let convertedSubSystemName = JobStepData.convertToSubSystemDisplayName(subSystem);
should.equal(convertedSubSystemName, subSystemDisplayNames[i]);
}
});
it('SubSystem Display Name to SubSystem Mapping test', () => {
for (let i = 0; i < subSystemDisplayNames.length; i++) {
let subSystemDisplayName = subSystemDisplayNames[i];
let convertedSubSystem = JobStepData.convertToAgentSubSystem(subSystemDisplayName);
should.equal(convertedSubSystem, subSytems[i]);
}
});
});