detect-pseudoRandomBytes.js 460 B

123456789101112131415161718
  1. 'use strict';
  2. const RuleTester = require('eslint').RuleTester;
  3. const tester = new RuleTester();
  4. const ruleName = 'detect-pseudoRandomBytes';
  5. const invalid = 'crypto.pseudoRandomBytes';
  6. tester.run(ruleName, require(`../rules/${ruleName}`), {
  7. valid: [{ code: 'crypto.randomBytes' }],
  8. invalid: [
  9. {
  10. code: invalid,
  11. errors: [{ message: 'Found crypto.pseudoRandomBytes which does not produce cryptographically strong numbers' }]
  12. }
  13. ]
  14. });