diff options
Diffstat (limited to 'src/vs/workbench/services/configuration/test/browser/configurationService.test.ts')
-rw-r--r-- | src/vs/workbench/services/configuration/test/browser/configurationService.test.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/vs/workbench/services/configuration/test/browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/browser/configurationService.test.ts index 61cc2fc1b51..db9b1eeff33 100644 --- a/src/vs/workbench/services/configuration/test/browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/browser/configurationService.test.ts @@ -105,6 +105,47 @@ suite('WorkspaceContextService - Folder', () => { assert.strictEqual(actual, testObject.getWorkspace().folders[0]); }); + test('getWorkspaceFolder() - queries in workspace folder', async () => { + + const logService = new NullLogService(); + const fileService = disposables.add(new FileService(logService)); + const fileSystemProvider = disposables.add(new InMemoryFileSystemProvider()); + fileService.registerProvider(ROOT.scheme, fileSystemProvider); + + const folder = joinPath(ROOT, folderName).with({ query: 'myquery=1' }); + await fileService.createFolder(folder); + + const environmentService = TestEnvironmentService; + fileService.registerProvider(Schemas.vscodeUserData, disposables.add(new FileUserDataProvider(ROOT.scheme, fileSystemProvider, Schemas.vscodeUserData, new NullLogService()))); + const testObject = disposables.add(new WorkspaceService({ configurationCache: new ConfigurationCache() }, environmentService, fileService, new RemoteAgentService(null, environmentService, TestProductService, new RemoteAuthorityResolverService(undefined, undefined), new SignService(undefined), new NullLogService()), new UriIdentityService(fileService), new NullLogService())); + await (<WorkspaceService>testObject).initialize(convertToWorkspacePayload(folder)); + + const actual = testObject.getWorkspaceFolder(joinPath(folder, 'a')); + + assert.strictEqual(actual, testObject.getWorkspace().folders[0]); + }); + + test('getWorkspaceFolder() - queries in resource', async () => { + + const logService = new NullLogService(); + const fileService = disposables.add(new FileService(logService)); + const fileSystemProvider = disposables.add(new InMemoryFileSystemProvider()); + fileService.registerProvider(ROOT.scheme, fileSystemProvider); + + const folder = joinPath(ROOT, folderName); + await fileService.createFolder(folder); + + const environmentService = TestEnvironmentService; + fileService.registerProvider(Schemas.vscodeUserData, disposables.add(new FileUserDataProvider(ROOT.scheme, fileSystemProvider, Schemas.vscodeUserData, new NullLogService()))); + const testObject = disposables.add(new WorkspaceService({ configurationCache: new ConfigurationCache() }, environmentService, fileService, new RemoteAgentService(null, environmentService, TestProductService, new RemoteAuthorityResolverService(undefined, undefined), new SignService(undefined), new NullLogService()), new UriIdentityService(fileService), new NullLogService())); + await (<WorkspaceService>testObject).initialize(convertToWorkspacePayload(folder)); + + + const actual = testObject.getWorkspaceFolder(joinPath(folder, 'a').with({ query: 'myquery=1' })); + + assert.strictEqual(actual, testObject.getWorkspace().folders[0]); + }); + test('isCurrentWorkspace() => true', () => { assert.ok(testObject.isCurrentWorkspace(folder)); }); |