11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst path = require('path'); 41cb0ef41Sopenharmony_ciconst fs = require('fs'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir'); 71cb0ef41Sopenharmony_citmpdir.refresh(); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci{ 101cb0ef41Sopenharmony_ci const file = path.join(tmpdir.path, 'write-end-test0.txt'); 111cb0ef41Sopenharmony_ci const stream = fs.createWriteStream(file, { 121cb0ef41Sopenharmony_ci fs: { 131cb0ef41Sopenharmony_ci open: common.mustCall(fs.open), 141cb0ef41Sopenharmony_ci write: common.mustCallAtLeast(fs.write, 1), 151cb0ef41Sopenharmony_ci close: common.mustCall(fs.close), 161cb0ef41Sopenharmony_ci } 171cb0ef41Sopenharmony_ci }); 181cb0ef41Sopenharmony_ci stream.end('asd'); 191cb0ef41Sopenharmony_ci stream.on('close', common.mustCall()); 201cb0ef41Sopenharmony_ci} 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci{ 241cb0ef41Sopenharmony_ci const file = path.join(tmpdir.path, 'write-end-test1.txt'); 251cb0ef41Sopenharmony_ci const stream = fs.createWriteStream(file, { 261cb0ef41Sopenharmony_ci fs: { 271cb0ef41Sopenharmony_ci open: common.mustCall(fs.open), 281cb0ef41Sopenharmony_ci write: fs.write, 291cb0ef41Sopenharmony_ci writev: common.mustCallAtLeast(fs.writev, 1), 301cb0ef41Sopenharmony_ci close: common.mustCall(fs.close), 311cb0ef41Sopenharmony_ci } 321cb0ef41Sopenharmony_ci }); 331cb0ef41Sopenharmony_ci stream.write('asd'); 341cb0ef41Sopenharmony_ci stream.write('asd'); 351cb0ef41Sopenharmony_ci stream.write('asd'); 361cb0ef41Sopenharmony_ci stream.end(); 371cb0ef41Sopenharmony_ci stream.on('close', common.mustCall()); 381cb0ef41Sopenharmony_ci} 39