Permalink
Cannot retrieve contributors at this time
37 lines (31 sloc)
1.06 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/eslint-plugin-jsx-a11y/__tests__/index-test.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint global-require: 0 */ | |
import fs from 'fs'; | |
import path from 'path'; | |
import expect from 'expect'; | |
import plugin from '../src'; | |
const rules = fs.readdirSync(path.resolve(__dirname, '../src/rules/')) | |
.map((f) => path.basename(f, '.js')); | |
describe('all rule files should be exported by the plugin', () => { | |
rules.forEach((ruleName) => { | |
it(`should export ${ruleName}`, () => { | |
expect(plugin.rules[ruleName]).toEqual( | |
require(path.join('../src/rules', ruleName)) // eslint-disable-line | |
); | |
}); | |
}); | |
}); | |
describe('configurations', () => { | |
it('should export a \'recommended\' configuration', () => { | |
expect(plugin.configs.recommended).toBeDefined(); | |
}); | |
}); | |
describe('schemas', () => { | |
rules.forEach((ruleName) => { | |
it(`${ruleName} should export a schema with type object`, () => { | |
const rule = require(path.join('../src/rules', ruleName)); // eslint-disable-line | |
const schema = rule.meta && rule.meta.schema && rule.meta.schema[0]; | |
const { type } = schema; | |
expect(type).toEqual('object'); | |
}); | |
}); | |
}); |