detect-new-buffer.js 390 B

123456789101112131415161718
  1. 'use strict';
  2. const RuleTester = require('eslint').RuleTester;
  3. const tester = new RuleTester();
  4. const ruleName = 'detect-new-buffer';
  5. const invalid = 'var a = new Buffer(c)';
  6. tester.run(ruleName, require(`../rules/${ruleName}`), {
  7. valid: [{ code: 'var a = new Buffer(\'test\')' }],
  8. invalid: [
  9. {
  10. code: invalid,
  11. errors: [{ message: 'Found new Buffer' }]
  12. }
  13. ]
  14. });