Converted "vector" branch unit tests to mocha, expect.js and sinon

This commit is contained in:
Tobias Bieniek
2013-03-13 04:48:08 +01:00
parent 8273d880d5
commit d5d8afc858
23 changed files with 421 additions and 354 deletions

View File

@@ -6,13 +6,13 @@ describe('ol.geom.LinearRing', function() {
it('creates a ring from an array', function() {
var ring = new ol.geom.LinearRing([[10, 20], [30, 40]]);
expect(ring).toBeA(ol.geom.LinearRing);
expect(ring).to.be.a(ol.geom.LinearRing);
});
it('throws when given mismatched dimension', function() {
expect(function() {
var ring = new ol.geom.LinearRing([[10, 20], [30, 40, 50]]);
}).toThrow();
}).to.throwException();
});
});
@@ -21,12 +21,12 @@ describe('ol.geom.LinearRing', function() {
it('can be 2', function() {
var ring = new ol.geom.LinearRing([[10, 20], [30, 40]]);
expect(ring.dimension).toBe(2);
expect(ring.dimension).to.be(2);
});
it('can be 3', function() {
var ring = new ol.geom.LinearRing([[10, 20, 30], [40, 50, 60]]);
expect(ring.dimension).toBe(3);
expect(ring.dimension).to.be(3);
});
});
@@ -35,7 +35,7 @@ describe('ol.geom.LinearRing', function() {
it('is an array', function() {
var ring = new ol.geom.LinearRing([[10, 20], [30, 40]]);
expect(ring.getCoordinates()).toEqual([[10, 20], [30, 40]]);
expect(ring.getCoordinates()).to.eql([[10, 20], [30, 40]]);
});
});