import fs from 'fs';
import test from 'ava';
import pify from 'pify';
import index from '../';

test('every rule should defined in the index file and recommended settings', async t => {
  const files = await pify(fs.readdir, Promise)('../rules/');
  const rules = files.filter(file => file.indexOf('.js') === file.length - 3);

  rules.forEach(file => {
    const name = file.slice(0, -3);
    t.truthy(index.rules[name], `'${name}' is not exported in 'index.js'`);
    t.truthy(index.configs.recommended.rules[`fp/${name}`], `'${name}' is not set in the recommended config`);
  });

  t.is(Object.keys(index.rules).length, rules.length,
    'There are more exported rules than rule files.');
});

test('no-var should be turned on in the recommended settings', async t => {
  t.true(index.configs.recommended.rules['no-var'] === 'error');
});

@@ -459,16 +459,216 @@
 .js'%60);%0A
+    t.truthy(index.rules%5Bname%5D.meta.docs.description, %60'$%7Bname%7D' does not have a description%60);%0A    t.truthy(index.rules%5Bname%5D.meta.docs.recommended, %60'$%7Bname%7D' does not have a recommended setting%60);%0A
     t.tr

Add tests to make sure each rule has a recommended setting and a description