jest-createspyobj

Helper function to create spy object for `jest`, same as `jasmine.createSpyObj`


Keywords
jest, create-spy, spy-class, spy-object, createspyobj, jasmine, spy
License
MIT
Install
npm install jest-createspyobj@2.0.0

Documentation

jest-createspyobj

Helper function to create spy object for jest, same as jasmine.createSpyObj

USAGE

import { createSpyObj } from 'jest-createspyobj';

class Tape {
    play() {}
    pause() {}
}

const spy1 = createSpyObj('Tape', ['play', 'pause']);
const spy1 = createSpyObj(Tape);

API

function createSpyObj(ref: string, methods: string[]): jest.Mocked<any>;
function createSpyObj<T>(ref: Constructor<T>, methods?: string[]): jest.Mocked<T>;