<commit_before>'use strict';

var chai = require('chai');
var chaiImmutable = require('../chai-immutable');
var assert = chai.assert;
var expect = chai.expect;
var Immutable = require('immutable');
var List = Immutable.List;
var Map = Immutable.Map;

chai.use(chaiImmutable);

describe('chai-immutable', function () {
  var list3 = List.of(1, 2, 3);

  describe('BDD interface', function () {
    describe('empty property', function () {
      it('should be true when given an empty collection', function () {
        expect(new List()).to.be.empty;
      });

      it('should be false when given a non-empty collection', function () {
        expect(list3).to.not.be.empty;
      });

      it('should not affect the original assertions', function () {
        expect([]).to.be.empty;
        expect('').to.be.empty;
        expect({}).to.be.empty;
      });
    });

    describe('equal method', function () {
      it('should be true when compared structure is equal', function () {
        expect(list3).to.equal(List.of(1, 2, 3));
      });

      it('should be false when compared structure not equal', function () {
        expect(list3).to.not.equal(new List());
      });

      it('aliases of equal should also work', function () {
        expect(list3).to.equal(List.of(1, 2, 3));
        expect(list3).to.not.equal(new List());
        expect(list3).to.equals(List.of(1, 2, 3));
        expect(list3).to.not.equals(new List());
        expect(list3).to.eq(List.of(1, 2, 3));
        expect(list3).to.not.eq(new List());
        expect(list3).to.deep.equal(List.of(1, 2, 3));
        expect(list3).to.not.deep.equal(new List());
      });

      it('should not affect the original assertions', function () {
        expect('hello').to.equal('hello');
        expect(42).to.equal(42);
        expect(1).to.not.equal(true);
        expect({ foo: 'bar' }).to.not.equal({ foo: 'bar' });
        expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' });
      });
    });

    describe('keys method', function () {
      var mapFoobar = new Map({ foo: 1, bar: 2 });

      it('should be true when given an existing key', function () {
        expect(new Map({ foo: 1 })).to.have.key('foo');
      });

      it('should be false when given a non existing key', function () {
        expect(mapFoobar).to.not.have.key('notfoo');
      });

      it('should be true when given multiple existing keys', function () {
        expect(mapFoobar).to.have.keys('foo', 'bar');
      });

      it('should be false when given multiple non existing keys', function () {
        expect(mapFoobar).to.not.have.keys('not-foo', 'not-bar');
      });

      it('should accept an Array of keys to check against', function () {
        expect(mapFoobar).to.have.keys(['bar', 'foo']);
      });

      it('should accept an Object to check against', function () {
        expect(mapFoobar).to.have.keys({ 'bar': 6, 'foo': 7 });
      });

      it('should be true when used with any and an existing key', function () {
        expect(mapFoobar).to.have.any.keys('foo', 'not-foo');
      });

      it('should be false when used with any and inexisting keys', function () {
        expect(mapFoobar).to.not.have.any.keys('not-foo', 'not-bar');
      });

      it('should be true when used with all and existing keys', function () {
        expect(mapFoobar).to.have.all.keys('foo', 'bar');
      });

      it('should be false when used with all and inexisting keys', function () {
        expect(mapFoobar).to.not.have.all.keys('not-foo', 'bar');
      });
    });

    describe('size method', function () {
      it('should be true when given the right size', function () {
        expect(list3).to.have.size(3);
      });

      it('should be false when given the wrong size', function () {
        expect(list3).to.not.have.size(42);
      });<commit_msg>Check consistency for all tests for keys method<commit_after>'use strict';

var chai = require('chai');
var chaiImmutable = require('../chai-immutable');
var assert = chai.assert;
var expect = chai.expect;
var Immutable = require('immutable');
var List = Immutable.List;
var Map = Immutable.Map;

chai.use(chaiImmutable);

describe('chai-immutable', function () {
  var list3 = List.of(1, 2, 3);

  describe('BDD interface', function () {
    describe('empty property', function () {
      it('should be true when given an empty collection', function () {
        expect(new List()).to.be.empty;
      });

      it('should be false when given a non-empty collection', function () {
        expect(list3).to.not.be.empty;
      });

      it('should not affect the original assertions', function () {
        expect([]).to.be.empty;
        expect('').to.be.empty;
        expect({}).to.be.empty;
      });
    });

    describe('equal method', function () {
      it('should be true when compared structure is equal', function () {
        expect(list3).to.equal(List.of(1, 2, 3));
      });

      it('should be false when compared structure not equal', function () {
        expect(list3).to.not.equal(new List());
      });

      it('aliases of equal should also work', function () {
        expect(list3).to.equal(List.of(1, 2, 3));
        expect(list3).to.not.equal(new List());
        expect(list3).to.equals(List.of(1, 2, 3));
        expect(list3).to.not.equals(new List());
        expect(list3).to.eq(List.of(1, 2, 3));
        expect(list3).to.not.eq(new List());
        expect(list3).to.deep.equal(List.of(1, 2, 3));
        expect(list3).to.not.deep.equal(new List());
      });

      it('should not affect the original assertions', function () {
        expect('hello').to.equal('hello');
        expect(42).to.equal(42);
        expect(1).to.not.equal(true);
        expect({ foo: 'bar' }).to.not.equal({ foo: 'bar' });
        expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' });
      });
    });

    describe('keys method', function () {
      var mapFoobar = new Map({ foo: 1, bar: 2 });
      var objectFoobar = { foo: 1, bar: 2 };

      it('should be true when given an existing key', function () {
        expect(new Map({ foo: 1 })).to.have.key('foo');
        expect({ foo: 1 }).to.have.key('foo');
      });

      it('should be false when given a non existing key', function () {
        expect(mapFoobar).to.not.have.key('notfoo');
        expect(objectFoobar).to.not.have.key('notfoo');
      });

      it('should be true when given multiple existing keys', function () {
        expect(mapFoobar).to.have.keys('foo', 'bar');
        expect(objectFoobar).to.have.keys('foo', 'bar');
      });

      it('should be false when given multiple non existing keys', function () {
        expect(mapFoobar).to.not.have.keys('not-foo', 'not-bar');
        expect(objectFoobar).to.not.have.keys('not-foo', 'not-bar');
      });

      it('should accept an Array of keys to check against', function () {
        expect(mapFoobar).to.have.keys(['bar', 'foo']);
        expect(objectFoobar).to.have.keys(['bar', 'foo']);
      });

      it('should accept an Object to check against', function () {
        expect(mapFoobar).to.have.keys({ 'bar': 6, 'foo': 7 });
        expect(objectFoobar).to.have.keys({ 'bar': 6, 'foo': 7 });
      });

      it('should be true when used with any and an existing key', function () {
        expect(mapFoobar).to.have.any.keys('foo', 'not-foo');
        expect(objectFoobar).to.have.any.keys('foo', 'not-foo');
      });

      it('should be false when used with any and inexisting keys', function () {
        expect(mapFoobar).to.not.have.any.keys('not-foo', 'not-bar');
        expect(objectFoobar).to.not.have.any.keys('not-foo', 'not-bar');
      });

      it('should be true when used with all and existing keys', function () {
        expect(mapFoobar).to.have.all.keys('foo', 'bar');
        expect(objectFoobar).to.have.all.keys('foo', 'bar');
      });

      it('should be false when used with all and inexisting keys', function () {
        expect(mapFoobar).to.not.have.all.keys('not-foo', 'bar');
        expect(objectFoobar).to.not.have.all.keys('not-foo', 'bar');
      });
    });

    describe('size method', function () {
      it('should be true when given the right size', function () {
        expect(list3).to.have.size(3);
      });

      it('should be false when given the wrong size', function () {
        expect(list3).to.not.have.size(42);
      });
{'fraction_non_alphanumeric': 0.18105916030534353, 'fraction_numerical': 0.011331106870229007, 'mean_word_length': 2.6711908931698773, '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': '3568975', 'n_tokens_mistral': 2713, 'n_tokens_neox': 2567, 'n_words': 643}