Shuffle assertions

This commit is contained in:
Tim Schaub
2016-08-09 00:05:25 -06:00
parent c40e1bc29b
commit d02cf1e7a9
39 changed files with 154 additions and 143 deletions

View File

@@ -0,0 +1,26 @@
goog.provide('ol.AssertionError.test');
goog.require('ol');
goog.require('ol.AssertionError');
describe('ol.AssertionError', function() {
it('generates a message', function() {
var error = new ol.AssertionError(42);
expect(error.message).to.be('Assertion failed. See /doc/errors/#42 for details.');
});
it('generates a message with a versioned url', function() {
var origVersion = ol.VERSION;
ol.VERSION = 'foo';
var error = new ol.AssertionError(42);
expect(error.message).to.be('Assertion failed. See http://openlayers.org/en/foo/doc/errors/#42 for details.');
ol.VERSION = origVersion;
});
it('has an error code', function() {
var error = new ol.AssertionError(42);
expect(error.code).to.be(42);
});
it('has a name', function() {
var error = new ol.AssertionError(42);
expect(error.name).to.be('AssertionError');
});
});

View File

@@ -0,0 +1,16 @@
goog.provide('ol.asserts.asserts.test');
goog.require('ol.asserts');
describe('ol.asserts', function() {
describe('ol.asserts.assert', function() {
it('throws an exception', function() {
expect(function() {
ol.asserts.assert(false, 42);
}).to.throwException();
});
});
});

View File

@@ -1,38 +0,0 @@
goog.provide('ol.test');
goog.require('ol');
describe('ol', function() {
describe('ol.assert', function() {
it('throws an exception', function() {
expect(function() {
ol.assert(false, 42);
}).to.throwException();
});
});
describe('ol.AssertionError', function() {
it('generates a message', function() {
var error = new ol.AssertionError(42);
expect(error.message).to.be('Assertion failed. See /doc/errors/#42 for details.');
});
it('generates a message with a versioned url', function() {
var origVersion = ol.VERSION;
ol.VERSION = 'foo';
var error = new ol.AssertionError(42);
expect(error.message).to.be('Assertion failed. See http://openlayers.org/en/foo/doc/errors/#42 for details.');
ol.VERSION = origVersion;
});
it('has an error code', function() {
var error = new ol.AssertionError(42);
expect(error.code).to.be(42);
});
it('has a name', function() {
var error = new ol.AssertionError(42);
expect(error.name).to.be('AssertionError');
});
});
});

View File

@@ -1,5 +1,6 @@
goog.provide('ol.test.View');
goog.require('ol');
goog.require('ol.View');
goog.require('ol.extent');
goog.require('ol.geom.LineString');