1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6 7common.skipIfEslintMissing(); 8 9const RuleTester = require('../../tools/node_modules/eslint').RuleTester; 10const rule = require('../../tools/eslint-rules/prefer-common-mustnotcall'); 11 12const message = 'Please use common.mustNotCall(msg) instead of ' + 13 'common.mustCall(fn, 0) or common.mustCall(0).'; 14 15new RuleTester().run('prefer-common-mustnotcall', rule, { 16 valid: [ 17 'common.mustNotCall(fn)', 18 'common.mustCall(fn)', 19 'common.mustCall(fn, 1)', 20 ], 21 invalid: [ 22 { 23 code: 'common.mustCall(fn, 0)', 24 errors: [{ message }] 25 }, 26 { 27 code: 'common.mustCall(0)', 28 errors: [{ message }] 29 }, 30 ] 31}); 32