Closed
Bug 1056842
Opened 11 years ago
Closed 11 years ago
shared MockPromise
Categories
(Firefox OS Graveyard :: Gaia, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
2.1 S3 (29aug)
People
(Reporter: timdream, Assigned: timdream)
References
Details
Attachments
(1 file)
While working on bug 1029951 I spent days trying to test this code step by step:
this._startDownload()
.then(function(data) {
this.state = this.STATE_LOADING;
this._updateUI();
return data;
}.bind(this))
.then(this._insertIntoDatabase.bind(this))
.then(function() {
this.state = this.STATE_LOADED;
this._updateUI();
}.bind(this))
.catch(function(e) {
this.state = this.STATE_DOWNLOADABLE;
this._updateUI();
e && console.error(e);
}.bind(this));
I ended up mock the Promise interface with a fairly non-trival, but fortunately reusable code, so I figured I should just moved it to shared/js/.
Assignee | ||
Comment 2•11 years ago
|
||
Comment on attachment 8476698 [details] [review]
mozilla-b2g:master PR#23154
Sam, would you mind reviewing this? This is a MockPromise interface I ended up creating and I hope this is useful enough to be put into shared.
I was meant to ask both you and Julien for feedback, but he is on PTO.
Attachment #8476698 -
Flags: review?(sfoster)
Comment 3•11 years ago
|
||
Comment on attachment 8476698 [details] [review]
mozilla-b2g:master PR#23154
This looks good to me, I ran the tests and poked around. I can see it being useful when wanting to test a particular part of a promise chain, or to ensure errors reach error handlers at the end of a promise chain perhaps.
Attachment #8476698 -
Flags: review?(sfoster) → review+
Assignee | ||
Comment 4•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•