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/lowercase-name-for-primitive'); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cinew RuleTester().run('lowercase-name-for-primitive', rule, { 141cb0ef41Sopenharmony_ci valid: [ 151cb0ef41Sopenharmony_ci 'new errors.TypeError("ERR_INVALID_ARG_TYPE", "a", ["string", "number"])', 161cb0ef41Sopenharmony_ci 'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "string")', 171cb0ef41Sopenharmony_ci 'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "number")', 181cb0ef41Sopenharmony_ci 'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "boolean")', 191cb0ef41Sopenharmony_ci 'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "null")', 201cb0ef41Sopenharmony_ci 'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "undefined")', 211cb0ef41Sopenharmony_ci ], 221cb0ef41Sopenharmony_ci invalid: [ 231cb0ef41Sopenharmony_ci { 241cb0ef41Sopenharmony_ci code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'Number')", 251cb0ef41Sopenharmony_ci errors: [{ message: 'primitive should use lowercase: Number' }], 261cb0ef41Sopenharmony_ci output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'number')", 271cb0ef41Sopenharmony_ci }, 281cb0ef41Sopenharmony_ci { 291cb0ef41Sopenharmony_ci code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'STRING')", 301cb0ef41Sopenharmony_ci errors: [{ message: 'primitive should use lowercase: STRING' }], 311cb0ef41Sopenharmony_ci output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'string')", 321cb0ef41Sopenharmony_ci }, 331cb0ef41Sopenharmony_ci { 341cb0ef41Sopenharmony_ci code: "new e.TypeError('ERR_INVALID_ARG_TYPE', a, ['String','Number'])", 351cb0ef41Sopenharmony_ci errors: [ 361cb0ef41Sopenharmony_ci { message: 'primitive should use lowercase: String' }, 371cb0ef41Sopenharmony_ci { message: 'primitive should use lowercase: Number' }, 381cb0ef41Sopenharmony_ci ], 391cb0ef41Sopenharmony_ci output: "new e.TypeError('ERR_INVALID_ARG_TYPE', a, ['string','number'])", 401cb0ef41Sopenharmony_ci }, 411cb0ef41Sopenharmony_ci ] 421cb0ef41Sopenharmony_ci}); 43