iam_deleteservercert.test.js - AWS Code Sample

iam_deleteservercert.test.js

const mockDeleteServerCert = jest.fn(); jest.mock( "@aws-sdk/client-iam/commands/DeleteServerCertificateCommand", () => ({ IAM: function IAM() { this.DeleteServerCertificateCommand = mockDeleteServerCert; }, }) ); const { params, run } = require("../../iam/src/iam_deleteservercert.js"); //test function test("has to mock iam#deleteservercertificate", async (done) => { await run(); expect(mockDeleteServerCert).toHaveBeenCalled; done(); });