Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Workbox#update() test logic #2213

Closed
philipwalton opened this issue Sep 2, 2019 · 0 comments · Fixed by #2214
Closed

Incorrect Workbox#update() test logic #2213

philipwalton opened this issue Sep 2, 2019 · 0 comments · Fixed by #2214
Assignees

Comments

@philipwalton
Copy link
Member

Library Affected:
workbox-window

While making some updates to the Workbox tests, I noticed that the test added in #2136 for update() do not actually test the update behavior (I missed this in the PR review):

it(`updates service worker and resolves with the new registration`, async function() {
const controllerBeforeTest = navigator.serviceWorker.controller;
const scriptURL = controllerBeforeTest.scriptURL;
const wb = new Workbox(scriptURL);
const reg = await wb.register();
const newReg = await wb.update();
expect(reg).not.to.equal(newReg);
});

There should only ever be one registration instance per scope, so this test shouldn't be asserting calling update() returns a new object. It's only passing here because update() is returning Promise<void> rather than a registration.

@philipwalton philipwalton self-assigned this Sep 2, 2019
@philipwalton philipwalton changed the title Incorrrect Workbox#update() test logic Incorrect Workbox#update() test logic Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant