Skip to content

Instantly share code, notes, and snippets.

@furlanf
Created November 6, 2019 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save furlanf/2e65b247ed59e7ced3894de80ad98d0f to your computer and use it in GitHub Desktop.
Save furlanf/2e65b247ed59e7ced3894de80ad98d0f to your computer and use it in GitHub Desktop.
describe("when send an invalid user", () => {
it("returns unauthorized", async () => {
const handler = middy(async (event, context) => {});
handler.use(vegetableCompany());
const event = { requestContext: { user: { company: "fruit-company" } } };
const { statusCode } = await handler(event, {});
expect(statusCode).toEqual(401);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment