aboutsummaryrefslogtreecommitdiffstats
path: root/tools/nwc-sw-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/nwc-sw-test.js')
-rw-r--r--tools/nwc-sw-test.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/nwc-sw-test.js b/tools/nwc-sw-test.js
index 7e85ee1..18528a2 100644
--- a/tools/nwc-sw-test.js
+++ b/tools/nwc-sw-test.js
@@ -58,7 +58,10 @@ function harness({ rec = baseRec(), recs = null, answered = false } = {}) {
return { ok: true, json: async () => ({ ok: true, scheduled: true }) };
}
if (url.includes('/claim')) {
- return { ok: true, json: async () => ({ ok: true }) };
+ // as the notifier does: a request already replied to can't be claimed
+ const was = typeof answered === 'function' ? answered() : answered;
+ if (JSON.parse(opts.body).release) return { ok: true, json: async () => ({ ok: true, released: true }) };
+ return { ok: true, json: async () => (was ? { ok: false, answered: true } : { ok: true }) };
}
if (url.includes('/answered')) {
return { ok: true, json: async () => ({ answered: typeof answered === 'function' ? answered() : answered }) };