()
| 14 | const fn = tmpdir.resolve('test.txt'); |
| 15 | |
| 16 | async function writeFileTest() { |
| 17 | const handle = await open(fn, 'w'); |
| 18 | |
| 19 | /* Write only five bytes, so that the position moves to five. */ |
| 20 | const buf = Buffer.from('Hello'); |
| 21 | const { bytesWritten } = await handle.write(buf, 0, 5, null); |
| 22 | assert.strictEqual(bytesWritten, 5); |
| 23 | |
| 24 | /* Write some more with writeFile(). */ |
| 25 | await handle.writeFile('World'); |
| 26 | |
| 27 | /* New content should be written at position five, instead of zero. */ |
| 28 | assert.strictEqual(readFileSync(fn).toString(), 'HelloWorld'); |
| 29 | |
| 30 | await handle.close(); |
| 31 | } |
| 32 | |
| 33 | |
| 34 | writeFileTest() |
no test coverage detected
searching dependent graphs…