Skip to content

Mock any ES6 class, record calls of object methods, and mock return values and behavior.

Notifications You must be signed in to change notification settings

evang522/mock-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mock-class

Mock any ES6 class, record calls of object methods, and mock return values and behavior.

 class Car {
     public go() {
        console.log('going');
     }
     
     public stop() {
        console.log('stopped');
     }
 
 }


 const carMock = ClassMocker.mockClass<Car>(Car);
 
 carMock.mock().method('stop').willReturn('test mocked return value');
 
 const result = carMock.stop();
 
 carMock.amountOfCalls() // 1
 expect(result).toBe('test mocked return value');

About

Mock any ES6 class, record calls of object methods, and mock return values and behavior.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published