aboutsummaryrefslogtreecommitdiff
path: root/engine/js/tests/ElggLibTest.js
diff options
context:
space:
mode:
Diffstat (limited to 'engine/js/tests/ElggLibTest.js')
-rw-r--r--engine/js/tests/ElggLibTest.js39
1 files changed, 30 insertions, 9 deletions
diff --git a/engine/js/tests/ElggLibTest.js b/engine/js/tests/ElggLibTest.js
index 920296408..ed4db24e1 100644
--- a/engine/js/tests/ElggLibTest.js
+++ b/engine/js/tests/ElggLibTest.js
@@ -7,6 +7,35 @@ ElggLibTest.prototype.testGlobal = function() {
assertTrue(window === elgg.global);
};
+ElggLibTest.prototype.testAssertTypeOf = function() {
+ var noexceptions = [
+ ['string', ''],
+ ['object', {}],
+ ['boolean', true],
+ ['boolean', false],
+ ['undefined', undefined],
+ ['number', 0],
+ ['function', function() {}],
+ ];
+
+ for (var i in noexceptions) {
+ assertNoException(function() {
+ elgg.assertTypeOf.apply(elgg, noexceptions[i]);
+ });
+ }
+
+ var exceptions = [
+ ['function', {}],
+ ['object', function() {}],
+ ];
+
+ for (var i in exceptions) {
+ assertException(function() {
+ elgg.assertTypeOf.apply(elgg, exceptions[i]);
+ });
+ }
+};
+
ElggLibTest.prototype.testProvide = function() {
elgg.provide('foo.bar.baz');
@@ -39,7 +68,6 @@ ElggLibTest.prototype.testInherit = function() {
elgg.inherit(Child, Base);
-
assertInstanceOf(Base, new Child());
assertEquals(Child, Child.prototype.constructor);
};
@@ -53,11 +81,4 @@ ElggLibTest.prototype.testExtendUrl = function() {
url = 'pg/test';
assertEquals('http://www.elgg.org/pg/test', elgg.extendUrl(url));
-};
-
-
-
-
-
-
-
+}; \ No newline at end of file