'use strict';

var _utils = require('./utils');

describe('allIndexOf', function () {
	it('should get 2 indexes with allIndexOf', function () {
		var indexes = (0, _utils.allIndexOf)('AaBbCcAa'.toLowerCase(), 'Aa'.toLowerCase());
		expect(indexes.length).toBe(2);
		expect(indexes[0]).toBe(0);
		expect(indexes[1]).toBe(6);
	});

	it('should get 1 indexes with allIndexOf', function () {
		var indexes = (0, _utils.allIndexOf)('AaBbCcAa'.toLowerCase(), 'bb'.toLowerCase());
		expect(indexes.length).toBe(1);
		expect(indexes[0]).toBe(2);
	});

	it('should get empty array from allIndexOf', function () {
		var indexes = (0, _utils.allIndexOf)('AaBbCcAa'.toLowerCase(), 'ee'.toLowerCase());
		expect(indexes.length).toBe(0);
	});
});

describe('removeDuplicates', function () {
	it('should remove indexes with short search', function () {
		var indexes = (0, _utils.removeDuplicates)([0, 1, 2, 3], 'aa');
		expect(indexes.length).toBe(2);
		expect(indexes[0]).toBe(0);
		expect(indexes[1]).toBe(2);
	});

	it('should not remove indexes when not in searchLenght', function () {
		var indexes = (0, _utils.removeDuplicates)([0, 10], 'hello');
		expect(indexes.length).toBe(2);
		expect(indexes[0]).toBe(0);
		expect(indexes[1]).toBe(10);
	});
});