'use strict';

var config = require('../');
var stylelint = require('stylelint');

function isObject(obj) {
  return typeof obj === 'object' && obj !== null;
}

it('test basic properties of config', function() {
  expect(isObject(config.plugins)).toBeTruthy();
  expect(isObject(config.rules)).toBeTruthy();
});

it('load config in stylelint to validate rule syntax', function() {
  return stylelint.lint({
    code: 'a { font-weight: bold; }\n',
    codeFilename: 'valid.css',
    config: config,
  }).then(function(data) {
    expect(data).toBeTruthy();
    expect(data.errored).toBeFalsy();
    expect(data.results[0].warnings.length).toBe(0);
  });
});

'use strict';

var path = require('path');
var stylelint = require('stylelint');

it('load config in stylelint to validate rule syntax', function() {
  return stylelint.lint({
    code: 'a { font-weight: bold; }\n',
    codeFilename: 'valid.css',
    configFile: path.join(__dirname, '../index.js'),
  }).then(function(data) {
    expect(data).toBeTruthy();
    expect(data.errored).toBeFalsy();
    expect(data.results[0].warnings.length).toBe(0);
  });
});

Change the way we reference the config in tests
:hammer: Change the way we reference the config in tests
