Skip to content

chore: check for ErrorName to be thrown in protocol tests #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,6 @@ private void generateErrorResponseTest(
StructureShape error,
HttpResponseTestCase testCase
) {
Symbol errorSymbol = symbolProvider.toSymbol(error);

// Use a compound test_case name so we generate unique tests
// for each error on each operation safely. This is useful in validating
// that operation parsers are all correctly identifying errors and that
Expand All @@ -776,12 +774,12 @@ private void generateErrorResponseTest(
writer.write("try {\n"
+ " await client.send(command);\n"
+ "} catch (err) {\n"
+ " if (err.name !== \"$T\") {\n"
+ " if (err.name !== \"$1L\") {\n"
+ " console.log(err);\n"
+ " fail(`Expected a $L to be thrown, got $${err.name} instead`);\n"
+ " fail(`Expected a $1L to be thrown, got $${err.name} instead`);\n"
+ " return;\n"
+ " }\n"
+ " const r: any = err;", errorSymbol, error.getId().getName())
+ " const r: any = err;", error.getId().getName())
.indent()
.call(() -> writeResponseAssertions(error, testCase))
.write("return;")
Expand Down