<commit_before>'use strict';

var mdast = require('..'),
    assert = require('assert'),
    fs = require('fs'),
    path = require('path');

describe('mdast()', function () {
    it('should be of type `function`', function () {
        assert(typeof mdast === 'function');
    });
});

describe('msast.Parser()', function () {});

describe('msast.Lexer()', function () {});

describe('fixtures', function () {
    var validateInput, validateInputs, optionsMap;

    validateInputs = function (children) {
        children.forEach(validateInput);
    };

    validateInput = function (context) {
        var keys = Object.keys(context),
            type = context.type;

        if (!('type' in context)) {
            console.log('Context without type property:\n', context);
            throw new Error('Context without type property');
        }

        if ('children' in context) {
            assert(Array.isArray(context.children));
            validateInputs(context.children);
        }

        if ('value' in context) {
            assert(typeof context.value === 'string');
        }

        if (
            type === 'paragraph' ||
            type === 'blockquote' ||
            type === 'looseItem' ||
            type === 'listItem'
        ) {
            assert(keys.length === 2);
            assert('children' in context);

            return;
        }

        if (type === 'heading') {
            assert(keys.length === 3);
            assert(context.depth > 0);
            assert(context.depth <= 6);
            assert('children' in context);

            return;
        }

        if (type === 'code') {
            assert(keys.length === 2 || keys.length === 3);
            assert('value' in context);

            if ('lang' in context) {
                assert(
                    context.lang === null ||
                    typeof context.lang === 'string'
                );
            }

            return;
        }

        if (type === 'hr' || type === 'br') {
            assert(keys.length === 1);

            return;
        }

        if (type === 'list') {
            assert('children' in context);
            assert(typeof context.ordered === 'boolean');
            assert(keys.length === 3);

            return;
        }

        if (type === 'text') {
            assert(keys.length === 2);
            assert('value' in context);

            return;
        }

        if (
            type === 'strong' ||
            type === 'emphasis' ||
            type === 'delete'
        ) {
            assert(keys.length === 2);
            assert('children' in context);

            return;
        }

        if (type === 'link') {
            assert('children' in context);
            assert(
                context.title === null ||
                typeof context.title === 'string'
            );
            assert(typeof context.href === 'string');
            assert(keys.length === 4);

            return;
        }

        if (type === 'image') {
            assert(context.title === null || typeof context.alt === 'string');
            assert(typeof context.alt === 'string');
            assert(typeof context.href === 'string');
            assert(keys.length === 4);

            return;
        }

        if (type === 'table') {
            context.header.forEach(validateInputs);

            context.cells.forEach(function (row) {
                row.forEach(validateInputs);
            });

            assert(Array.isArray(context.align));

            context.align.forEach(function (align) {
                assert(
                    align === null ||
                    align === 'left' ||
                    align === 'right' ||
                    align === 'center'
                );
            });

            assert(keys.length === 4);

            return;
        }

        if (type === 'html') {
            assert(keys.length === 2);
            assert('value' in context);

            return;
        }

        throw new Error('Unknown token of type `' + type + '`');
    };

    optionsMap = {<commit_msg>Removed two uncovered branches from spec<commit_after>'use strict';

var mdast = require('..'),
    assert = require('assert'),
    fs = require('fs'),
    path = require('path');

describe('mdast()', function () {
    it('should be of type `function`', function () {
        assert(typeof mdast === 'function');
    });
});

describe('msast.Parser()', function () {});

describe('msast.Lexer()', function () {});

describe('fixtures', function () {
    var validateInput, validateInputs, optionsMap;

    validateInputs = function (children) {
        children.forEach(validateInput);
    };

    validateInput = function (context) {
        var keys = Object.keys(context),
            type = context.type;

        assert('type' in context);

        if ('children' in context) {
            assert(Array.isArray(context.children));
            validateInputs(context.children);
        }

        if ('value' in context) {
            assert(typeof context.value === 'string');
        }

        if (
            type === 'paragraph' ||
            type === 'blockquote' ||
            type === 'looseItem' ||
            type === 'listItem'
        ) {
            assert(keys.length === 2);
            assert('children' in context);

            return;
        }

        if (type === 'heading') {
            assert(keys.length === 3);
            assert(context.depth > 0);
            assert(context.depth <= 6);
            assert('children' in context);

            return;
        }

        if (type === 'code') {
            assert(keys.length === 2 || keys.length === 3);
            assert('value' in context);

            if ('lang' in context) {
                assert(
                    context.lang === null ||
                    typeof context.lang === 'string'
                );
            }

            return;
        }

        if (type === 'hr' || type === 'br') {
            assert(keys.length === 1);

            return;
        }

        if (type === 'list') {
            assert('children' in context);
            assert(typeof context.ordered === 'boolean');
            assert(keys.length === 3);

            return;
        }

        if (type === 'text') {
            assert(keys.length === 2);
            assert('value' in context);

            return;
        }

        if (
            type === 'strong' ||
            type === 'emphasis' ||
            type === 'delete'
        ) {
            assert(keys.length === 2);
            assert('children' in context);

            return;
        }

        if (type === 'link') {
            assert('children' in context);
            assert(
                context.title === null ||
                typeof context.title === 'string'
            );
            assert(typeof context.href === 'string');
            assert(keys.length === 4);

            return;
        }

        if (type === 'image') {
            assert(context.title === null || typeof context.title === 'string');
            assert(typeof context.alt === 'string');
            assert(typeof context.href === 'string');
            assert(keys.length === 4);

            return;
        }

        if (type === 'table') {
            context.header.forEach(validateInputs);

            context.cells.forEach(function (row) {
                row.forEach(validateInputs);
            });

            assert(Array.isArray(context.align));

            context.align.forEach(function (align) {
                assert(
                    align === null ||
                    align === 'left' ||
                    align === 'right' ||
                    align === 'center'
                );
            });

            assert(keys.length === 4);

            return;
        }

        /* This is the last possible type. If more types are added, they
         * should be added before this block, or the type:html tests should
         * be wrapped in an if statement. */
        assert(type === 'html');
        assert(keys.length === 2);
        assert('value' in context);
    };

    optionsMap = {
{'fraction_non_alphanumeric': 0.1502988898377455, 'fraction_numerical': 0.0034158838599487617, 'mean_word_length': 1.4055164319248827, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7276197', 'n_tokens_mistral': 2128, 'n_tokens_neox': 2006, 'n_words': 487}