Working with the amplitude
module requires me to start by creating an instance of a class and then use its methods. Here's the initial code snippet:
var Amplitude = require('amplitude');
const amplitude = new Amplitude(process.env.amplitudeApiKey);
Later on, I make a call to
await amplitude.track({something: 'here'})
and now I want to create a mock for testing purposes so that the external library is not actually called and I can validate the arguments properly. The challenge here lies in having to instantiate a class before attempting to create mocks.
I have attempted using a __mocks__
directory but encountered issues due to TypeScript's automocking feature being enabled. I am stumped on how to proceed with mocking this specific scenario. Any suggestions or solutions would be greatly appreciated.