mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Add real MIAA connection string values (#10838)
* Add real MIAA connection string values * Add MiaaModel and fix some strings * Remove unused var * Test to print env vars * Add tests * fixes
This commit is contained in:
45
extensions/arc/src/test/common/utils.test.ts
Normal file
45
extensions/arc/src/test/common/utils.test.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as should from 'should';
|
||||
import 'mocha';
|
||||
import { resourceTypeToDisplayName, ResourceType, parseEndpoint } from '../../common/utils';
|
||||
|
||||
import * as loc from '../../localizedConstants';
|
||||
|
||||
describe('resourceTypeToDisplayName Method Tests', () => {
|
||||
it('Display Name should be correct for valid ResourceType', function (): void {
|
||||
should(resourceTypeToDisplayName(ResourceType.dataControllers)).equal(loc.dataControllersType);
|
||||
should(resourceTypeToDisplayName(ResourceType.postgresInstances)).equal(loc.pgSqlType);
|
||||
should(resourceTypeToDisplayName(ResourceType.sqlManagedInstances)).equal(loc.miaaType);
|
||||
});
|
||||
|
||||
it('Display Name should be correct for unknown value', function (): void {
|
||||
should(resourceTypeToDisplayName('Unknown Type')).equal('Unknown Type');
|
||||
});
|
||||
|
||||
it('Display Name should be correct for empty value', function (): void {
|
||||
should(resourceTypeToDisplayName('')).equal('undefined');
|
||||
});
|
||||
|
||||
it('Display Name should be correct for undefined value', function (): void {
|
||||
should(resourceTypeToDisplayName(undefined)).equal('undefined');
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseEndpoint Method Tests', () => {
|
||||
it('Should parse valid endpoint correctly', function (): void {
|
||||
should(parseEndpoint('127.0.0.1:1337')).deepEqual({ ip: '127.0.0.1', port: '1337'});
|
||||
});
|
||||
|
||||
it('Should parse empty endpoint correctly', function (): void {
|
||||
should(parseEndpoint('')).deepEqual({ ip: '', port: ''});
|
||||
});
|
||||
|
||||
it('Should parse undefined endpoint correctly', function (): void {
|
||||
should(parseEndpoint('')).deepEqual({ ip: '', port: ''});
|
||||
});
|
||||
});
|
||||
|
||||
48
extensions/arc/src/test/index.ts
Normal file
48
extensions/arc/src/test/index.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
const testRunner = require('vscodetestcover');
|
||||
|
||||
const suite = 'arc Extension Tests';
|
||||
|
||||
const mochaOptions: any = {
|
||||
ui: 'bdd',
|
||||
useColors: true,
|
||||
timeout: 10000
|
||||
};
|
||||
|
||||
// set relevant mocha options from the environment
|
||||
if (process.env.ADS_TEST_GREP) {
|
||||
mochaOptions.grep = process.env.ADS_TEST_GREP;
|
||||
console.log(`setting options.grep to: ${mochaOptions.grep}`);
|
||||
}
|
||||
if (process.env.ADS_TEST_INVERT_GREP) {
|
||||
mochaOptions.invert = parseInt(process.env.ADS_TEST_INVERT_GREP);
|
||||
console.log(`setting options.invert to: ${mochaOptions.invert}`);
|
||||
}
|
||||
if (process.env.ADS_TEST_TIMEOUT) {
|
||||
mochaOptions.timeout = parseInt(process.env.ADS_TEST_TIMEOUT);
|
||||
console.log(`setting options.timeout to: ${mochaOptions.timeout}`);
|
||||
}
|
||||
if (process.env.ADS_TEST_RETRIES) {
|
||||
mochaOptions.retries = parseInt(process.env.ADS_TEST_RETRIES);
|
||||
console.log(`setting options.retries to: ${mochaOptions.retries}`);
|
||||
}
|
||||
|
||||
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||
mochaOptions.reporter = 'mocha-multi-reporters';
|
||||
mochaOptions.reporterOptions = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
testsuitesTitle: `${suite} ${process.platform}`,
|
||||
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
testRunner.configure(mochaOptions, { coverConfig: '../../coverConfig.json' });
|
||||
|
||||
export = testRunner;
|
||||
Reference in New Issue
Block a user