Ensure getApplicableRefactors doesn't crash when given a position (#28361)

This commit is contained in:
Andy authored and GitHub committed 2018-11-16 09:30:37 -08:00
1 parent a6ef176dbb
commit 1089424035
3 files changed
+15 -8

No files matched your search

@@ -3433,7 +3433,17 @@ var x = 10;`
command: protocol.CommandTypes.GetApplicableRefactors,
arguments: { file: file2.path, startLine: 1, startOffset, endLine: 1, endOffset: startOffset + 1 }
});
});
describe("getApplicableRefactors", () => {
it("works when taking position", () => {
const aTs: File = { path: "/a.ts", content: "" };
const session = createSession(createServerHost([aTs]));
openFilesForSession([aTs], session);
const response = executeSessionRequest<protocol.GetApplicableRefactorsRequest, protocol.GetApplicableRefactorsResponse>(
session, protocol.CommandTypes.GetApplicableRefactors, { file: aTs.path, line: 1, offset: 1 });
assert.deepEqual<ReadonlyArray<protocol.ApplicableRefactorInfo> | undefined>(response, []);
});
});
describe("includes deferred files in the project context", () => {