Skip to content

Commit f82c874

Browse files
trivikrsrchase
authored andcommitted
chore: check for ErrorName to be thrown in protocol tests (smithy-lang#490)
1 parent afe77e6 commit f82c874

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/HttpProtocolTestGenerator.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,6 @@ private void generateErrorResponseTest(
761761
StructureShape error,
762762
HttpResponseTestCase testCase
763763
) {
764-
Symbol errorSymbol = symbolProvider.toSymbol(error);
765-
766764
// Use a compound test_case name so we generate unique tests
767765
// for each error on each operation safely. This is useful in validating
768766
// that operation parsers are all correctly identifying errors and that
@@ -776,12 +774,12 @@ private void generateErrorResponseTest(
776774
writer.write("try {\n"
777775
+ " await client.send(command);\n"
778776
+ "} catch (err) {\n"
779-
+ " if (err.name !== \"$T\") {\n"
777+
+ " if (err.name !== \"$1L\") {\n"
780778
+ " console.log(err);\n"
781-
+ " fail(`Expected a $L to be thrown, got $${err.name} instead`);\n"
779+
+ " fail(`Expected a $1L to be thrown, got $${err.name} instead`);\n"
782780
+ " return;\n"
783781
+ " }\n"
784-
+ " const r: any = err;", errorSymbol, error.getId().getName())
782+
+ " const r: any = err;", error.getId().getName())
785783
.indent()
786784
.call(() -> writeResponseAssertions(error, testCase))
787785
.write("return;")

0 commit comments

Comments
 (0)