mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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
This commit is contained in:
committed by
Alex Rickabaugh
parent
67ff93d33a
commit
f1497245fb
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user