Skip to content

Commit b78b7c5

Browse files
committed
test: add tests
1 parent 8f087ef commit b78b7c5

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

spec/go-to-definition-spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** @babel */
2+
3+
import { getDefinitions } from "../lib/goToDefinition";
4+
5+
// Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
6+
//
7+
// To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
8+
// or `fdescribe`). Remove the `f` to unfocus the block.
9+
10+
describe("go to definition", () => {
11+
describe("getDefinitions", () => {
12+
it("returns undefined if no provider exists for editor", async () => {
13+
const providerRegistry = {
14+
getProviderForEditor() {}
15+
}
16+
const definitions = await getDefinitions(providerRegistry, { editor: true, position: true });
17+
expect(definitions).toBeUndefined();
18+
});
19+
});
20+
});

spec/main-spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/** @babel */
2+
3+
import * as main from "../lib/main";
4+
5+
// Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
6+
//
7+
// To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
8+
// or `fdescribe`). Remove the `f` to unfocus the block.
9+
10+
describe("main", () => {
11+
it("activate", async function () {
12+
// Trigger deferred activation
13+
atom.packages.triggerDeferredActivationHooks();
14+
// Activate activation hook
15+
atom.packages.triggerActivationHook("core:loaded-shell-environment");
16+
17+
await atom.packages.activatePackage("atom-ide-definitions");
18+
expect(atom.packages.isPackageLoaded("atom-ide-definitions")).toBeTruthy();
19+
});
20+
21+
it("getClickProvider", () => {
22+
const provider = main.getClickProvider();
23+
24+
expect(typeof provider.getSuggestionForWord).toEqual("function");
25+
});
26+
});

0 commit comments

Comments
 (0)