Skip to content

Commit fbbbc20

Browse files
committed
test: shows the document in external programs for the given URI
1 parent 9d245f8 commit fbbbc20

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/adapters/show-document-adapter.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { TextEditor } from "atom"
2+
import { shell } from "electron"
23
import * as sinon from "sinon"
34
import { expect } from "chai"
45
import { join, dirname } from "path"
@@ -63,5 +64,23 @@ describe("ShowDocumentAdapter", () => {
6364
expect(editor!.getText()).includes(`atom.notifications.addSuccess("Hello World")`)
6465
})
6566
})
67+
68+
describe("shows document in external programs", () => {
69+
it("shows the document in external programs for the given URI", async () => {
70+
const params: ShowDocumentParams = {
71+
uri: "http://www.github.com",
72+
external: true,
73+
}
74+
const spy = sinon.spy()
75+
shell.openExternal = spy
76+
77+
const { success } = await ShowDocumentAdapter.showDocument(params)
78+
expect(success).to.be.true
79+
80+
expect((shell.openExternal as sinon.SinonSpy).calledOnce).to.be.true
81+
const spyArgs = spy.firstCall.args
82+
expect(spyArgs[0]).to.equal("http://www.github.com")
83+
})
84+
})
6685
})
6786
})

0 commit comments

Comments
 (0)