<commit_before>///* Tests for fileBrowser.js for My Projects in Dashboard */
///*global describe, it, expect, example, before, after, beforeEach, afterEach, mocha, sinon*/
//'use strict';
//var assert = require('chai').assert;
//
//var $ = require('jquery');
//var $osf = require('js/osfHelpers');
//var fb = require('js/fileBrowser.js');
//var m = require('mithril');
//
//var FileBrowser = fb.FileBrowser;
//var LinkObject = fb.LinkObject;
//
//describe('fileBrowser', function() {
//    describe('LinkObject', function () {
//        var collection;
//        var tag;
//        var name;
//        var node;
//
//        before(function () {
//            collection = new LinkObject('collection', {
//                path: 'users/me/nodes/',
//                query: {'related_counts': true},
//                systemCollection: true
//            }, 'All My Projects');
//            tag = new LinkObject('tag', { tag : 'something', query : { 'related_counts' : true }}, 'Something Else');
//            name = new LinkObject('name', { id : '8q36f', query : { 'related_counts' : true }}, '<NAME>');
//            node = new LinkObject('node', { uid : 'qwerty'}, 'Node Title');
//        });
//
//        describe('#attributes', function () {
//            it('should return an id of 1', function () {
//                assert.equal(collection.id, 1);
//            });
//            it('should throw error when no arguments passed', function () {
//                assert.throws(function(){ var missing = new LinkObject(); }, Error);
//            });
//            it('should throw error when index is not number and  > 0', function () {
//                assert.throws(function(){ var missing = new LinkObject('tag', { tag : 'something', query : { 'related_counts' : true }}, 'Something Else', 'index'); }, Error);
//                assert.throws(function(){ var missing = new LinkObject('tag', { tag : 'something', query : { 'related_counts' : true }}, 'Something Else', -1); }, Error);
//            });
//        });
//
//        describe('#generateLinks', function () {
//            it('should return correct collection link', function () {
//                assert.equal(collection.link, 'users/me/nodes/?related_counts=true');
//            });
//            it('should return correct tag link', function () {
//                assert.equal(tag.link, 'nodes/?filter%5Btags%5D=something&related_counts=true&embed=contributors');
//            });
//            it('should return correct name link', function () {
//                assert.equal(name.link, 'users/8q36f/nodes/?related_counts=true&embed=contributors');
//            });
//            it('should return correct node link', function () {
//                assert.equal(node.link, 'nodes/qwerty/children/?related_counts=true&embed=contributors');
//            });
//        });
//    });
//
//    describe('fileBrowserModule', function(){
//        var fb;
//        before(function() {
//            fb = m.mount(document.body, m.component(FileBrowser, {wrapperSelector : 'body'}));
//        });
//        describe('mainModule', function () {
//            it('should throw error when url is not string', function () {
//                assert.throws(function(){
//                    FileBrowser.controller.updateList(234234);
//                }, Error);
//            });
//        });
//    });
//});<commit_msg>Uncomment unproblematic tests [skip ci]<commit_after>
//TODO uncomment and write more tests
/* Tests for fileBrowser.js for My Projects in Dashboard */
/*global describe, it, expect, example, before, after, beforeEach, afterEach, mocha, sinon*/
'use strict';
var assert = require('chai').assert;

var $ = require('jquery');
var $osf = require('js/osfHelpers');
var fb = require('js/fileBrowser.js');
var m = require('mithril');

var FileBrowser = fb.FileBrowser;
var LinkObject = fb.LinkObject;

describe('fileBrowser', function() {
    describe('LinkObject', function () {
        var collection;
        var tag;
        var name;
        var node;

        before(function () {
            collection = new LinkObject('collection', {
                path: 'users/me/nodes/',
                query: {'related_counts': true},
                systemCollection: true
            }, 'All My Projects');
            tag = new LinkObject('tag', { tag : 'something', query : { 'related_counts' : true }}, 'Something Else');
            name = new LinkObject('name', { id : '8q36f', query : { 'related_counts' : true }}, '<NAME>');
            node = new LinkObject('node', { uid : 'qwerty'}, 'Node Title');
        });

        describe('#attributes', function () {
            it('should return an id of 1', function () {
                assert.equal(collection.id, 1);
            });
            it('should throw error when no arguments passed', function () {
                assert.throws(function(){ var missing = new LinkObject(); }, Error);
            });
            it('should throw error when index is not number and  > 0', function () {
                assert.throws(function(){ var missing = new LinkObject('tag', { tag : 'something', query : { 'related_counts' : true }}, 'Something Else', 'index'); }, Error);
                assert.throws(function(){ var missing = new LinkObject('tag', { tag : 'something', query : { 'related_counts' : true }}, 'Something Else', -1); }, Error);
            });
        });

        describe('#generateLinks', function () {
            it('should return correct collection link', function () {
                assert.equal(collection.link, 'users/me/nodes/?related_counts=true');
            });
            it('should return correct tag link', function () {
                assert.equal(tag.link, 'nodes/?filter%5Btags%5D=something&related_counts=true&embed=contributors');
            });
            it('should return correct name link', function () {
                assert.equal(name.link, 'users/8q36f/nodes/?related_counts=true&embed=contributors');
            });
            it('should return correct node link', function () {
                assert.equal(node.link, 'nodes/qwerty/children/?related_counts=true&embed=contributors');
            });
        });
    });
});
{'fraction_non_alphanumeric': 0.171648987463838, 'fraction_numerical': 0.0048216007714561235, 'mean_word_length': 2.1701477330616403, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3390249', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1649, 'n_words': 418}