Skip to content

Commit

Permalink
test: ensure header is echoed back (#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmbourne authored Mar 10, 2024
1 parent f940073 commit 38edce1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/__tests__/apiGateway.it.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios, { AxiosInstance, Method } from "axios";
import { aws4Interceptor, Credentials, getAuthErrorMessage } from "..";
import { AssumeRoleCommand, STSClient } from "@aws-sdk/client-sts";
import axios, { AxiosInstance, Method } from "axios";
import { Credentials, aws4Interceptor, getAuthErrorMessage } from "..";

const methods: Method[] = ["GET", "DELETE"];
const dataMethods: Method[] = ["POST", "PATCH", "PUT"];
Expand Down Expand Up @@ -103,16 +103,18 @@ describe("with credentials from environment variables", () => {
url: apiGateway,
method,
data,
headers: { foo: "bar" },
});
} catch (err) {
error = getAuthErrorMessage(err);
}

expect(error).toBe(undefined);
expect(result?.status).toEqual(200);
expect(result && result.data.requestContext.http.method).toBe(method);
expect(result && result.data.requestContext.http.path).toBe("/");
expect(result?.data.requestContext.http.method).toBe(method);
expect(result?.data.requestContext.http.path).toBe("/");
expect(result && JSON.parse(result.data.body)).toStrictEqual(data);
expect(result?.data.headers.foo).toEqual("bar");
});

it("handles path", async () => {
Expand Down

0 comments on commit 38edce1

Please sign in to comment.