()
| 17 | tmpdir.refresh(); |
| 18 | |
| 19 | async function validateWrite() { |
| 20 | const filePathForHandle = path.resolve(tmpDir, 'tmp-write.txt'); |
| 21 | const fileHandle = await open(filePathForHandle, 'w'); |
| 22 | const buffer = Buffer.from('Hello world'.repeat(100), 'utf8'); |
| 23 | |
| 24 | const stream = fileHandle.createWriteStream(); |
| 25 | stream.end(buffer); |
| 26 | await finished(stream); |
| 27 | |
| 28 | const readFileData = fs.readFileSync(filePathForHandle); |
| 29 | assert.deepStrictEqual(buffer, readFileData); |
| 30 | } |
| 31 | |
| 32 | async function validateRead() { |
| 33 | const filePathForHandle = path.resolve(tmpDir, 'tmp-read.txt'); |
no test coverage detected