Files
klz-cables.com/.pnpm-store/v10/files/9d/d6e394feadfafee9ab668cc1c53205da41b0c80fb0394a85f6a66ad1ab27a8b9f238b5deaad48b1806dd14a6a75c019c3313ef602ca26b7d29cacf0645ec2b
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

75 lines
1.6 KiB
Plaintext

import { test } from 'tap'
import { readFile } from 'fs'
import ThreadStream from '../index.js'
import { join } from 'desm'
import { file } from './helper.js'
test('break up utf8 multibyte (sync)', (t) => {
t.plan(2)
const longString = '\u03A3'.repeat(16)
const dest = file()
const stream = new ThreadStream({
bufferSize: 15, // this must be odd
filename: join(import.meta.url, 'to-file.js'),
workerData: { dest },
sync: true
})
stream.on('finish', () => {
readFile(dest, 'utf8', (err, data) => {
t.error(err)
t.equal(data, longString)
})
})
stream.write(longString)
stream.end()
})
test('break up utf8 multibyte (async)', (t) => {
t.plan(2)
const longString = '\u03A3'.repeat(16)
const dest = file()
const stream = new ThreadStream({
bufferSize: 15, // this must be odd
filename: join(import.meta.url, 'to-file.js'),
workerData: { dest },
sync: false
})
stream.on('finish', () => {
readFile(dest, 'utf8', (err, data) => {
t.error(err)
t.equal(data, longString)
})
})
stream.write(longString)
stream.end()
})
test('break up utf8 multibyte several times bigger than write buffer', (t) => {
t.plan(2)
const longString = '\u03A3'.repeat(32)
const dest = file()
const stream = new ThreadStream({
bufferSize: 15, // this must be odd
filename: join(import.meta.url, 'to-file.js'),
workerData: { dest },
sync: false
})
stream.on('finish', () => {
readFile(dest, 'utf8', (err, data) => {
t.error(err)
t.equal(data, longString)
})
})
stream.write(longString)
stream.end()
})