Closed Bug 1158220 Opened 10 years ago Closed 10 years ago

Add more unit tests to the router specs.

Categories

(Firefox OS Graveyard :: Gaia, defect)

defect
Not set
normal

Tracking

(b2g-master fixed)

RESOLVED FIXED
Tracking Status
b2g-master --- fixed

People

(Reporter: jlorenzo, Assigned: jlorenzo)

References

Details

Attachments

(1 file)

Bug 1155611 added a couple of them, but it seems we're not testing all the paths. I think I can help by adding some new tests.
Attached file PR (deleted) —
Still WIP
Comment on attachment 8597346 [details] PR Hey guys, Here are some new tests for the router in serviceworkerware. I currently have 2 issues with them: * passing an object with onFetch() can't be tested because we bind it so add is not called with the exact onFetch() method we passed. Do you guys have any idea on how to help to get it tested? * router.all() will match every method, including the ones which are not valid. Tell me guys what you think!
Attachment #8597346 - Flags: review?(salva)
Attachment #8597346 - Flags: review?(francisco)
Comment on attachment 8597346 [details] PR Just commented in github, will let Salva come with the r? Thanks a lot for the pr, how is your experience with the environment set?
Attachment #8597346 - Flags: review?(francisco)
Comment on attachment 8597346 [details] PR I corrected the points you raised. I discussed on IRC with Francisco about how to fix the bug about router.match("invalidMethod"), which returned all the middlewares. He agrees on throwing an error if the method is invalid in each case. I factorized this behavior into _sanitizeMethod(). I moved the 'lowercase', 'trim' and 'error' tests to that method, and I check that add() and match() call it correctly. Resetting the flag for another review.
Attachment #8597346 - Flags: review?(salva)
Comment on attachment 8597346 [details] PR master: arcturus/serviceworkerware#2c2b60a688157575f4c70843aada88667d069f3d
Attachment #8597346 - Flags: review?(salva) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: