This repository demonstrates how to use aws-sdk-client-mock to mock calls to AWS Services.
The createAccount method in organizations.js has an optional client parameter which takes in your mock client. If you leave it blank it will use the real client. So for unit testing purposes we would call it like this:
const { createAccount } = await import("./organizations.js");
const results = await createAccount(
"test@example.com",
"My Account Name",
"OrganizationAccountAccessRole",
orgMockClient
);
- Clone the repo
- Run
npm run testor view the passing tests in GitHub Actions.