Skip to content

Pierre-M/jest-class-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jest-class-mock

Mock any class in a snap for your Jest tests !

Installation

pnpm i jest-class-mock
npm i jest-class-mock
yarn add jest-class-mock

Usage

import { createMock } from 'jest-class-mock'

class MyService {
    constructor(private otherService: OtherService) {}

    doSomeStuff() {
        // Doing a lot of complex stuff
    }
}

const myServiceMock = createMock(MyService)

myServiceMock.doSomeStuff // That method is now an instance of jest.fn()

About

Mock any class in a snap for your Jest tests !

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published