Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 899bf2f

Browse files
committed
$firebase: test covarage for config.object/arrayFactory being non-function injectables
1 parent 4253b1e commit 899bf2f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

tests/unit/firebase.spec.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('$firebase', function () {
1717
$get: function() {
1818
return function() {};
1919
}
20-
});
20+
}).value('NonFunctionFactory','NonFunctionValue');
2121
inject(function (_$firebase_, _$timeout_, _$rootScope_, $firebaseUtils) {
2222
$firebase = _$firebase_;
2323
$timeout = _$timeout_;
@@ -65,14 +65,28 @@ describe('$firebase', function () {
6565
it('should throw an error if factory name for arrayFactory does not exist', function() {
6666
var ref = new Firebase('Mock://');
6767
expect(function() {
68-
$firebase(ref, {arrayFactory: 'notarealarrayfactorymethod'})
68+
$firebase(ref, {arrayFactory: 'notarealarrayfactorymethod'}); //injectable by that name doesn't exist.
69+
}).toThrowError();
70+
});
71+
72+
it('should throw an error if factory name for arrayFactory exists, but is not a function', function() {
73+
var ref = new Firebase('Mock://');
74+
expect(function() {
75+
$firebase(ref, {arrayFactory: 'NonFunctionFactory'}); //injectable exists, but is not a function.
6976
}).toThrowError();
7077
});
7178

7279
it('should throw an error if factory name for objectFactory does not exist', function() {
7380
var ref = new Firebase('Mock://');
7481
expect(function() {
75-
$firebase(ref, {objectFactory: 'notarealobjectfactorymethod'})
82+
$firebase(ref, {objectFactory: 'notarealobjectfactorymethod'}); //injectable by that name doesn't exist.
83+
}).toThrowError();
84+
});
85+
86+
it('should throw an error if factory name for objectFactory exists, but is not a function', function() {
87+
var ref = new Firebase('Mock://');
88+
expect(function() {
89+
$firebase(ref, {objectFactory: 'NonFunctionFactory'}); //injectable exists, but is not a function.
7690
}).toThrowError();
7791
});
7892
});

0 commit comments

Comments
 (0)