From 57f4d8cefb52bddbdd30d2cdfa0276d922e00f34 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Mon, 25 Jan 2016 10:57:50 +0100 Subject: [PATCH] Add tests for ol.array.equals --- test/spec/ol/array.test.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/spec/ol/array.test.js b/test/spec/ol/array.test.js index 409b297865..d9a457565d 100644 --- a/test/spec/ol/array.test.js +++ b/test/spec/ol/array.test.js @@ -318,6 +318,42 @@ describe('ol.array', function() { }); }); + describe('equals', function() { + it('returns true for [] == []', function() { + expect(ol.array.equals([], [])).to.be(true); + }); + it('returns true for [1] == [1]', function() { + expect(ol.array.equals([1], [1])).to.be(true); + }); + it('returns true for [\'1\'] == [\'1\']', function() { + expect(ol.array.equals(['1'], ['1'])).to.be(true); + }); + it('returns false for [1] == [\'1\']', function() { + expect(ol.array.equals([1], ['1'])).to.be(false); + }); + it('returns true for [null] == [null]', function() { + expect(ol.array.equals([null], [null])).to.be(true); + }); + it('returns false for [null] == [undefined]', function() { + expect(ol.array.equals([null], [undefined])).to.be(false); + }); + it('returns true for [1, 2] == [1, 2]', function() { + expect(ol.array.equals([1, 2], [1, 2])).to.be(true); + }); + it('returns false for [1, 2] == [2, 1]', function() { + expect(ol.array.equals([1, 2], [2, 1])).to.be(false); + }); + it('returns false for [1, 2] == [1]', function() { + expect(ol.array.equals([1, 2], [1])).to.be(false); + }); + it('returns false for [1] == [1, 2]', function() { + expect(ol.array.equals([1], [1, 2])).to.be(false); + }); + it('returns false for [{}] == [{}]', function() { + expect(ol.array.equals([{}], [{}])).to.be(false); + }); + }); + describe('linearFindNearest', function() { it('returns expected value', function() { var arr = [1000, 500, 100];