New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

autobase-test-helpers

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autobase-test-helpers - npm Package Compare versions

Comparing version

to
3.0.0

31

index.js

@@ -29,2 +29,5 @@ const b4a = require('b4a')

return new Promise((resolve, reject) => {
let done = false
let checks = 0
for (const base of bases) {

@@ -38,11 +41,25 @@ base.on('update', check)

async function check () {
if (!synced(bases)) return
checks++
if (!(await same())) return mbShutdown()
for (const base of bases) {
await base.update()
}
if (!synced(bases)) return
if (!(await same())) return mbShutdown()
shutdown()
}
function mbShutdown () {
if (done) return shutdown()
checks--
}
async function same () {
return synced(bases) && await sameHash(bases)
}
function shutdown (err) {
checks--
done = true
if (checks !== 0 && !err) return
for (const base of bases) {

@@ -59,2 +76,12 @@ base.off('update', check)

async function sameHash (bases) {
const first = bases[0]
const h1 = await first.hash()
for (let i = 1; i < bases.length; i++) {
const h2 = await bases[i].hash()
if (!b4a.equals(h1, h2)) return false
}
return true
}
function synced (bases) {

@@ -61,0 +88,0 @@ const first = bases[0]

2

package.json
{
"name": "autobase-test-helpers",
"version": "2.1.3",
"version": "3.0.0",
"description": "Helpers when writing tests for an Autobased application",

@@ -5,0 +5,0 @@ "main": "index.js",