mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 01:25:38 -05:00
Add ADS Windows support extension with LaunchSsmsDialog command (#4248)
* ADS Windows support extension with LaunchSsmsDialog command * Update readme * Fix spacing * Update download with new file location and name * Update SsmsMin package with bits from latest RC build and addressed some comments. * Update extension name. Add Context menu extension for launching server properties dialog. Remove params interface from public API * Rename folder and update README * Correct README title * Fix a few issues and clean up some stuff. * Update to azdata namespace * Refactor to use async/await and add some more telemetry * Add .bat for running extension tests (currently only Notebook) and set up launch.json with 2 new launch configs for running & debugging extension tests. * Rename files to make it clear these aren't the integration tests * Update launch.config too * Fix spacing and missed file name update * Fix some bugs in buildSsmsMinCommandArgs and add unit tests
This commit is contained in:
67
extensions/admin-tool-ext-win/src/test/utils.test.ts
Normal file
67
extensions/admin-tool-ext-win/src/test/utils.test.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as should from 'should';
|
||||
import 'mocha';
|
||||
|
||||
import * as extensionMain from '../main';
|
||||
|
||||
describe('buildSsmsMinCommandArgs Method Tests', () => {
|
||||
it('Should be built correctly with all params and UseAAD as false', function (): void {
|
||||
let params: extensionMain.LaunchSsmsDialogParams = {
|
||||
action: 'myAction',
|
||||
server: 'myServer',
|
||||
database: 'myDatabase',
|
||||
user: 'user',
|
||||
password: 'password',
|
||||
useAad: false,
|
||||
urn: 'Server\\Database\\Table'
|
||||
};
|
||||
let args = extensionMain.buildSsmsMinCommandArgs(params);
|
||||
should(args).equal('-a "myAction" -S "myServer" -D "myDatabase" -U "user" -u "Server\\Database\\Table"');
|
||||
});
|
||||
|
||||
it('Should be built correctly with all params and UseAAD as true', function (): void {
|
||||
let params: extensionMain.LaunchSsmsDialogParams = {
|
||||
action: 'myAction',
|
||||
server: 'myServer',
|
||||
database: 'myDatabase',
|
||||
user: 'user',
|
||||
password: 'password',
|
||||
useAad: true,
|
||||
urn: 'Server\\Database\\Table'
|
||||
};
|
||||
let args = extensionMain.buildSsmsMinCommandArgs(params);
|
||||
// User is omitted since UseAAD is true
|
||||
should(args).equal('-a "myAction" -S "myServer" -D "myDatabase" -G -u "Server\\Database\\Table"');
|
||||
});
|
||||
|
||||
it('Should be built correctly and names escaped correctly', function (): void {
|
||||
let params: extensionMain.LaunchSsmsDialogParams = {
|
||||
action: 'myAction\'"/\\[]tricky',
|
||||
server: 'myServer\'"/\\[]tricky',
|
||||
database: 'myDatabase\'"/\\[]tricky',
|
||||
user: 'user\'"/\\[]tricky',
|
||||
password: 'password',
|
||||
useAad: true,
|
||||
urn: 'Server\\Database[\'myDatabase\'\'"/\\[]tricky\']\\Table["myTable\'""/\\[]tricky"]'
|
||||
};
|
||||
let args = extensionMain.buildSsmsMinCommandArgs(params);
|
||||
// User is omitted since UseAAD is true
|
||||
should(args).equal('-a "myAction\'\\"/\\[]tricky" -S "myServer\'\\"/\\[]tricky" -D "myDatabase\'\\"/\\[]tricky" -G -u "Server\\Database[\'myDatabase\'\'\\"/\\[]tricky\']\\Table[\\"myTable\'\\"\\"/\\[]tricky\\"]"');
|
||||
});
|
||||
|
||||
it('Should be built correctly with only action and server', function (): void {
|
||||
|
||||
let params: extensionMain.LaunchSsmsDialogParams = {
|
||||
action: 'myAction',
|
||||
server: 'myServer'
|
||||
};
|
||||
let args = extensionMain.buildSsmsMinCommandArgs(params);
|
||||
should(args).equal('-a "myAction" -S "myServer"');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user