test(service-worker): properly reset mock server state for each test (#30977)
PR Close #30977
This commit is contained in:
parent
7217525da4
commit
c150354464
|
@ -119,15 +119,20 @@ import {SwTestHarness, SwTestHarnessBuilder} from '../testing/scope';
|
||||||
let scope: SwTestHarness;
|
let scope: SwTestHarness;
|
||||||
let driver: Driver;
|
let driver: Driver;
|
||||||
beforeEach(async() => {
|
beforeEach(async() => {
|
||||||
server.clearRequests();
|
|
||||||
scope = new SwTestHarnessBuilder().withServerState(server).build();
|
scope = new SwTestHarnessBuilder().withServerState(server).build();
|
||||||
driver = new Driver(scope, scope, new CacheDatabase(scope, scope));
|
driver = new Driver(scope, scope, new CacheDatabase(scope, scope));
|
||||||
|
|
||||||
// Initialize.
|
// Initialize.
|
||||||
expect(await makeRequest(scope, '/foo.txt')).toEqual('this is foo');
|
expect(await makeRequest(scope, '/foo.txt')).toEqual('this is foo');
|
||||||
await driver.initialized;
|
await driver.initialized;
|
||||||
|
server.clearRequests();
|
||||||
|
serverUpdate.clearRequests();
|
||||||
|
serverSeqUpdate.clearRequests();
|
||||||
|
});
|
||||||
|
afterEach(() => {
|
||||||
server.reset();
|
server.reset();
|
||||||
serverUpdate.reset();
|
serverUpdate.reset();
|
||||||
|
serverSeqUpdate.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('in performance mode', () => {
|
describe('in performance mode', () => {
|
||||||
|
|
Loading…
Reference in New Issue