<commit_before>const path = require('path');
const test = require('ava');
const sao = require('sao');

const template = path.join(__dirname, '..');

const defaults = {
  name: 'lass',
  description: 'my project description',
  license: 'MIT',
  version: '0.0.1',
  author: '<NAME>',
  email: '<EMAIL>',
  website: 'http://niftylettuce.com',
  username: 'niftylettuce',
  keywords: 'boilerplate,generator npm package lass'
};

test('auto detects email address from github', async t => {
  const stream = await sao.mockPrompt(template, {
    name: 'lass',
    description: 'test',
    license: 'MIT',
    version: '0.0.1',
    author: 'TJ',
    email: '<EMAIL>',
    website: 'https://apex.sh'
  });
  t.is(stream.meta.answers.username, 'tj');
});

test('defaults', async t => {
  const stream = await sao.mockPrompt(
    template,
    Object.assign({}, defaults, {
      name: 'my-package-name'
    })
  );
<commit_msg>add test for SPDX licenses other than MIT<commit_after>const path = require('path');
const test = require('ava');
const sao = require('sao');
const spdxLicenseList = require('spdx-license-list/simple');

const template = path.join(__dirname, '..');

const defaults = {
  name: 'lass',
  description: 'my project description',
  license: 'MIT',
  version: '0.0.1',
  author: '<NAME>',
  email: '<EMAIL>',
  website: 'http://niftylettuce.com',
  username: 'niftylettuce',
  keywords: 'boilerplate,generator npm package lass'
};

test('auto detects email address from github', async t => {
  const stream = await sao.mockPrompt(template, {
    name: 'lass',
    description: 'test',
    license: 'MIT',
    version: '0.0.1',
    author: 'TJ',
    email: '<EMAIL>',
    website: 'https://apex.sh'
  });
  t.is(stream.meta.answers.username, 'tj');
});

test('allows SPDX licenses', async t => {
  const getRandomLicense = () => {
    return Array.from(spdxLicenseList)[
      Math.floor(Math.random() * Array.from(spdxLicenseList).length)
    ];
  };
  const license = getRandomLicense();
  const stream = await sao.mockPrompt(template, {
    name: 'lass',
    description: 'test',
    license,
    version: '0.0.1',
    author: 'TJ',
    email: '<EMAIL>',
    website: 'https://apex.sh'
  });
  t.is(stream.meta.answers.license, license);
});

//
// test.todo('logs error on non-SPDX license');

//
// test.todo('logs error if soa fails to write license');

test('defaults', async t => {
  const stream = await sao.mockPrompt(
    template,
    Object.assign({}, defaults, {
      name: 'my-package-name'
    })
  );

{'fraction_non_alphanumeric': 0.18135124456736468, 'fraction_numerical': 0.005926511260371394, 'mean_word_length': 3.553956834532374, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 16, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2676477', 'n_tokens_mistral': 876, 'n_tokens_neox': 869, 'n_words': 210}