I'm currently working on unit testing a piece of code that relies on a constructor with an SQSClient object for interacting with an sqs queue. To write effective unit tests, I need to mock the client so that I can test the code without actually accessing the queue itself. I've been looking at examples like the one referenced here:
https://www.npmjs.com/package/aws-sdk-client-mock
Within my unit test, I tried creating a mock client and passing it into my class like so:
const sqsMockClient = mockClient(SQSClient);
sqsMockClient.onAnyCommand().resolves({});
const blClass: BLClass = new BLClass(sqsMockClient);
However, when running this, the test output indicates that the type is not assignable to parameter of type 'SQSClient' because it's not an actual instance of an SQSClient. If I were to use a real SQSClient, the test would run but it would interact with the queue. My goal is to create a mock that will return a static message for testing purposes.
Does anyone have suggestions on how I could modify this setup to make the mock work as intended?