<commit_before>'use strict';

/* Written by Carl, test for search.js (used for objs such as expts and
biosources). Test data captured from Nov. 2016 metadata.*/

jest.autoMockOff();

// Fixes https://github.com/facebook/jest/issues/78
jest.dontMock('react');
jest.dontMock('underscore');


describe('Testing search.js', function() {
    var React, Search, testSearch, TestUtils, context, schemas, _;

    beforeEach(function() {
        React = require('react');
        TestUtils = require('react-dom/lib/ReactTestUtils');
        _ = require('underscore');
        Search = require('../search').Search;
        context = require('../testdata/expt_search');

        testSearch = TestUtils.renderIntoDocument(
            <Search context={context} href="/search/?type=ExperimentHiC" />
        );

    });

    it('has the correct number of facets and experiment accessions listed', function() {
        var facets = TestUtils.scryRenderedDOMComponentsWithClass(testSearch, 'facet');
        var results = TestUtils.scryRenderedDOMComponentsWithClass(testSearch, 'result-table-result');
        expect(facets.length).toEqual(8);
        expect(results.length).toEqual(5);
    });

    it('has a good title', function() {
        var titleLine = TestUtils.findRenderedDOMComponentWithTag(testSearch, 'h1');
        expect(titleLine.textContent).toEqual('ExperimentHiC Search');
    });

    it('facets properly (digestion_enzyme=hindIII)', function() {
        context = require('../testdata/expt_search_hindIII');
        testSearch = TestUtils.renderIntoDocument(
            <Search context={context} href='/search/?type=ExperimentHiC&digestion_enzyme.name=HindIII' />
        );
        var results = TestUtils.scryRenderedDOMComponentsWithClass(testSearch, 'result-table-result');
        var selectedFacets = TestUtils.scryRenderedDOMComponentsWithClass(testSearch, 'selected');
        expect(results.length).toEqual(2);
        expect(selectedFacets.length).toEqual(1);
    });
});<commit_msg>Test fix<commit_after>'use strict';

/* Written by Carl, test for search.js (used for objs such as expts and
biosources). Test data captured from Nov. 2016 metadata.*/

jest.autoMockOff();

// Fixes https://github.com/facebook/jest/issues/78
jest.dontMock('react');
jest.dontMock('underscore');


describe('Testing search.js', function() {
    var React, Search, testSearch, TestUtils, context, schemas, _;

    beforeEach(function() {
        React = require('react');
        TestUtils = require('react-dom/lib/ReactTestUtils');
        _ = require('underscore');
        Search = require('../search').Search;
        context = require('../testdata/expt_search');

        testSearch = TestUtils.renderIntoDocument(
            <Search context={context} href="/search/?type=ExperimentHiC" />
        );

    });

    it('has the correct number of facets and experiment accessions listed', function() {
        var facets = TestUtils.scryRenderedDOMComponentsWithClass(testSearch, 'facet');
        var results = TestUtils.scryRenderedDOMComponentsWithClass(testSearch, 'result-table-result');
        expect(facets.length).toBeGreaterThan(7);
        expect(results.length).toEqual(5);
    });

    it('has a good title', function() {
        var titleLine = TestUtils.findRenderedDOMComponentWithTag(testSearch, 'h1');
        expect(titleLine.textContent).toEqual('ExperimentHiC Search');
    });

    it('facets properly (digestion_enzyme=hindIII)', function() {
        context = require('../testdata/expt_search_hindIII');
        testSearch = TestUtils.renderIntoDocument(
            <Search context={context} href='/search/?type=ExperimentHiC&digestion_enzyme.name=HindIII' />
        );
        var results = TestUtils.scryRenderedDOMComponentsWithClass(testSearch, 'result-table-result');
        var selectedFacets = TestUtils.scryRenderedDOMComponentsWithClass(testSearch, 'selected');
        expect(results.length).toEqual(2);
        expect(selectedFacets.length).toEqual(2);
    });
});
{'fraction_non_alphanumeric': 0.13583021223470662, 'fraction_numerical': 0.005493133583021223, 'mean_word_length': 3.658139534883721, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '7055394', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1123, 'n_words': 213}