Skip to content

Commit

Permalink
fix: make the test name accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
ayame113 committed Jul 30, 2021
1 parent cf8f666 commit c0899dc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/adapters/document-sync-adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe("DocumentSyncAdapter", () => {
})
})

describe("_getLanguageIdFromEditor", () => {
describe("getLanguageId", () => {
function create(getLanguageIdFromEditor: () => string | null | void) {
return new DocumentSyncAdapter(
null as any,
Expand All @@ -95,15 +95,15 @@ describe("DocumentSyncAdapter", () => {
)
}

it("use as language id if string is returned", () => {
it("use the return value of `_getLanguageIdFromEditor` as the languageId", () => {
const editor = createFakeEditor()
const adapter = create(() => "someLanguageId") as any
adapter._handleNewEditor(editor)
const result = adapter.getEditorSyncAdapter(editor).getLanguageId()
expect(result).toBe("someLanguageId")
})

it("fall back to the grammar name if undefined is returned", () => {
it("fall back to the grammar name if `_getLanguageIdFromEditor` returns undefined", () => {
const editor = createFakeEditor()
spyOn(editor, "getGrammar").and.returnValue({ name: "testGrammarName" } as any)
const adapter = create(() => undefined) as any
Expand All @@ -112,7 +112,7 @@ describe("DocumentSyncAdapter", () => {
expect(result).toBe("testGrammarName")
})

it("fall back to the grammar name if null is returned", () => {
it("fall back to the grammar name if `_getLanguageIdFromEditor` returns null", () => {
const editor = createFakeEditor()
spyOn(editor, "getGrammar").and.returnValue({ name: "testGrammarName" } as any)
const adapter = create(() => null) as any
Expand All @@ -121,7 +121,7 @@ describe("DocumentSyncAdapter", () => {
expect(result).toBe("testGrammarName")
})

it("don't fall back to the grammar name if empty string is returned", () => {
it("don't fall back to the grammar name if `_getLanguageIdFromEditor` returns an empty string", () => {
const editor = createFakeEditor()
spyOn(editor, "getGrammar").and.returnValue({ name: "testGrammarName" } as any)
const adapter = create(() => "") as any
Expand Down

0 comments on commit c0899dc

Please sign in to comment.