Add tests for the service worker's restoreTabs
Maintainers usually reply within 1 day
@Vamsi-2581 is already working on this.
Since Nov 1, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 70/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- testing
Research direction
Start with restoreTabs in background/service_worker.js (lines 322-348) and the RESTORE_TABS handler near line 137, then read loadServiceWorkerFunction in tests/storage.test.js (lines 183-203) to see how the sandbox chrome object is built. Extend that loader to accept extra tabs and windows stubs, record calls, and assert on openedIds, failedIds and the window each tab lands in, covering mixed safe/unsafe URLs, newWindow, a rejected create, and empty input. Done when those cases pass under npm test without changing service_worker.js.
Written by the indexing model from the issue text.
Description
Problem
restoreTabs decides which tabs the dashboard deletes after a restore: only openedIds are removed. It has no unit test, so a change that marks failed tabs as opened would delete tabs that never reopened.
Where to look
background/service_worker.js:322-348,restoreTabs:- Unsafe URLs and
nullentries go tofailedIds. Anulltab pushesundefined(line 332). - The
newWindowoption overrides therestoreInNewWindowsetting. - Only the first tab creates a window.
- A rejected
chrome.tabs.createdoesn't stop the loop.
- Unsafe URLs and
background/service_worker.js:137-138: theRESTORE_TABSmessage handler.tests/storage.test.js:183-203,loadServiceWorkerFunction: its sandboxchromehas nowindows.createortabs.createyet.
Suggested approach
- Let
loadServiceWorkerFunctionaccept extrachromestubs, for exampleloadServiceWorkerFunction(name, { tabs: {...}, windows: {...} }). - Record calls in the stubs and assert on
openedIds,failedIdsand which window each tab opened in. - Cover: mixed safe and unsafe URLs;
newWindow: trueopening one window and adding the rest to it; onecreatethat rejects; an empty or non-array input.
Done when
- The cases above are covered without changing
service_worker.js. npm testpasses.
New to Pinfold? See CONTRIBUTING.md for setup and tests. Please comment here to claim this issue before you start, and wait to be assigned, so two people don't do the same work. Good first issues are meant for newcomers, so please take one at a time.
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 2
- Avg merge
- 9h 33m
- Merged PRs (30d)
- 29
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Tektrix/pinfold
-
good first issue tests
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Add a "Copy links" action to each tab groupPossibly taken @Vishnu-vkn claimed this today. Openenhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Tektrix/pinfold#43 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
Add tests for untested PinfoldStorage write methodsPossibly taken @dharamdan01 claimed this 11 days ago. Opengood first issue tests
Tektrix/pinfold#29 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
eliasstravik/herdr-projects#1032 ·
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
1️⃣ phase/under-investigation flaky/confirmed flaky/needs-decision type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
growilabs/growi#12246 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
TMHSDigital/Free-Game-Dev-Assets#301 ·
Maintainers usually reply within 1 day