<commit_before>require(['JBrowse/Store/LazyArray'], function( LazyArray ) {

describe("LazyArray with test data",
function () {
    var la;

    beforeEach(function() {
        la = new LazyArray({
                               urlTemplate: "../data/lazyarray-{chunk}.json",
                               length: 12,
                               chunkSize: 5
                           });
               });

    it("should have length 12", function() {
        expect(la.length).toEqual(12);
    });

    it("should have \"zero\" at index 0", function() {
        runs(function() {
                 this.callback = jasmine.createSpy();
                 la.index(0, this.callback);
                 expect(this.callback).wasNotCalled();
             });

        waits(500);

        runs(function() {
                 expect(this.callback).wasCalledWith(0, "zero", undefined);
             });
    });

    it("should have \"five\" at index 5", function() {
        runs(function() {
                 this.callback = jasmine.createSpy();
                 la.index(5, this.callback);
                 expect(this.callback).wasNotCalled();
             });

        waits(500);

        runs(function() {
                 expect(this.callback).wasCalledWith(5, "five", undefined);
             });
    });

    it("should run a range call properly", function() {
        runs(function() {
                 this.callback = jasmine.createSpy();
                 la.range(3, 7, this.callback);
                 expect(this.callback).wasNotCalled();
             });

        waits(500);

        // how do we handle the fact that the async calls can return<commit_msg>fix test race conditions<commit_after>require(['JBrowse/Store/LazyArray'], function( LazyArray ) {

describe("LazyArray with test data",
function () {
    var la;

    beforeEach(function() {
        la = new LazyArray({
                               urlTemplate: "../data/lazyarray-{chunk}.json",
                               length: 12,
                               chunkSize: 5
                           });
               });

    it("should have length 12", function() {
        expect(la.length).toEqual(12);
    });

    it("should have \"zero\" at index 0", function() {
        runs(function() {
                 this.callback = jasmine.createSpy();
                 la.index(0, this.callback);
                 expect(this.callback).wasNotCalled();
             });

        waitsFor(() => this.callback.callCount);

        runs(function() {
                 expect(this.callback).wasCalledWith(0, "zero", undefined);
             });
    });

    it("should have \"five\" at index 5", function() {
        runs(function() {
                 this.callback = jasmine.createSpy();
                 la.index(5, this.callback);
                 expect(this.callback).wasNotCalled();
             });

        waitsFor(() => this.callback.callCount);

        runs(function() {
                 expect(this.callback).wasCalledWith(5, "five", undefined);
             });
    });

    it("should run a range call properly", function() {
        runs(function() {
                 this.callback = jasmine.createSpy();
                 la.range(3, 7, this.callback);
                 expect(this.callback).wasNotCalled();
             });

        waitsFor(() => this.callback.callCount);

        // how do we handle the fact that the async calls can return
{'fraction_non_alphanumeric': 0.1379511059371362, 'fraction_numerical': 0.011350407450523865, 'mean_word_length': 1.5051020408163265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6872452', 'n_tokens_mistral': 919, 'n_tokens_neox': 882, 'n_words': 183}