From c150354464639408145444958ab1e32da2967b88 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Mon, 24 Jun 2019 15:04:10 +0300 Subject: [PATCH] test(service-worker): properly reset mock server state for each test (#30977) PR Close #30977 --- packages/service-worker/worker/test/data_spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/service-worker/worker/test/data_spec.ts b/packages/service-worker/worker/test/data_spec.ts index 8591582119..f7258efde6 100644 --- a/packages/service-worker/worker/test/data_spec.ts +++ b/packages/service-worker/worker/test/data_spec.ts @@ -119,15 +119,20 @@ import {SwTestHarness, SwTestHarnessBuilder} from '../testing/scope'; let scope: SwTestHarness; let driver: Driver; beforeEach(async() => { - server.clearRequests(); scope = new SwTestHarnessBuilder().withServerState(server).build(); driver = new Driver(scope, scope, new CacheDatabase(scope, scope)); // Initialize. expect(await makeRequest(scope, '/foo.txt')).toEqual('this is foo'); await driver.initialized; + server.clearRequests(); + serverUpdate.clearRequests(); + serverSeqUpdate.clearRequests(); + }); + afterEach(() => { server.reset(); serverUpdate.reset(); + serverSeqUpdate.reset(); }); describe('in performance mode', () => {