-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
* Change docker images to get all dependencies for tests automatically * Restore correct working directory * Add tests for vscode-langserver-sms * Add basic tests for sparql language server client * Add tests for Turtle language server client * Force extensions to find their nearby extensionDepdendency
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mapping from |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mapping from json {} to {} where {} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
export CODE_TESTS_PATH="$(pwd)/out/test" | ||
export CODE_TESTS_WORKSPACE="$(pwd)/fixtures" | ||
export CODE_EXTENSIONS_PATH="$(pwd)/.." | ||
|
||
node "$(pwd)/node_modules/vscode/bin/test" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,76 @@ | ||
// | ||
// Note: This example test is leveraging the Mocha test framework. | ||
// Please refer to their documentation on https://mochajs.org/ for help. | ||
// | ||
import { expect } from "chai"; | ||
import * as path from "path"; | ||
import * as vscode from "vscode"; | ||
|
||
// The module 'assert' provides assertion methods from node | ||
import * as assert from 'assert'; | ||
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); | ||
|
||
// You can import and use all API from the 'vscode' module | ||
// as well as import your extension to test it | ||
// import * as vscode from 'vscode'; | ||
// import * as myExtension from '../extension'; | ||
describe("SMS Language Server Extension", () => { | ||
let docUri: vscode.Uri; | ||
let document: vscode.TextDocument | null; | ||
|
||
// Defines a Mocha test suite to group tests of similar kind together | ||
suite("Extension Tests", function () { | ||
beforeEach(async () => { | ||
const ext = vscode.extensions.getExtension("stardog-union.vscode-langserver-sms")!; | ||
await ext.activate(); | ||
docUri = vscode.Uri.file( | ||
path.join(__dirname, "..", "..", "fixtures", "bad", "expect-json-sql-graphql.sms") | ||
); | ||
document = await vscode.workspace.openTextDocument(docUri); | ||
await vscode.window.showTextDocument(document); | ||
await sleep(2000); // let server start | ||
}); | ||
|
||
// Defines a Mocha unit test | ||
test("Something 1", function() { | ||
assert.equal(-1, [1, 2, 3].indexOf(5)); | ||
assert.equal(-1, [1, 2, 3].indexOf(0)); | ||
}); | ||
}); | ||
afterEach(() => { | ||
document = null; | ||
}); | ||
|
||
it("receives error diagnostics from the server", () => { | ||
const receivedDiagnostics = vscode.languages.getDiagnostics(docUri); | ||
const normalizedReceivedDiagnostics = JSON.parse(JSON.stringify(receivedDiagnostics)); | ||
expect(normalizedReceivedDiagnostics).to.eql([ | ||
{ | ||
severity: "Error", | ||
message: "\tExpected one of the following:\n Sql\n Json\n GraphQl", | ||
range: [ | ||
{ | ||
line: 0, | ||
character: 13 | ||
}, | ||
{ | ||
line: 0, | ||
character: 13 | ||
} | ||
], | ||
source: "FromClause" | ||
} | ||
]); | ||
}); | ||
|
||
it("receives hover help from the server", async () => { | ||
const hoverHelp = (await vscode.commands.executeCommand( | ||
"vscode.executeHoverProvider", | ||
docUri, | ||
new vscode.Position(0, 0) | ||
)) as vscode.Hover; | ||
const normalizedHoverHelp = JSON.parse(JSON.stringify(hoverHelp)); | ||
expect(normalizedHoverHelp).to.eql([ | ||
{ | ||
contents: [ | ||
{ | ||
sanitize: true, | ||
value: "```\nMappingDecl\n```" | ||
} | ||
], | ||
range: [ | ||
{ | ||
line: 0, | ||
character: 0 | ||
}, | ||
{ | ||
line: 0, | ||
character: 7 | ||
} | ||
] | ||
} | ||
]); | ||
}); | ||
}); |