fix tests in CI

This commit is contained in:
Andre Staltz 2023-11-07 11:14:41 +02:00
parent 4302094926
commit 4157b4989c
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
4 changed files with 17 additions and 24 deletions

View File

@ -49,10 +49,8 @@ function delDuringCompactErr() {
}
function compactWithMaxLiveStreamErr() {
return new Error(
'Compaction cannot run if there are live streams ' +
'configured with opts.lt or opts.lte'
)
// prettier-ignore
return new Error('Compaction cannot run if there are live streams configured with opts.lt or opts.lte')
}
function appendLargerThanBlockErr() {
@ -64,11 +62,8 @@ function appendTransactionWantsArrayErr() {
}
function unexpectedTruncationErr() {
return new Error(
'truncate() is trying to *increase* the log size, ' +
'which is totally unexpected. ' +
'There may be a logic bug in async-append-only-log'
)
// prettier-ignore
return new Error('truncate() is trying to *increase* the log size, which is totally unexpected. There may be a logic bug in the log')
}
module.exports = {

View File

@ -6,7 +6,7 @@ const Obv = require('obz') // @ts-ignore
const AtomicFile = require('atomic-file-rw') // @ts-ignore
const debounce = require('lodash.debounce') // @ts-ignore
const isBufferZero = require('is-buffer-zero') // @ts-ignore
const debug = require('debug')('async-append-only-log') // @ts-ignore
const debug = require('debug')('log') // @ts-ignore
const mutexify = require('mutexify')
const {

View File

@ -5,7 +5,7 @@ const os = require('node:os')
const p = require('node:util').promisify
const rimraf = require('rimraf')
const SecretStack = require('secret-stack')
const AAOL = require('async-append-only-log')
const Log = require('../lib/log')
const push = require('push-stream')
const caps = require('ppppp-caps')
const Keypair = require('ppppp-keypair')
@ -59,7 +59,7 @@ test('del', async (t) => {
await p(peer.close)(true)
const log = AAOL(path.join(DIR, 'db.bin'), {
const log = Log(path.join(DIR, 'db.bin'), {
cacheSize: 1,
blockSize: 64 * 1024,
codec: {
@ -74,18 +74,16 @@ test('del', async (t) => {
const persistedMsgs = await new Promise((resolve, reject) => {
let persistedMsgs = []
log.stream({ offsets: true, values: true, sizes: true }).pipe(
push.drain(
function drainEach({ offset, value, size }) {
if (value) {
persistedMsgs.push(value.msg)
}
},
function drainEnd(err) {
if (err) return reject(err)
resolve(persistedMsgs)
log.scan(
function drainEach(offset, rec, size) {
if (rec) {
persistedMsgs.push(rec.msg)
}
)
},
function drainEnd(err) {
if (err) return reject(err)
resolve(persistedMsgs)
}
)
})

View File

@ -5,7 +5,7 @@ const os = require('node:os')
const p = require('node:util').promisify
const rimraf = require('rimraf')
const SecretStack = require('secret-stack')
const AAOL = require('async-append-only-log')
const Log = require('../lib/log')
const push = require('push-stream')
const caps = require('ppppp-caps')
const Keypair = require('ppppp-keypair')