11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst { 51cb0ef41Sopenharmony_ci Duplex, 61cb0ef41Sopenharmony_ci} = require('stream'); 71cb0ef41Sopenharmony_ciconst { setTimeout } = require('timers/promises'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci{ 101cb0ef41Sopenharmony_ci class Foo extends Duplex { 111cb0ef41Sopenharmony_ci async _final(callback) { 121cb0ef41Sopenharmony_ci await setTimeout(common.platformTimeout(1)); 131cb0ef41Sopenharmony_ci callback(); 141cb0ef41Sopenharmony_ci } 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci _read() {} 171cb0ef41Sopenharmony_ci } 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci const foo = new Foo(); 201cb0ef41Sopenharmony_ci foo._write = common.mustCall((chunk, encoding, cb) => { 211cb0ef41Sopenharmony_ci cb(); 221cb0ef41Sopenharmony_ci }); 231cb0ef41Sopenharmony_ci foo.end('test', common.mustCall()); 241cb0ef41Sopenharmony_ci foo.on('error', common.mustNotCall()); 251cb0ef41Sopenharmony_ci} 26