test(service-worker): improve adding clients in SwTestHarness
(#23625)
This commits changes how clients are added in `SwTestHarness`, so that the behavior in tests closer mimics what would happen in an actual ServiceWorker. It also removes auto-adding clients when calling `clients.get()`, which could hide bugs related to non-existing clients. PR Close #23625
This commit is contained in:

committed by
Alex Rickabaugh

parent
65dba9d0a8
commit
b004be5169
@ -470,7 +470,6 @@ const manifestUpdateHash = sha1(JSON.stringify(manifestUpdate));
|
||||
async_it('shows notifications for push notifications', async() => {
|
||||
expect(await makeRequest(scope, '/foo.txt')).toEqual('this is foo');
|
||||
await driver.initialized;
|
||||
scope.clients.add('default');
|
||||
await scope.handlePush({
|
||||
notification: {
|
||||
title: 'This is a test',
|
||||
@ -726,7 +725,6 @@ async function makeRequest(
|
||||
const [resPromise, done] = scope.handleFetch(new MockRequest(url, init), clientId);
|
||||
await done;
|
||||
const res = await resPromise;
|
||||
scope.clients.add(clientId);
|
||||
if (res !== undefined && res.ok) {
|
||||
return res.text();
|
||||
}
|
||||
|
Reference in New Issue
Block a user