-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add test suite for user specific root
- Loading branch information
1 parent
8987d63
commit 7e911cd
Showing
6 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"smithyLsp.rootPath": "${workspaceRoot}/smithy" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
$version: "2.0" | ||
|
||
namespace example.weather | ||
|
||
use aws.api#dataPlane | ||
use smithy.waiters#waitable | ||
|
||
/// Provides weather forecasts. | ||
service Weather { | ||
version: "2006-03-01" | ||
operations: [GetCurrentTime, GetWeatherReport] | ||
} | ||
|
||
@readonly | ||
@dataPlane | ||
operation GetCurrentTime { | ||
input := {} | ||
output := { | ||
@required | ||
time: Timestamp | ||
} | ||
} | ||
|
||
@waitable( | ||
ReportGenerated: { | ||
documentation: "Wait until the weather report is generated" | ||
acceptors: [ | ||
{ | ||
state: "success" | ||
matcher: { | ||
success: true | ||
} | ||
} | ||
{ | ||
state: "retry" | ||
matcher: { | ||
errorType: "NotFound" | ||
} | ||
} | ||
] | ||
} | ||
) | ||
operation GetWeatherReport { | ||
input := { | ||
@required | ||
cityId: String | ||
} | ||
output := { | ||
@required | ||
temperature: String | ||
} | ||
errors: [NotFound] | ||
} | ||
|
||
@error("client") | ||
structure NotFound { | ||
@required | ||
message: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"maven": { | ||
"dependencies": ["software.amazon.smithy:smithy-aws-traits:1.25.0", "software.amazon.smithy:smithy-waiters:1.25.0"], | ||
"repositories": [{ "url": "https://repo1.maven.org/maven2/" }] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as assert from "assert"; | ||
import * as vscode from "vscode"; | ||
import { getDocUri, getLangServerLogs, waitForServerStartup } from "../helper"; | ||
|
||
suite("User-specific root", () => { | ||
test("Should download jars even when not in workspace root", async () => { | ||
const smithyMainUri = getDocUri("suite4/smithy/main.smithy"); | ||
const doc = await vscode.workspace.openTextDocument(smithyMainUri); | ||
await vscode.window.showTextDocument(doc); | ||
await waitForServerStartup(); | ||
const diagnostics = vscode.languages.getDiagnostics(smithyMainUri); | ||
const logText = await getLangServerLogs("suite4/smithy"); | ||
|
||
assert.match(logText, /Downloaded external jars.*smithy-aws-traits-1\.25\.0\.jar/); | ||
assert.match(logText, /Downloaded external jars.*smithy-waiters-1\.25\.0\.jar/); | ||
assert.match(logText, /Discovered smithy files.*\/main.smithy]/); | ||
assert.doesNotMatch(logText, /Unable to resolve trait/); | ||
assert.equal(diagnostics.length, 0); | ||
}).timeout(10000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { runTests } from "../helper"; | ||
|
||
export function run(testsRoot: string, cb: (error: any, failures?: number) => void): void { | ||
runTests(testsRoot, cb); | ||
} |