Files
klz-cables.com/.pnpm-store/v10/files/eb/ab08e6cd33e17310b6fbf88ddd0dbbb16eb1cb10c0a630a68e96a61799e76fa8b487a6e68f0e9033daeaeee53c6bd2b70459ff78959e2e1616b06494d25057
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

62 lines
1.3 KiB
Plaintext

'use strict'
const FakeTimers = require('@sinonjs/fake-timers')
const fs = require('fs')
const SonicBoom = require('../')
const { file, runTests } = require('./helper')
runTests(buildTests)
function buildTests (test, sync) {
// Reset the umask for testing
process.umask(0o000)
test('periodicflush_off', (t) => {
t.plan(4)
const clock = FakeTimers.install()
const dest = file()
const fd = fs.openSync(dest, 'w')
const stream = new SonicBoom({ fd, sync, minLength: 5000 })
t.ok(stream.write('hello world\n'))
setTimeout(function () {
fs.readFile(dest, 'utf8', function (err, data) {
t.error(err)
t.equal(data, '')
stream.destroy()
t.pass('file empty')
})
}, 2000)
clock.tick(2000)
clock.uninstall()
})
test('periodicflush_on', (t) => {
t.plan(4)
const clock = FakeTimers.install()
const dest = file()
const fd = fs.openSync(dest, 'w')
const stream = new SonicBoom({ fd, sync, minLength: 5000, periodicFlush: 1000 })
t.ok(stream.write('hello world\n'))
setTimeout(function () {
fs.readFile(dest, 'utf8', function (err, data) {
t.error(err)
t.equal(data, 'hello world\n')
stream.destroy()
t.pass('file not empty')
})
}, 2000)
clock.tick(2000)
clock.uninstall()
})
}