Skip to content

Commit

Permalink
test: fix getCodeActions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Apr 2, 2021
1 parent 48a64e2 commit 09ba7e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/adapters/code-action-adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { expect } from "chai"
import * as sinon from "sinon"
import * as ls from "../../lib/languageclient"
import CodeActionAdapter from "../../lib/adapters/code-action-adapter"
import LinterPushV2Adapter from "../../lib/adapters/linter-push-v2-adapter"
/* eslint-disable import/no-deprecated */
import IdeDiagnosticAdapter from "../../lib/adapters/diagnostic-adapter"
import { createSpyConnection, createFakeEditor } from "../helpers.js"

describe("CodeActionAdapter", () => {
Expand All @@ -22,7 +23,7 @@ describe("CodeActionAdapter", () => {
})

describe("getCodeActions", () => {
it("fetches code actions from the connection", async () => {
it("fetches code actions from the connection when IdeDiagnosticAdapter is used", async () => {
const connection = createSpyConnection()
const languageClient = new ls.LanguageClientConnection(connection)
const testCommand: ls.Command = {
Expand All @@ -33,7 +34,9 @@ describe("CodeActionAdapter", () => {
sinon.stub(languageClient, "codeAction").returns(Promise.resolve([testCommand]))
sinon.spy(languageClient, "executeCommand")

const linterAdapter = new LinterPushV2Adapter(languageClient)
const linterAdapter = new IdeDiagnosticAdapter(languageClient)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore private method
sinon.stub(linterAdapter, "getDiagnosticCode").returns("test code")

const testPath = "/test.txt"
Expand Down

0 comments on commit 09ba7e5

Please sign in to comment.