{"size": 943, "ext": "js", "max_stars_repo_path": "test/test.js", "max_stars_repo_name": "YoungTailors/sao-ts", "max_stars_repo_stars_event_min_datetime": "2018-12-12T02:40:04.000Z", "max_stars_repo_stars_event_max_datetime": "2020-01-08T07:25:39.000Z", "max_issues_repo_path": "test/test.js", "max_issues_repo_name": "YoungTailors/sao-ts", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/test.js", "max_forks_repo_name": "YoungTailors/sao-ts", "max_forks_repo_forks_event_min_datetime": "2019-02-02T07:58:16.000Z", "max_forks_repo_forks_event_max_datetime": "2020-08-27T12:23:44.000Z"}
{"max_stars_count": 5, "max_issues_count": null, "max_forks_count": 4, "avg_line_length": 29.46875, "max_line_length": 69, "alphanum_fraction": 0.6702014846}
import path from 'path'
import test from 'ava'
import sao from 'sao'

const generator = path.join(__dirname, '..')
const name = 'Hello world'

test('defaults', async t => {
  const stream = await sao.mock({ generator }, { name })

  t.snapshot(stream.fileList, 'Generated files')

  const indexFile = await stream.readFile('src/index.ts')
  t.truthy(indexFile.includes(name.toLowerCase()))
})

test('ESLint tool: xo', async t => {
  const stream = await sao.mock({ generator }, { eslint: 'xo' })
  const pkg = await stream.readFile('package.json')
  const pkgJson = JSON.parse(pkg)
  t.truthy(pkgJson.xo)
  t.truthy(pkgJson['lint-staged'].linters['*.{ts,js}'])
})

test('ESLint tool: disable', async t => {
  const stream = await sao.mock({ generator }, { eslint: 'disable' })
  const pkg = await stream.readFile('package.json')
  const pkgJson = JSON.parse(pkg)
  t.falsy(pkgJson.xo)
  t.falsy(pkgJson['lint-staged'].linters['*.{ts,js}'])
})
