Unit Test and Integration Test for AWS Lambda/NodeJS in TypeScript | by Zijing Zhao | Level Up Coding

PHOTO EMBED

Mon Jan 31 2022 05:38:50 GMT+0000 (Coordinated Universal Time)

Saved by @jrsl

import axios from "axios";

describe("Integration Test", () => {
    it("hello world integration test", async () => {
        const query = { a: "hi" };
        const response = await axios.get("http://localhost:3000/hello", {
            params: query
        });

        expect(response.status).toEqual(200);
        expect(response.data).toEqual(`Queries: ${JSON.stringify(query)}`);
    });
});
content_copyCOPY

https://levelup.gitconnected.com/unit-test-and-integration-test-for-aws-lambda-nodejs-in-typescript-2235a0f69f5