mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Kube Service tests (#13183)
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'mocha';
|
||||
import assert = require('assert');
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import { ToolsService } from '../../services/toolsService';
|
||||
import { ITool, ToolType } from '../../interfaces';
|
||||
import { IPlatformService } from '../../services/platformService';
|
||||
import { ToolsService } from '../../services/toolsService';
|
||||
|
||||
|
||||
const tools: { name: string; type: ToolType }[] = [
|
||||
@@ -30,12 +32,12 @@ describe('Tools Service Tests', function (): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
(missingTypes.length === 0).should.be.true(`the following enum values are not included in the test:${missingTypes.join(',')}`);
|
||||
assert(missingTypes.length === 0, `the following enum values are not included in the test:${missingTypes.join(',')}`);
|
||||
|
||||
tools.forEach(toolInfo => {
|
||||
const tool = toolsService.getToolByName(toolInfo.name);
|
||||
(!!tool).should.be.true(`The tool: ${toolInfo.name} is not recognized`);
|
||||
(tool!.type).should.equal(toolInfo.type, 'returned notebook name does not match expected value');
|
||||
assert(!!tool, `The tool: ${toolInfo.name} is not recognized`);
|
||||
assert.equal(tool!.type, toolInfo.type, 'returned notebook name does not match expected value');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -43,17 +45,17 @@ describe('Tools Service Tests', function (): void {
|
||||
const mockPlatformService = TypeMoq.Mock.ofType<IPlatformService>();
|
||||
const toolsService = new ToolsService(mockPlatformService.object);
|
||||
const tool = toolsService.getToolByName('no-such-tool');
|
||||
(tool === undefined).should.be.true('for a not defined tool, expected value is undefined');
|
||||
assert(tool === undefined, 'for a not defined tool, expected value is undefined');
|
||||
});
|
||||
|
||||
it('get/set tools for CurrentProvider', () => {
|
||||
const iTools: ITool[] = tools.map(toolInfo => {
|
||||
const tool = toolsService.getToolByName(toolInfo.name);
|
||||
(!!tool).should.be.true(`The tool: ${toolInfo.name} is not recognized`);
|
||||
tool!.type.should.equal(toolInfo.type, 'returned notebook name does not match expected value');
|
||||
assert(!!tool, `The tool: ${toolInfo.name} is not recognized`);
|
||||
assert.equal(tool!.type, toolInfo.type, 'returned notebook name does not match expected value');
|
||||
return tool!;
|
||||
});
|
||||
toolsService.toolsForCurrentProvider = iTools;
|
||||
iTools.should.deepEqual(toolsService.toolsForCurrentProvider, 'toolsForCurrentProvider did not return the value we set');
|
||||
assert.deepEqual(iTools, toolsService.toolsForCurrentProvider, 'toolsForCurrentProvider did not return the value we set');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user