This commit is contained in:
Sandeep Somavarapu
2019-03-05 10:43:03 +01:00
parent 2b98f57145
commit fe2571f087
@@ -140,10 +140,66 @@ suite('WorkspaceContextService - Folder', () => {
test('isCurrentWorkspace() => false', () => {
assert.ok(!workspaceContextService.isCurrentWorkspace(URI.file(workspaceResource + 'abc')));
});
test('workspace is complete', () => workspaceContextService.getCompleteWorkspace());
});
suite('WorkspaceContextService - Workspace', () => {
let parentResource: string, testObject: WorkspaceService, instantiationService: TestInstantiationService;
setup(() => {
return setUpWorkspace(['a', 'b'])
.then(({ parentDir, configPath }) => {
parentResource = parentDir;
const environmentService = new SettingsTestEnvironmentService(parseArgs(process.argv), process.execPath, path.join(parentDir, 'settings.json'));
const workspaceService = new WorkspaceService(environmentService);
instantiationService = <TestInstantiationService>workbenchInstantiationService();
instantiationService.stub(IWorkspaceContextService, workspaceService);
instantiationService.stub(IConfigurationService, workspaceService);
instantiationService.stub(IEnvironmentService, environmentService);
return workspaceService.initialize(getWorkspaceIdentifier(configPath)).then(() => {
workspaceService.acquireInstantiationService(instantiationService);
testObject = workspaceService;
});
});
});
teardown(() => {
if (testObject) {
(<WorkspaceService>testObject).dispose();
}
if (parentResource) {
return pfs.del(parentResource, os.tmpdir());
}
return undefined;
});
test('workspace folders', () => {
const actual = testObject.getWorkspace().folders;
assert.equal(actual.length, 2);
assert.equal(path.basename(actual[0].uri.fsPath), 'a');
assert.equal(path.basename(actual[1].uri.fsPath), 'b');
});
test('getWorkbenchState()', () => {
const actual = testObject.getWorkbenchState();
assert.equal(actual, WorkbenchState.WORKSPACE);
});
test('workspace is complete', () => testObject.getCompleteWorkspace());
});
suite('WorkspaceContextService - Workspace Editing', () => {
let parentResource: string, testObject: WorkspaceService, instantiationService: TestInstantiationService, fileChangeEvent: Emitter<FileChangesEvent> = new Emitter<FileChangesEvent>();
setup(() => {
@@ -186,14 +242,6 @@ suite('WorkspaceContextService - Workspace', () => {
return undefined;
});
test('workspace folders', () => {
const actual = testObject.getWorkspace().folders;
assert.equal(actual.length, 2);
assert.equal(path.basename(actual[0].uri.fsPath), 'a');
assert.equal(path.basename(actual[1].uri.fsPath), 'b');
});
test('add folders', () => {
const workspaceDir = path.dirname(testObject.getWorkspace().folders[0].uri.fsPath);
return testObject.addFolders([{ uri: URI.file(path.join(workspaceDir, 'd')) }, { uri: URI.file(path.join(workspaceDir, 'c')) }])