|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | /* eslint global-require: 0 */
|
|---|
| 2 |
|
|---|
| 3 | import fs from 'fs';
|
|---|
| 4 | import path from 'path';
|
|---|
| 5 | import test from 'tape';
|
|---|
| 6 |
|
|---|
| 7 | import plugin from '../src';
|
|---|
| 8 |
|
|---|
| 9 | const rules = fs.readdirSync(path.resolve(__dirname, '../src/rules/'))
|
|---|
| 10 | .map((f) => path.basename(f, '.js'));
|
|---|
| 11 |
|
|---|
| 12 | test('all rule files should be exported by the plugin', (t) => {
|
|---|
| 13 | rules.forEach((ruleName) => {
|
|---|
| 14 | t.equal(
|
|---|
| 15 | plugin.rules[ruleName],
|
|---|
| 16 | require(path.join('../src/rules', ruleName)), // eslint-disable-line import/no-dynamic-require
|
|---|
| 17 | `exports ${ruleName}`,
|
|---|
| 18 | );
|
|---|
| 19 | });
|
|---|
| 20 |
|
|---|
| 21 | t.end();
|
|---|
| 22 | });
|
|---|
| 23 |
|
|---|
| 24 | test('configurations', (t) => {
|
|---|
| 25 | t.notEqual(plugin.configs.recommended, undefined, 'exports a \'recommended\' configuration');
|
|---|
| 26 |
|
|---|
| 27 | t.end();
|
|---|
| 28 | });
|
|---|
| 29 |
|
|---|
| 30 | test('schemas', (t) => {
|
|---|
| 31 | rules.forEach((ruleName) => {
|
|---|
| 32 | const rule = require(path.join('../src/rules', ruleName)); // eslint-disable-line import/no-dynamic-require
|
|---|
| 33 | const schema = rule.meta && rule.meta.schema && rule.meta.schema[0];
|
|---|
| 34 | const { type } = schema;
|
|---|
| 35 |
|
|---|
| 36 | t.equal(type, 'object', `${ruleName} exports a schema with type object`);
|
|---|
| 37 | });
|
|---|
| 38 |
|
|---|
| 39 | t.end();
|
|---|
| 40 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.