{"size": 1637, "ext": "js", "max_stars_repo_path": "test/index-spec.js", "max_stars_repo_name": "tdtool/tdtool-react", "max_stars_repo_stars_event_min_datetime": "2017-05-03T03:29:13.000Z", "max_stars_repo_stars_event_max_datetime": "2018-08-27T08:03:29.000Z", "max_issues_repo_path": "test/index-spec.js", "max_issues_repo_name": "tdtool/tdtool-react", "max_issues_repo_issues_event_min_datetime": "2020-07-17T11:23:50.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-01T08:43:21.000Z", "max_forks_repo_path": "test/index-spec.js", "max_forks_repo_name": "tdtool/tdtool-react", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 23.0563380282, "max_line_length": 83, "alphanum_fraction": 0.5748320098}
/**
 * @Author: Zhengfeng.Yao <yzf>
 * @Date:   2017-05-03 12:44:55
 * @Last modified by:   yzf
 * @Last modified time: 2017-05-03 12:44:57
 */

import * as chai from 'chai'
import extend from '../src/index'
const expect = chai.expect

class Config {
  constructor() {
    this.config = {}
  }

  add = (key, value) => {
    this.config[key] = value
  }
}

describe('index', () => {
  it('test no options', () => {
    const configObj = new Config()
    extend(configObj)
    expect(configObj.config['rule.jsx']).to.not.be.undefined
    expect(configObj.config['rule.est']).to.not.be.undefined
  })

  it('test options', () => {
    const configObj = new Config()
    extend(configObj, {
      isDebug: true
    })
    expect(configObj.config['rule.jsx'].query.plugins).to.include.members([
      'transform-react-jsx-source', 'transform-react-jsx-self'
    ])
  })

  it('test node options', () => {
    const configObj = new Config()
    extend(configObj, {
      isNode: true
    })
    expect(configObj.config['rule.jsx'].query.plugins).to.include.members([
      'transform-react-jsx-source', 'transform-react-jsx-self'
    ])
    expect(configObj.config['rule.jsx'].query.presets).to.deep.include.members([
      [
        'env',
        {
          targets: {
            node: 'current'
          },
          modules: false,
          useBuiltIns: false,
          debug: false
        }
      ]
    ])
  })

  it('test plugins options', () => {
    const configObj = new Config()
    extend(configObj, {
      plugins: ['test']
    })
    expect(configObj.config['rule.jsx'].query.plugins).to.include.members(['test'])
  })
})
