This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(*): debug failing router tests
- Loading branch information
1 parent
791aa10
commit 864e715
Showing
10 changed files
with
501 additions
and
291 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,44 @@ | ||
exports.PromiseWrapper = { | ||
// This is going to be monkey patched from inside | ||
// the routerFactory closure, because the implementation | ||
// will need access to $q | ||
var PromiseWrapper = { | ||
resolve: function (reason) { | ||
return PromiseWrapper.$q.when(reason); | ||
}, | ||
|
||
reject: function (reason) { | ||
return PromiseWrapper.$q.reject(reason); | ||
}, | ||
|
||
catchError: function (promise, fn) { | ||
return promise.then(null, fn); | ||
}, | ||
all: function (promises) { | ||
return PromiseWrapper.$q.all(promises); | ||
} | ||
}; | ||
|
||
exports.EventEmitter = function EventEmitter() { | ||
function EventEmitter() { | ||
//TODO: implement? | ||
// I think it's too heavy to ask 1.x users to bring in Rx for the router... | ||
}; | ||
} | ||
|
||
exports.ObservableWrapper = { | ||
var ObservableWrapper = { | ||
callNext: function(ob, val) { | ||
ob.fn(val); | ||
}, | ||
callEmit: function(ob, val) { | ||
ob.fn(val); | ||
}, | ||
callError: function(ob, val) { | ||
ob.errorFn && ob.errorFn(val); | ||
if (ob.errorFn) ob.errorFn(val); | ||
}, | ||
|
||
subscribe: function(ob, fn, errorFn) { | ||
ob.fn = fn; | ||
ob.errorFn = errorFn; | ||
} | ||
}; | ||
|
||
module.exports = { | ||
PromiseWrapper: PromiseWrapper, | ||
EventEmitter: EventEmitter, | ||
ObservableWrapper: ObservableWrapper | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters