mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 12:08:36 -05:00
@@ -27,15 +27,23 @@ function createContext(): TestContext {
|
||||
};
|
||||
}
|
||||
|
||||
function execFolderListCommand(context: TestContext, service : ProcessService): Promise<string> {
|
||||
function execFolderListCommand(context: TestContext, service: ProcessService): Promise<string> {
|
||||
if (utils.isWindows()) {
|
||||
return service.execScripts('cmd', ['dir', '.'], [], context.outputChannel);
|
||||
} else {
|
||||
return service.execScripts('/bin/sh', ['-c', 'ls'], [], context.outputChannel);
|
||||
return service.execScripts('/bin/sh', ['ls'], [], context.outputChannel);
|
||||
}
|
||||
}
|
||||
|
||||
function execFolderListBufferedCommand(context: TestContext, service : ProcessService): Promise<string> {
|
||||
function execGetCharacterCommand(context: TestContext, service: ProcessService): Promise<string> {
|
||||
if (utils.isWindows()) {
|
||||
return service.execScripts('cmd', ['set', '/p', 'asd="Hit enter"'], [], context.outputChannel);
|
||||
} else {
|
||||
return service.execScripts('/bin/sh', ['read'], [], context.outputChannel);
|
||||
}
|
||||
}
|
||||
|
||||
function execFolderListBufferedCommand(context: TestContext, service: ProcessService): Promise<string> {
|
||||
if (utils.isWindows()) {
|
||||
return service.executeBufferedCommand('dir', context.outputChannel);
|
||||
} else {
|
||||
@@ -44,20 +52,20 @@ function execFolderListBufferedCommand(context: TestContext, service : ProcessSe
|
||||
}
|
||||
|
||||
describe('Process Service', () => {
|
||||
it('Executing a valid script should return successfully', async function (): Promise<void> {
|
||||
it('execScripts should return successfully', async function (): Promise<void> {
|
||||
const context = createContext();
|
||||
let service = new ProcessService();
|
||||
await should(execFolderListCommand(context, service)).resolved();
|
||||
});
|
||||
|
||||
it('execFolderListCommand should reject if command time out @UNSTABLE@', async function (): Promise<void> {
|
||||
it('execScripts should reject if command times out', async function (): Promise<void> {
|
||||
const context = createContext();
|
||||
let service = new ProcessService();
|
||||
service.timeout = 10;
|
||||
await should(execFolderListCommand(context, service)).rejected();
|
||||
await should(execGetCharacterCommand(context, service)).rejected();
|
||||
});
|
||||
|
||||
it('executeBufferedCommand should resolve give valid script', async function (): Promise<void> {
|
||||
it('execScripts should resolve give valid script', async function (): Promise<void> {
|
||||
const context = createContext();
|
||||
let service = new ProcessService();
|
||||
service.timeout = 2000;
|
||||
|
||||
Reference in New Issue
Block a user