From 85a000422dda47530b1894d5ed9b3fb3581e065f Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 16 Aug 2026 17:35:24 +0000 Subject: [PATCH] test: exercise migrated workflow offline --- tests/test_service_worker.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/test_service_worker.py b/tests/test_service_worker.py index 62d2117..ce86b46 100644 --- a/tests/test_service_worker.py +++ b/tests/test_service_worker.py @@ -40,7 +40,7 @@ const cache = {{ state.puts.push(key); state.migrated.push(key); state.activationOrder.push('put:' + key); - storedResponses.set(key, response.clone()); + storedResponses.set(new URL(key, 'https://forge.example').href, response.clone()); }}, }}; const oldCache = {{ @@ -1080,20 +1080,27 @@ def test_offline_activation_migrates_cached_optional_feature_before_deleting_old state.failedAdds = [asset]; context.self.__testOptionalFeatures.push(asset); await dispatch('activate'); - process.stdout.write(JSON.stringify(state)); + state.failFetch = true; + const response = await dispatch('fetch', { + method: 'GET', mode: 'cors', + url: 'https://forge.example/dashboard/feature-issue-capture-test.js', + }); + process.stdout.write(JSON.stringify({ body: await response.text(), state })); """ ) - assert result["migrated"] == [ + assert result["body"] == "previous cached feature" + state = result["state"] + assert state["migrated"] == [ "/dashboard/feature-issue-capture-test.js" ] - assert result["individuallyAdded"] == [] - assert "/dashboard/feature-issue-capture-test.js" not in result["addAttempts"] - assert result["activationOrder"] == [ + assert state["individuallyAdded"] == [] + assert "/dashboard/feature-issue-capture-test.js" not in state["addAttempts"] + assert state["activationOrder"] == [ "put:/dashboard/feature-issue-capture-test.js", "delete:stackchain-dashboard-old", ] - assert result["claimed"] is True + assert state["claimed"] is True def test_activate_warms_optional_features_without_blocking_siblings_or_claim():