Skip to content

Commit f51ce3c

Browse files
committed
Merge pull request #164 from toddbranch/watcher-spec-fixes
test(watcher): simplify, fix typos
2 parents d419e56 + 2b40631 commit f51ce3c

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

test/spec/provider/watcher.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
describe('filterWatcherProvider', function() {
44
//helpers
5-
function n(n) { return n; }
6-
var stub = { fn: function(x) { return n(x) } };
5+
var stub = { fn: function(x) { return x; } };
76

87
beforeEach(module('a8m.filter-watcher'));
98

10-
it('should have 2 main functions `isMemoized` and `memozie`', inject(function(filterWatcher) {
9+
it('should have 2 main functions `isMemoized` and `memoize`', inject(function(filterWatcher) {
1110
expect(filterWatcher.isMemoized).toEqual(jasmine.any(Function));
1211
expect(filterWatcher.memoize).toEqual(jasmine.any(Function));
1312
}));
1413

15-
it('should called the function if it\'s not cached',
14+
it('should call the function if it\'s not cached',
1615
inject(function(filterWatcher) {
1716
var spy = spyOn(stub, 'fn');
1817
(function memoizedOnly(n) {
@@ -37,12 +36,10 @@ describe('filterWatcherProvider', function() {
3736
})(o1);
3837
}));
3938

40-
it('should get the result from cache if it\'s memoize',
39+
it('should get the result from cache if it\'s memoized',
4140
inject(function(filterWatcher, $rootScope) {
4241
var scope = $rootScope.$new();
43-
var spy = spyOn(stub, 'fn').andCallFake(function() {
44-
return 1;
45-
});
42+
var spy = spyOn(stub, 'fn').andCallThrough();
4643
function memoize(n) {
4744
return filterWatcher.isMemoized('fName', n) ||
4845
filterWatcher.memoize('fName', n, scope, stub.fn(n));
@@ -57,9 +54,7 @@ describe('filterWatcherProvider', function() {
5754
it('should clear cache from scope listeners on `$destroy`',
5855
inject(function(filterWatcher, $rootScope) {
5956
var scope;
60-
var spy = spyOn(stub, 'fn').andCallFake(function() {
61-
return 1;
62-
});
57+
var spy = spyOn(stub, 'fn').andCallThrough();
6358
function memoize(n) {
6459
return filterWatcher.isMemoized('fName', n) ||
6560
filterWatcher.memoize('fName', n, scope = $rootScope.$new(), stub.fn(n));

0 commit comments

Comments
 (0)