autobase-test-helpers
Advanced tools
Comparing version
21
index.js
@@ -28,4 +28,8 @@ const b4a = require('b4a') | ||
return new Promise((resolve) => { | ||
for (const base of bases) base.on('update', check) | ||
return new Promise((resolve, reject) => { | ||
for (const base of bases) { | ||
base.on('update', check) | ||
base.on('error', shutdown) | ||
} | ||
check() | ||
@@ -39,5 +43,14 @@ | ||
if (!synced(bases)) return | ||
for (const base of bases) base.off('update', check) | ||
resolve() | ||
shutdown() | ||
} | ||
function shutdown (err) { | ||
for (const base of bases) { | ||
base.off('update', check) | ||
base.off('error', shutdown) | ||
} | ||
if (err) reject(err) | ||
else resolve() | ||
} | ||
}) | ||
@@ -44,0 +57,0 @@ } |
{ | ||
"name": "autobase-test-helpers", | ||
"version": "2.0.4", | ||
"version": "2.1.0", | ||
"description": "Helpers when writing tests for an Autobased application", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
14958
1.33%92
12.2%1
Infinity%