GUI -- Sketching out GlyphService.
- Added areFunctions() to FnService.
- First unit test for GlyphService.
- Added note about debugging unit tests.
Change-Id: I377b6a1cf1845fb57e506e1a935970b49dbf0bbb
diff --git a/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js b/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js
index 4b99942..d5c6fb2 100644
--- a/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js
@@ -158,4 +158,34 @@
expect(fs.contains(someArray, 109)).toBeFalsy();
expect(fs.contains(stringArray, 'zonko')).toBeFalsy();
});
+
+ // === Tests for areFunctions()
+ it('areFunctions(): false for non-array', function () {
+ expect(fs.areFunctions({}, 'not-an-array')).toBeFalsy();
+ });
+ it('areFunctions(): true for empty-array', function () {
+ expect(fs.areFunctions({}, [])).toBeTruthy();
+ });
+ it('areFunctions(): true for some api', function () {
+ expect(fs.areFunctions({
+ a: function () {},
+ b: function () {}
+ }, ['b', 'a'])).toBeTruthy();
+ });
+ it('areFunctions(): false for some other api', function () {
+ expect(fs.areFunctions({
+ a: function () {},
+ b: 'not-a-function'
+ }, ['b', 'a'])).toBeFalsy();
+ });
+ it('areFunctions(): extraneous stuff ignored', function () {
+ expect(fs.areFunctions({
+ a: function () {},
+ b: function () {},
+ c: 1,
+ d: 'foo'
+ }, ['a', 'b'])).toBeTruthy();
+ });
+
+
});