11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciif ((!common.hasCrypto) || (!common.hasIntl)) {
51cb0ef41Sopenharmony_ci  common.skip('ESLint tests require crypto and Intl');
61cb0ef41Sopenharmony_ci}
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_cicommon.skipIfEslintMissing();
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciconst RuleTester = require('../../tools/node_modules/eslint').RuleTester;
111cb0ef41Sopenharmony_ciconst rule = require('../../tools/eslint-rules/prefer-assert-methods');
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_cinew RuleTester().run('prefer-assert-methods', rule, {
141cb0ef41Sopenharmony_ci  valid: [
151cb0ef41Sopenharmony_ci    'assert.strictEqual(foo, bar);',
161cb0ef41Sopenharmony_ci    'assert(foo === bar && baz);',
171cb0ef41Sopenharmony_ci    'assert.notStrictEqual(foo, bar);',
181cb0ef41Sopenharmony_ci    'assert(foo !== bar && baz);',
191cb0ef41Sopenharmony_ci    'assert.equal(foo, bar);',
201cb0ef41Sopenharmony_ci    'assert(foo == bar && baz);',
211cb0ef41Sopenharmony_ci    'assert.notEqual(foo, bar);',
221cb0ef41Sopenharmony_ci    'assert(foo != bar && baz);',
231cb0ef41Sopenharmony_ci    'assert.ok(foo);',
241cb0ef41Sopenharmony_ci    'assert.ok(foo != bar);',
251cb0ef41Sopenharmony_ci    'assert.ok(foo === bar && baz);',
261cb0ef41Sopenharmony_ci  ],
271cb0ef41Sopenharmony_ci  invalid: [
281cb0ef41Sopenharmony_ci    {
291cb0ef41Sopenharmony_ci      code: 'assert(foo == bar);',
301cb0ef41Sopenharmony_ci      errors: [{
311cb0ef41Sopenharmony_ci        message: "'assert.equal' should be used instead of '=='"
321cb0ef41Sopenharmony_ci      }],
331cb0ef41Sopenharmony_ci      output: 'assert.equal(foo, bar);'
341cb0ef41Sopenharmony_ci    },
351cb0ef41Sopenharmony_ci    {
361cb0ef41Sopenharmony_ci      code: 'assert(foo === bar);',
371cb0ef41Sopenharmony_ci      errors: [{
381cb0ef41Sopenharmony_ci        message: "'assert.strictEqual' should be used instead of '==='"
391cb0ef41Sopenharmony_ci      }],
401cb0ef41Sopenharmony_ci      output: 'assert.strictEqual(foo, bar);'
411cb0ef41Sopenharmony_ci    },
421cb0ef41Sopenharmony_ci    {
431cb0ef41Sopenharmony_ci      code: 'assert(foo != bar);',
441cb0ef41Sopenharmony_ci      errors: [{
451cb0ef41Sopenharmony_ci        message: "'assert.notEqual' should be used instead of '!='"
461cb0ef41Sopenharmony_ci      }],
471cb0ef41Sopenharmony_ci      output: 'assert.notEqual(foo, bar);'
481cb0ef41Sopenharmony_ci    },
491cb0ef41Sopenharmony_ci    {
501cb0ef41Sopenharmony_ci      code: 'assert(foo !== bar);',
511cb0ef41Sopenharmony_ci      errors: [{
521cb0ef41Sopenharmony_ci        message: "'assert.notStrictEqual' should be used instead of '!=='"
531cb0ef41Sopenharmony_ci      }],
541cb0ef41Sopenharmony_ci      output: 'assert.notStrictEqual(foo, bar);'
551cb0ef41Sopenharmony_ci    },
561cb0ef41Sopenharmony_ci  ]
571cb0ef41Sopenharmony_ci});
58