Skip to content

Commit

Permalink
Fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
lramos15 committed Nov 1, 2022
1 parent e37be92 commit a2be698
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as assert from 'assert';
import { EditorActivation, IResourceEditorInput } from 'vs/platform/editor/common/editor';
import { URI } from 'vs/base/common/uri';
import { Event } from 'vs/base/common/event';
import { DEFAULT_EDITOR_ASSOCIATION, EditorCloseContext, EditorsOrder, IEditorCloseEvent, EditorInputWithOptions, IEditorPane, IResourceDiffEditorInput, isEditorInputWithOptions, IUntitledTextResourceEditorInput, IUntypedEditorInput, SideBySideEditor } from 'vs/workbench/common/editor';
import { DEFAULT_EDITOR_ASSOCIATION, EditorCloseContext, EditorsOrder, IEditorCloseEvent, EditorInputWithOptions, IEditorPane, IResourceDiffEditorInput, isEditorInputWithOptions, IUntitledTextResourceEditorInput, IUntypedEditorInput, SideBySideEditor, isEditorInput } from 'vs/workbench/common/editor';
import { workbenchInstantiationService, TestServiceAccessor, registerTestEditor, TestFileEditorInput, ITestInstantiationService, registerTestResourceEditor, registerTestSideBySideEditor, createEditorPart, registerTestFileEditor, TestTextFileEditor, TestSingletonFileEditorInput } from 'vs/workbench/test/browser/workbenchTestServices';
import { EditorService } from 'vs/workbench/services/editor/browser/editorService';
import { IEditorGroup, IEditorGroupsService, GroupDirection, GroupsArrangement } from 'vs/workbench/services/editor/common/editorGroupsService';
Expand Down Expand Up @@ -602,8 +602,13 @@ suite('EditorService', () => {

async function openEditor(editor: EditorInputWithOptions | IUntypedEditorInput, group?: PreferredGroup): Promise<IEditorPane | undefined> {
if (useOpenEditors) {
// The type safety isn't super good here, so we assist with runtime checks
// Open editors expects untyped or editor input with options, you cannot pass a typed editor input
// without options
if (!isEditorInputWithOptions(editor) && isEditorInput(editor)) {
editor = { editor: editor, options: {} };
}
const panes = await service.openEditors([editor], group);

return panes[0];
}

Expand Down Expand Up @@ -651,7 +656,7 @@ suite('EditorService', () => {
assert.ok(typedEditor instanceof TestFileEditorInput);
assert.strictEqual(typedEditor?.resource?.toString(), untypedEditorReplacement.resource.toString());

assert.strictEqual(editorFactoryCalled, 2);
assert.strictEqual(editorFactoryCalled, 3);
assert.strictEqual(untitledEditorFactoryCalled, 0);
assert.strictEqual(diffEditorFactoryCalled, 0);

Expand Down Expand Up @@ -881,7 +886,6 @@ suite('EditorService', () => {
assert.strictEqual(untitledEditorFactoryCalled, 0);
assert.strictEqual(diffEditorFactoryCalled, 0);

assert.ok(!lastEditorFactoryEditor);
assert.ok(!lastUntitledEditorFactoryEditor);
assert.ok(!lastDiffEditorFactoryEditor);

Expand Down

0 comments on commit a2be698

Please sign in to comment.