From f1497245fb0376df4fee49317e7b87e5b45d7e44 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 21 Sep 2021 13:06:51 +0300 Subject: [PATCH] test(service-worker): use correct assertion in tests (#43518) Previously, a ServiceWorker test was using the `MockServerState#sawRequestFor()` method. This method, however, only returns a boolean indicating whether a request had been seen, but would not throw an error in either case. Since the intention was to assert that a specific request was made, this commit switches to the correct `MockServerState#assertSawRequestFor()` method. PR Close #43518 --- packages/service-worker/worker/test/happy_spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/service-worker/worker/test/happy_spec.ts b/packages/service-worker/worker/test/happy_spec.ts index ae4fc72884f..2d318e872e9 100644 --- a/packages/service-worker/worker/test/happy_spec.ts +++ b/packages/service-worker/worker/test/happy_spec.ts @@ -2045,12 +2045,12 @@ describe('Driver', () => { // `client1`). expect(await makeRequest(scope, '/bar.txt', 'client1')).toBe('this is bar (broken)'); expect(driver.state).toBe(DriverReadyState.EXISTING_CLIENTS_ONLY); - brokenLazyServer.sawRequestFor('/bar.txt'); + brokenLazyServer.assertSawRequestFor('/bar.txt'); brokenLazyServer.clearRequests(); - // `client1` should not be served from the network. + // `client1` should now be served from the network. expect(await makeRequest(scope, '/foo.txt', 'client1')).toBe('this is foo (broken)'); - brokenLazyServer.sawRequestFor('/foo.txt'); + brokenLazyServer.assertSawRequestFor('/foo.txt'); // `client2` should still be served from the old version (since it never updated). expect(await makeRequest(scope, '/foo.txt', 'client2')).toBe('this is foo');