Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reciosonny/767d837017ed581012a149e4443aa874 to your computer and use it in GitHub Desktop.
Save reciosonny/767d837017ed581012a149e4443aa874 to your computer and use it in GitHub Desktop.
import SoundPlayer from './sound-player';
const mockPlaySoundFile = jest.fn();
jest.mock('./sound-player', () => {
return jest.fn().mockImplementation(() => {
return {playSoundFile: mockPlaySoundFile};
});
});
// sound-player.js
export default class SoundPlayer {
constructor() {
this.foo = 'bar';
}
playSoundFile(fileName) {
console.log('Playing sound file ' + fileName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment