<commit_before>gt.module('docs to modules');

var getComments = require('../src/getTaggedComments');
var d2m = require('../src/docsToModules');

gt.test('basics', function () {
    gt.arity(d2m, 1, 'expects single argument');
    gt.arity(getComments, 1, 'expects filenames array');
});

gt.test('basic example', function () {
    var files = ['../examples/basic/src/foo.js'];
    var comments = getComments(files);
    gt.array(comments, 'expected array back');
    gt.equal(comments.length, 1, 'single comment');
    var c = comments[0];
    gt.array(c.tags, 'has tags');
    gt.object(c.description, 'has description');
    gt.string(c.filename, 'has filename');
    // console.log(JSON.stringify(comments));

    var root = d2m(comments);
    gt.object(root, 'returns root module object');
    // console.log(JSON.stringify(root));
    gt.undefined(root.name, 'root module has no name');
    gt.array(root.methodDocs, 'root module has method docs');
    gt.equal(root.methodDocs.length, 1, 'single method');
});

gt.test('empty modules tree', function () {
    var root = d2m([]);
    gt.object(root, 'returns root module object');
    gt.undefined(root.name, 'root module has no name');
    gt.undefined(root.methodDocs, 'root module has no docs');
})

gt.test('skip samples', function () {
    var files = ['../examples/basic/test/fooTests.js'];
    var comments = getComments(files);
    console.log(JSON.stringify(comments));
    gt.array(comments, 'get an array');
    gt.equal(comments.length, 2, 'two comments');

    var root = d2m(comments);
    gt.object(root, 'returns root module object');
    console.log(JSON.stringify(root));
    gt.undefined(root.name, 'root module has no name');
    gt.array(root.methodDocs, 'root module has method docs');
    gt.equal(root.methodDocs.length, 0, 'no methods');
});<commit_msg>fixed paths in unit test<commit_after>gt.module('docs to modules');

var getComments = require('../src/getTaggedComments');
var d2m = require('../src/docsToModules');
var path = require('path');

var foo = path.join(__dirname, '../examples/basic/src/foo.js');
var fooTests = path.join(__dirname, '../examples/basic/test/fooTests.js');

gt.test('basics', function () {
    gt.arity(d2m, 1, 'expects single argument');
    gt.arity(getComments, 1, 'expects filenames array');
});

gt.test('basic example', function () {
    var files = [foo];
    var comments = getComments(files);
    gt.array(comments, 'expected array back');
    gt.equal(comments.length, 1, 'single comment');
    var c = comments[0];
    gt.array(c.tags, 'has tags');
    gt.object(c.description, 'has description');
    gt.string(c.filename, 'has filename');
    // console.log(JSON.stringify(comments));

    var root = d2m(comments);
    gt.object(root, 'returns root module object');
    // console.log(JSON.stringify(root));
    gt.undefined(root.name, 'root module has no name');
    gt.array(root.methodDocs, 'root module has method docs');
    gt.equal(root.methodDocs.length, 1, 'single method');
});

gt.test('empty modules tree', function () {
    var root = d2m([]);
    gt.object(root, 'returns root module object');
    gt.undefined(root.name, 'root module has no name');
    gt.undefined(root.methodDocs, 'root module has no docs');
})

gt.test('skip samples', function () {
    var files = [fooTests];
    var comments = getComments(files);
    console.log(JSON.stringify(comments));
    gt.array(comments, 'get an array');
    gt.equal(comments.length, 2, 'two comments');

    var root = d2m(comments);
    gt.object(root, 'returns root module object');
    console.log(JSON.stringify(root));
    gt.undefined(root.name, 'root module has no name');
    gt.array(root.methodDocs, 'root module has method docs');
    gt.equal(root.methodDocs.length, 0, 'no methods');
});
{'fraction_non_alphanumeric': 0.17203166226912928, 'fraction_numerical': 0.0063324538258575196, 'mean_word_length': 3.910621761658031, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6680335', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1195, 'n_words': 301}