<commit_before>describe("Searching for services on the transaction explorer. ", function () {
    describe("The search form", function () {
        
        var fakeSearch = undefined,
            ENTER_KEY = 13;

        beforeEach(function () {
            $('<input id="search-box" type="text"></input>').appendTo('body');
            $('<button id="search-button" type="submit">Find</button>').appendTo('body');
            fakeSearch = {
                load: jasmine.createSpy('load search data'),
                performSearch: jasmine.createSpy('perform a search')
            };
            GOVUK.transactionsExplorer.wireSearchForm(
                { inputId: "#search-box", buttonId: "#search-button" },
                fakeSearch
            );
        });

        afterEach(function () {
            $('#search-box').remove();
            $('#search-button').remove();
        });

        it("should load search data the first time the search box gets focus", function () {
            $('#search-box').trigger($.Event('focus'));
            expect(fakeSearch.load).toHaveBeenCalled();
        });

        it("should not try to load the search data multiple times", function () {
            $('#search-box').trigger($.Event('focus'));
            $('#search-box').trigger($.Event('focus'));
            expect(fakeSearch.load.calls.length).toBe(1);
        });

        it("should perform a search when enter is pressed", function () {
            $('#search-box').val('woozle wozzle');
            $('#search-box').trigger($.Event('keydown', { keyCode: ENTER_KEY }));
            expect(fakeSearch.performSearch).toHaveBeenCalledWith('woozle wozzle');
        });

        it("should perform a search when the search button is clicked", function () {
            $('#search-box').val('woozle wozzle weazle');
            $('#search-button').click();
            expect(fakeSearch.performSearch).toHaveBeenCalledWith('woozle wozzle weazle');
        });
    });

    describe("Search", function () {
    
    });
});
<commit_msg>Test for loading search data;<commit_after>describe("Searching for services on the transaction explorer. ", function () {
    describe("The search form", function () {
        
        var fakeSearch = undefined,
            ENTER_KEY = 13;

        beforeEach(function () {
            $('<input id="search-box" type="text"></input>').appendTo('body');
            $('<button id="search-button" type="submit">Find</button>').appendTo('body');
            fakeSearch = {
                load: jasmine.createSpy('load search data'),
                performSearch: jasmine.createSpy('perform a search')
            };
            GOVUK.transactionsExplorer.wireSearchForm(
                { inputId: "#search-box", buttonId: "#search-button" },
                fakeSearch
            );
        });

        afterEach(function () {
            $('#search-box').remove();
            $('#search-button').remove();
        });

        it("should load search data the first time the search box gets focus", function () {
            $('#search-box').trigger($.Event('focus'));
            expect(fakeSearch.load).toHaveBeenCalled();
        });

        it("should not try to load the search data multiple times", function () {
            $('#search-box').trigger($.Event('focus'));
            $('#search-box').trigger($.Event('focus'));
            expect(fakeSearch.load.calls.length).toBe(1);
        });

        it("should perform a search when enter is pressed", function () {
            $('#search-box').val('woozle wozzle');
            $('#search-box').trigger($.Event('keydown', { keyCode: ENTER_KEY }));
            expect(fakeSearch.performSearch).toHaveBeenCalledWith('woozle wozzle');
        });

        it("should perform a search when the search button is clicked", function () {
            $('#search-box').val('woozle wozzle weazle');
            $('#search-button').click();
            expect(fakeSearch.performSearch).toHaveBeenCalledWith('woozle wozzle weazle');
        });
    });

    describe("Search", function () {
        describe("loading search data", function () {
            it('should ajax in some data when loaded', function () {
                var fakeAjax = spyOn($, 'ajax').andReturn({ done: function () {}});
                GOVUK.transactionsExplorer.loadSearchData();
                expect(fakeAjax).toHaveBeenCalled();
            });
        });

        describe("scoring search data", function () {
        });
    });
});

{'fraction_non_alphanumeric': 0.16331046691745962, 'fraction_numerical': 0.0013277273733126797, 'mean_word_length': 2.1943462897526502, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '7525709', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1154, 'n_words': 242}