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)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: timdream, Unassigned)

References

Details

(Whiteboard: [good first bug][mentor-lang=zh][lang=js])

Attachments

(1 file)

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)
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)
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)
(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)
Mentor: timdream
Assignee: gioyik → nobody
Status: ASSIGNED → NEW
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.

Attachment

General

Created:
Updated:
Size: