1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 'use strict';
- const RuleTester = require('eslint').RuleTester;
- const tester = new RuleTester();
- const ruleName = 'detect-object-injection';
- const Rule = require(`../rules/${ruleName}`);
- const valid = 'var a = {};';
- // const invalidVariable = "TODO";
- // const invalidFunction = "TODO";
- const invalidGeneric = 'var a = {}; a[b] = 4';
- // TODO
- // tester.run(`${ruleName} (Variable Assigned to)`, Rule, {
- // valid: [{ code: valid }],
- // invalid: [
- // {
- // code: invalidVariable,
- // errors: [{ message: 'Variable Assigned to Object Injection Sink' }]
- // }
- // ]
- // });
- //
- //
- // tester.run(`${ruleName} (Function)`, Rule, {
- // valid: [{ code: valid }],
- // invalid: [
- // {
- // code: invalidFunction,
- // errors: [{ message: `Variable Assigned to Object Injection Sink: <input>: 1\n\t${invalidFunction}\n\n` }]
- // }
- // ]
- // });
- tester.run(`${ruleName} (Generic)`, Rule, {
- valid: [{ code: valid }],
- invalid: [
- {
- code: invalidGeneric,
- errors: [{ message: 'Generic Object Injection Sink' }]
- }
- ]
- });
|