()
| 7 | const { access, copyFile, open } = require('fs').promises; |
| 8 | |
| 9 | async function validate() { |
| 10 | tmpdir.refresh(); |
| 11 | const dest = tmpdir.resolve('baz.js'); |
| 12 | await assert.rejects( |
| 13 | copyFile(fixtures.path('baz.js'), dest, 'r'), |
| 14 | { |
| 15 | code: 'ERR_INVALID_ARG_TYPE', |
| 16 | } |
| 17 | ); |
| 18 | await copyFile(fixtures.path('baz.js'), dest); |
| 19 | await assert.rejects( |
| 20 | access(dest, 'r'), |
| 21 | { code: 'ERR_INVALID_ARG_TYPE', message: /mode/ } |
| 22 | ); |
| 23 | await access(dest); |
| 24 | const handle = await open(dest, 'r+'); |
| 25 | await handle.datasync(); |
| 26 | await handle.sync(); |
| 27 | const buf = Buffer.from('hello world'); |
| 28 | await handle.write(buf); |
| 29 | const ret = await handle.read(Buffer.alloc(11), 0, 11, 0); |
| 30 | assert.strictEqual(ret.bytesRead, 11); |
| 31 | assert.deepStrictEqual(ret.buffer, buf); |
| 32 | await handle.close(); |
| 33 | } |
| 34 | |
| 35 | validate(); |
no test coverage detected
searching dependent graphs…