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