Closed
Bug 1118648
Opened 11 years ago
Closed 7 years ago
MockHelper: `delete` the original property before overwriting it with mock and remove IndexedDB mock workaround
Categories
(Firefox OS Graveyard :: Gaia, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: timdream, Unassigned)
References
Details
(Whiteboard: [good first bug][mentor-lang=zh][lang=js])
Attachments
(1 file)
See bug 1115275 for discussion and especially bug 1115275 comment 1 for the solution.
The lines to modify is here:
https://github.com/mozilla-b2g/gaia/blob/987c76c002a716a6787bc0576f0dd0f25fae25e4/shared/test/unit/mocks/mocks_helper.js#L56-L57
The workaround to remove is here:
https://github.com/mozilla-b2g/gaia/blob/d55d1d5f39bd338ab2d298823aab1121e3d73fef/apps/keyboard/test/unit/mock_indexeddb.js#L210-L215
We would need to update the files that use MockIndexedDB too.
Comment 1•11 years ago
|
||
Hi, I would like to work on this issue. Seems to be not complicated. Could you (Tim) give me more info about what is needed to solve this bug?
Flags: needinfo?(timdream)
| Reporter | ||
Comment 2•11 years ago
|
||
Hi Giovanny!
To take this bug first you would need to learn how to build Gaia and run Gaia unit tests, see
https://github.com/mozilla-b2g/gaia#unit-tests
To complete the changes suggested in comment 0 you need to understand how MockHelper works and make it work with MockIndexedDB. |grep| the code and find the call sites in the tests can help you on that greatly.
One thing to note is that in the PromiseStorage tests I create one MockIndexedDB instance per test -- your change that makes the code call MockHelper must do that as well.
Thanks!
Assignee: nobody → gioyik
Status: NEW → ASSIGNED
Flags: needinfo?(timdream)
Comment 3•10 years ago
|
||
Hi Tim,
I deleted the workaround in "apps/keyboard/test/unit/mock_indexeddb.js". But I have some questions about point 2. On "shared/test/unit/mocks/mocks_helper.js" you point some lines but I am not sure what or how I should change them.
Added to that I should replace MockIndexedDB with MockHelper in only keyboard app? Because I am seeing some cases in communications and verticalhome apps.
Flags: needinfo?(timdream)
Comment 4•10 years ago
|
||
| Reporter | ||
Comment 5•10 years ago
|
||
(In reply to Giovanny Gongora [:gioyik] from comment #3)
> Hi Tim,
>
> I deleted the workaround in "apps/keyboard/test/unit/mock_indexeddb.js". But
> I have some questions about point 2. On
> "shared/test/unit/mocks/mocks_helper.js" you point some lines but I am not
> sure what or how I should change them.
>
> Added to that I should replace MockIndexedDB with MockHelper in only
> keyboard app? Because I am seeing some cases in communications and
> verticalhome apps.
Yes, I understand it's a bit confusing because we write tests in our own ways in Gaia tree.
So there are two mocked IndexedDB APIs, and both of them comes with utility function to replace the real functions instead of the real API, and in bug 1115275 we learned we could use the delete operator to dis-attach it.
The todos in this bug is to
1) remove the helper functions in both mocks.
2) fixes the tests that uses these mocks,
2.1) since the keyboard test does not use MockHelper, adding the delete operator in the suiteSetup and replace the API as usual would do.
2.2) for other tests that uses MockHelper, we would need to add delete operator in the replacing helper function so it could successfully replace |window.indexedDB| with mock.
Flags: needinfo?(timdream)
| Reporter | ||
Updated•9 years ago
|
Mentor: timdream
Updated•9 years ago
|
Assignee: gioyik → nobody
Status: ASSIGNED → NEW
Comment 6•7 years ago
|
||
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•