array-includes-polyfill
Version:
Exposing a richer set of Array features for JavaScript
71 lines (50 loc) • 1.7 kB
JavaScript
var arrayES6 = require('../src/array-includes-polyfill-es6');
var arrayES5 = require('../src/array-includes-polyfill-es5');
var arrayDIST = require ('../dist/array-includes-polyfill-es6');
var chai = require('chai');
var expect = chai.expect;
describe('arr ES6 has Array Prototypes', function () {
it('should have separate instance', function () {
var arr = new arrayES6();
var arr2 = new arrayES6();
arr.push(10);
arr2.push(50);
expect(arr[0]).equals(10);
expect(arr2[0]).equals(50);
});
it('should also have includes polyfill', function(){
var arr = new arrayES6();
arr.push('find me');
expect(arr.includes('find me')).equals(true)
});
});
describe('arr ES5 has Array Prototypes', function () {
it('should have separate instances', function(){
var arr = arrayES5();
var arr2 = arrayES5();
arr.push(10);
arr2.push(50);
expect(arr[0]).equals(10);
expect(arr2[0]).equals(50);
});
it('should also have the includes prototype', function(){
var arr = arrayES5();
arr.push('find me');
expect(arr.includes('find me')).equals(true);
});
});
describe('distribution shoudl be the same', function () {
it('should have separate instances', function(){
var arr = new arrayDIST();
var arr2 = new arrayDIST();
arr.push(10);
arr2.push(50);
expect(arr[0]).equals(10);
expect(arr2[0]).equals(50);
});
it('should also have the includes prototype', function(){
var arr = new arrayDIST();
arr.push('find me');
expect(arr.includes('find me')).equals(true);
});
});