<commit_before>/**
 * Tests for the `handle-drafts` module
 */
const test = require('tape');
const handleDrafts = require('../lib/handleDrafts');
const Immutable = require('immutable');

const files = Immutable.fromJS([
    { meta: { draft: true } },
    { meta: { draft: true } },
    { meta: { draft: false } },
    { meta: { } },
    { meta: { draft: true } }
]);

test('handle-drafts; Exports a function', t => {
    t.plan(1);
    t.equal(typeof handleDrafts, 'function');
    t.end();
});

test('handle-drafts; Removes drafts if renderDrafts=false', t => {

    t.plan(3);

    handleDrafts(Immutable.Map({ renderDrafts: false }), files)
        .then( filtered => {
            t.equal(filtered.count(), 2);
            filtered.forEach( file => t.false( !! file.getIn(['meta', 'draft']) ) );
        })
        .catch( e => t.fail(e) )
        .then( () => t.end() );
});
<commit_msg>Fix test import<commit_after>/**
 * Tests for the `handle-drafts` module
 */
const test = require('tape');
const handleDrafts = require('../lib/handle-drafts');
const Immutable = require('immutable');

const files = Immutable.fromJS([
    { meta: { draft: true } },
    { meta: { draft: true } },
    { meta: { draft: false } },
    { meta: { } },
    { meta: { draft: true } }
]);

test('handle-drafts; Exports a function', t => {
    t.plan(1);
    t.equal(typeof handleDrafts, 'function');
    t.end();
});

test('handle-drafts; Removes drafts if renderDrafts=false', t => {

    t.plan(3);

    handleDrafts(Immutable.Map({ renderDrafts: false }), files)
        .then( filtered => {
            t.equal(filtered.count(), 2);
            filtered.forEach( file => t.false( !! file.getIn(['meta', 'draft']) ) );
        })
        .catch( e => t.fail(e) )
        .then( () => t.end() );
});

{'fraction_non_alphanumeric': 0.204252937884723, 'fraction_numerical': 0.003357582540570789, 'mean_word_length': 2.6942148760330578, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4862472', 'n_tokens_mistral': 615, 'n_tokens_neox': 608, 'n_words': 134}