<commit_before>'use strict';

const list = require('../../lib/command/list');
const test = require('tape');

const runners = [{
    name: 'patch',
    command: 'wisdom patch',
    directories: ['~']
}, {
    name: 'minor',
    command: 'wisdom minor',
    directories: ['~']
}];

test('longrun: list names of runners', (t) => {
    const names = [
        'patch',
        'minor'
    ];
    
    const expect = names
        .map((name) => `${name}\n`)
        .join('');
    
    list(runners, {}, (error, result) => {
        t.notOk(error, 'should not be error');
        t.equal(expect, result, 'should list names of runner');
        t.end();
    });
});

test('longrun: list directories of runners', (t) => {
    const expect = [
        '* patch',
        '|  ~',
        '* minor',
        '|  ~'
        ].join('\n') + '\n';
    
    list(runners, {directories: true}, (error, result) => {
        t.equal(expect, result, 'should list directories of runners');
        t.end();
    });
});

test('longrun: list commands of runners', (t) => {
    const expect = [
        '* patch',
        '> wisdom patch',
        '* minor',
        '> wisdom minor'
        ].join('\n') + '\n';
    
    list(runners, {commands: true}, (error, result) => {
        t.equal(expect, result, 'should list commands of runners');
        t.end();
    });
});

test('longrun: list all runners', (t) => {
    const expect = [
        '* patch',
        '> wisdom patch',
        '|  ~',
        '* minor',
        '> wisdom minor',
        '|  ~'
        ].join('\n') + '\n';
    
    list(runners, {all: true}, (error, result) => {
        t.equal(expect, result, 'should list all runners');
        t.end();
    });
});

test('longrun: list runner', (t) => {
    const expect = [
        '* minor',
        '> wisdom minor',
        '|  ~',
        ].join('\n') + '\n';
    
    list(runners, {name: 'minor'}, (error, result) => {
        t.equal(result, expect, 'should list runner');
        t.end();
    });
});

test('longrun: list directory of runner', (t) => {
    const expect = [
        '* patch',
        '|  ~',
        ].join('\n') + '\n';
    
    list(runners, {name: 'patch', directories: true}, (error, result) => {
        t.equal(expect, result, 'should list runner');
        t.end();
    });
});

test('longrun: list command of runner', (t) => {
    const expect = [
        '* patch',
        '> wisdom patch',
        ].join('\n') + '\n';
    
    list(runners, {name: 'patch', commands: true}, (error, result) => {
        t.equal(expect, result, 'should list command of runner');
        t.end();
    });
});
<commit_msg>test(list) expect, result -> result, expect<commit_after>'use strict';

const list = require('../../lib/command/list');
const test = require('tape');

const runners = [{
    name: 'patch',
    command: 'wisdom patch',
    directories: ['~']
}, {
    name: 'minor',
    command: 'wisdom minor',
    directories: ['~']
}];

test('longrun: list names of runners', (t) => {
    const names = [
        'patch',
        'minor'
    ];
    
    const expect = names
        .map((name) => `${name}\n`)
        .join('');
    
    list(runners, {}, (error, result) => {
        t.notOk(error, 'should not be error');
        t.equal(result, expect, 'should list names of runner');
        t.end();
    });
});

test('longrun: list directories of runners', (t) => {
    const expect = [
        '* patch',
        '|  ~',
        '* minor',
        '|  ~'
        ].join('\n') + '\n';
    
    list(runners, {directories: true}, (error, result) => {
        t.equal(expect, result, 'should list directories of runners');
        t.end();
    });
});

test('longrun: list commands of runners', (t) => {
    const expect = [
        '* patch',
        '> wisdom patch',
        '* minor',
        '> wisdom minor'
        ].join('\n') + '\n';
    
    list(runners, {commands: true}, (error, result) => {
        t.equal(expect, result, 'should list commands of runners');
        t.end();
    });
});

test('longrun: list all runners', (t) => {
    const expect = [
        '* patch',
        '> wisdom patch',
        '|  ~',
        '* minor',
        '> wisdom minor',
        '|  ~'
        ].join('\n') + '\n';
    
    list(runners, {all: true}, (error, result) => {
        t.equal(expect, result, 'should list all runners');
        t.end();
    });
});

test('longrun: list runner', (t) => {
    const expect = [
        '* minor',
        '> wisdom minor',
        '|  ~',
        ].join('\n') + '\n';
    
    list(runners, {name: 'minor'}, (error, result) => {
        t.equal(result, expect, 'should list runner');
        t.end();
    });
});

test('longrun: list directory of runner', (t) => {
    const expect = [
        '* patch',
        '|  ~',
        ].join('\n') + '\n';
    
    list(runners, {name: 'patch', directories: true}, (error, result) => {
        t.equal(expect, result, 'should list runner');
        t.end();
    });
});

test('longrun: list command of runner', (t) => {
    const expect = [
        '* patch',
        '> wisdom patch',
        ].join('\n') + '\n';
    
    list(runners, {name: 'patch', commands: true}, (error, result) => {
        t.equal(expect, result, 'should list command of runner');
        t.end();
    });
});

{'fraction_non_alphanumeric': 0.2119954734062618, 'fraction_numerical': 0.0, 'mean_word_length': 1.954317548746518, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 46, 'https://': 0, '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': '2445396', 'n_tokens_mistral': 1759, 'n_tokens_neox': 1734, 'n_words': 422}