UNPKG

eslint-plugin-jest

Version:
32 lines (29 loc) 1.03 kB
'use strict'; const _require = require('eslint'), RuleTester = _require.RuleTester; const rule = require('../prefer-called-with'); const ruleTester = new RuleTester(); ruleTester.run('prefer-called-with', rule, { valid: ['expect(fn).toBeCalledWith();', 'expect(fn).toHaveBeenCalledWith();', 'expect(fn).toBeCalledWith(expect.anything());', 'expect(fn).toHaveBeenCalledWith(expect.anything());', 'expect(fn).not.toBeCalled();', 'expect(fn).not.toHaveBeenCalled();', 'expect(fn).not.toBeCalledWith();', 'expect(fn).not.toHaveBeenCalledWith();', 'expect(fn).toBeCalledTimes(0);', 'expect(fn).toHaveBeenCalledTimes(0);'], invalid: [{ code: 'expect(fn).toBeCalled();', errors: [{ messageId: 'preferCalledWith', data: { name: 'toBeCalled' }, column: 12, line: 1 }] }, { code: 'expect(fn).toHaveBeenCalled();', errors: [{ messageId: 'preferCalledWith', data: { name: 'toHaveBeenCalled' }, column: 12, line: 1 }] }] });