Files
klz-cables.com/.pnpm-store/v10/files/41/3e8fce4a345b12168c5db2ee28470121564c7bc47169b2133af56e00d3b4f934417b36a29e760c01d2a040933215e4db4a24f1da487ae8447dd123512a7d26
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 { test } = require('tap')
const { join } = require('path')
const { readFile } = require('fs')
const { file } = require('./helper')
const ThreadStream = require('..')
test('destroy support', function (t) {
t.plan(7)
const dest = file()
const stream = new ThreadStream({
filename: join(__dirname, 'to-file-on-destroy.js'),
workerData: { dest },
sync: true
})
stream.on('close', () => {
t.notOk(stream.writable)
t.pass('close emitted')
})
t.ok(stream.write('hello world\n'))
t.ok(stream.write('something else\n'))
t.ok(stream.writable)
stream.end()
readFile(dest, 'utf8', (err, data) => {
t.error(err)
t.equal(data, 'hello world\nsomething else\n')
})
})
test('synchronous _final support', function (t) {
t.plan(7)
const dest = file()
const stream = new ThreadStream({
filename: join(__dirname, 'to-file-on-final.js'),
workerData: { dest },
sync: true
})
stream.on('close', () => {
t.notOk(stream.writable)
t.pass('close emitted')
})
t.ok(stream.write('hello world\n'))
t.ok(stream.write('something else\n'))
t.ok(stream.writable)
stream.end()
readFile(dest, 'utf8', (err, data) => {
t.error(err)
t.equal(data, 'hello world\nsomething else\n')
})
})