Skip to content

Commit 86d334f

Browse files
authored
test(aws-protocoltests-json-10): skip Json10WithQueryCompatibleGreetingError (#3990)
1 parent 4877469 commit 86d334f

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,9 @@ private static boolean filterProtocolTests(
296296
HttpMessageTestCase testCase,
297297
TypeScriptSettings settings
298298
) {
299-
// TODO: Consume AWSQueryError trait as a follow-up.
300-
if (testCase.getId().equals("QueryCustomizedError")) {
299+
// TODO: Consume AWSQueryError trait as a follow-up in JS-2681.
300+
if (testCase.getId().equals("QueryCustomizedError")
301+
|| testCase.getId().equals("Json10WithQueryCompatibleGreetingError")) {
301302
return true;
302303
}
303304

private/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,50 @@ it("AwsJson10EndpointTraitWithHostLabel:Request", async () => {
276276
}
277277
});
278278

279+
/**
280+
* @awsQueryCompatible trait is applied to service
281+
*/
282+
it.skip("Json10WithQueryCompatibleGreetingError:Error:GreetingWithErrors", async () => {
283+
const client = new JSONRPC10Client({
284+
...clientParams,
285+
requestHandler: new ResponseDeserializationTestHandler(
286+
false,
287+
402,
288+
{
289+
"x-amzn-query-error": "CustomGreetingErrorCode;Sender",
290+
"content-type": "application/x-amz-json-1.0",
291+
},
292+
`{"__type": "InvalidGreetingError","Message": "Hi"}`
293+
),
294+
});
295+
296+
const params: any = {};
297+
const command = new GreetingWithErrorsCommand(params);
298+
299+
try {
300+
await client.send(command);
301+
} catch (err) {
302+
if (err.name !== "InvalidGreeting") {
303+
console.log(err);
304+
fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`);
305+
return;
306+
}
307+
const r: any = err;
308+
expect(r["$metadata"].httpStatusCode).toBe(402);
309+
const paramsToValidate: any = [
310+
{
311+
message: "Hi",
312+
},
313+
][0];
314+
Object.keys(paramsToValidate).forEach((param) => {
315+
expect(r[param]).toBeDefined();
316+
expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true);
317+
});
318+
return;
319+
}
320+
fail("Expected an exception to be thrown from response");
321+
});
322+
279323
/**
280324
* Parses simple JSON errors
281325
*/

0 commit comments

Comments
 (0)