<commit_before>const chai = require('chai');
const expect = chai.expect;

const LoadingArea = require('../lib/loading_area');

describe('Loading area object', function () {
  let loadingArea = new LoadingArea();

  it('should be an object', function () {
    expect(loadingArea).to.be.a("Object");
  });
  context("loading area state", function() {

    it("should exist", function () {
      expect(loadingArea.state).to.not.eq(undefined);
    });

    it('should have a currently selected lane', function () {
      expect(loadingArea.state.selected).to.not.eq(undefined);
    });

    it('should have a default selected lane of 0', function () {
      expect(loadingArea.state.selected).to.eq(0);
    });

  });

  describe("loadingArea.laneUp()", function() {

    context("when not on the last lane", function() {

      it("should increment the selected lane", function() {
        var prev_lane = loadingArea.state.selected;

        loadingArea.laneUp();

        expect(loadingArea.state.selected).to.eq(prev_lane + 1);
      });

    });

    context("when on the last lane", function() {

      it("should increment the selected lane", function() {
        loadingArea.state.selected = laneCount;

        var laneCount = loadingArea.settings.laneCount;
        var prev_lane = loadingArea.state.selected;

        loadingArea.laneUp();

        expect(loadingArea.state.selected).to.eq(prev_lane);
      });

    });

  });

});
<commit_msg>added test for LoadingArea.laneDown()<commit_after>const chai = require('chai');
const expect = chai.expect;

const LoadingArea = require('../lib/loading_area');

describe('Loading area object', function () {
  let loadingArea = new LoadingArea();
  let laneCount = loadingArea.settings.laneCount;


  it('should be an object', function () {
    expect(loadingArea).to.be.a("Object");
  });
  describe("loading area state", function() {

    it("should exist", function () {
      expect(loadingArea.state).to.not.eq(undefined);
    });

    it('should have a currently selected lane', function () {
      expect(loadingArea.state.selected).to.not.eq(undefined);
    });

    it('should have a default selected lane of 0', function () {
      expect(loadingArea.state.selected).to.eq(0);
    });

  });

  describe("loadingArea.laneUp()", function() {

    context("when not on the last lane", function() {
      beforeEach(function(){
        loadingArea.state.selected = 0;
      });

      it("should increment the selected lane", function() {
        var prev_lane = loadingArea.state.selected;

        loadingArea.laneUp();

        expect(loadingArea.state.selected).to.eq(prev_lane + 1);
      });

    });

    context("when on the last lane", function() {
      beforeEach(function() {
        loadingArea.state.selected = laneCount;
      });

      it("should not increment the selected lane", function() {
        var prev_lane = loadingArea.state.selected;

        loadingArea.laneUp();

        expect(loadingArea.state.selected).to.eq(prev_lane);
      });

    });

  });

  describe("loadingArea.laneDown()", function() {

    context("when not on the first lane", function() {
      beforeEach(function() {
        loadingArea.state.selected = laneCount;
      });

      it("should decrement the selected lane", function() {
        var prev_lane = loadingArea.state.selected;

        loadingArea.laneDown();

        expect(loadingArea.state.selected).to.eq(prev_lane - 1);
      });

    });

    context("when on the first lane", function() {
      beforeEach(function() {
        loadingArea.state.selected = 0;
      });

      it("should not decrement the selected lane", function() {
        var prev_lane = loadingArea.state.selected;

        loadingArea.laneDown();

        expect(loadingArea.state.selected).to.eq(prev_lane);
      });

    });

  });

});

{'fraction_non_alphanumeric': 0.14854318418314255, 'fraction_numerical': 0.0023413111342351716, 'mean_word_length': 2.939549180327869, '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': '7421094', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1063, 'n_words': 237}