11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('node:assert'); 41cb0ef41Sopenharmony_ciconst fs = require('node:fs'); 51cb0ef41Sopenharmony_ciconst path = require('node:path'); 61cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst testPath = path.join(tmpdir.path, 'assert-encoding-error'); 91cb0ef41Sopenharmony_ciconst options = 'test'; 101cb0ef41Sopenharmony_ciconst expectedError = { 111cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_VALUE', 121cb0ef41Sopenharmony_ci name: 'TypeError', 131cb0ef41Sopenharmony_ci}; 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciassert.throws(() => { 161cb0ef41Sopenharmony_ci fs.readFile(testPath, options, common.mustNotCall()); 171cb0ef41Sopenharmony_ci}, expectedError); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciassert.throws(() => { 201cb0ef41Sopenharmony_ci fs.readFileSync(testPath, options); 211cb0ef41Sopenharmony_ci}, expectedError); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ciassert.throws(() => { 241cb0ef41Sopenharmony_ci fs.readdir(testPath, options, common.mustNotCall()); 251cb0ef41Sopenharmony_ci}, expectedError); 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciassert.throws(() => { 281cb0ef41Sopenharmony_ci fs.readdirSync(testPath, options); 291cb0ef41Sopenharmony_ci}, expectedError); 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ciassert.throws(() => { 321cb0ef41Sopenharmony_ci fs.readlink(testPath, options, common.mustNotCall()); 331cb0ef41Sopenharmony_ci}, expectedError); 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ciassert.throws(() => { 361cb0ef41Sopenharmony_ci fs.readlinkSync(testPath, options); 371cb0ef41Sopenharmony_ci}, expectedError); 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ciassert.throws(() => { 401cb0ef41Sopenharmony_ci fs.writeFile(testPath, 'data', options, common.mustNotCall()); 411cb0ef41Sopenharmony_ci}, expectedError); 421cb0ef41Sopenharmony_ci 431cb0ef41Sopenharmony_ciassert.throws(() => { 441cb0ef41Sopenharmony_ci fs.writeFileSync(testPath, 'data', options); 451cb0ef41Sopenharmony_ci}, expectedError); 461cb0ef41Sopenharmony_ci 471cb0ef41Sopenharmony_ciassert.throws(() => { 481cb0ef41Sopenharmony_ci fs.appendFile(testPath, 'data', options, common.mustNotCall()); 491cb0ef41Sopenharmony_ci}, expectedError); 501cb0ef41Sopenharmony_ci 511cb0ef41Sopenharmony_ciassert.throws(() => { 521cb0ef41Sopenharmony_ci fs.appendFileSync(testPath, 'data', options); 531cb0ef41Sopenharmony_ci}, expectedError); 541cb0ef41Sopenharmony_ci 551cb0ef41Sopenharmony_ciassert.throws(() => { 561cb0ef41Sopenharmony_ci fs.watch(testPath, options, common.mustNotCall()); 571cb0ef41Sopenharmony_ci}, expectedError); 581cb0ef41Sopenharmony_ci 591cb0ef41Sopenharmony_ciassert.throws(() => { 601cb0ef41Sopenharmony_ci fs.realpath(testPath, options, common.mustNotCall()); 611cb0ef41Sopenharmony_ci}, expectedError); 621cb0ef41Sopenharmony_ci 631cb0ef41Sopenharmony_ciassert.throws(() => { 641cb0ef41Sopenharmony_ci fs.realpathSync(testPath, options); 651cb0ef41Sopenharmony_ci}, expectedError); 661cb0ef41Sopenharmony_ci 671cb0ef41Sopenharmony_ciassert.throws(() => { 681cb0ef41Sopenharmony_ci fs.mkdtemp(testPath, options, common.mustNotCall()); 691cb0ef41Sopenharmony_ci}, expectedError); 701cb0ef41Sopenharmony_ci 711cb0ef41Sopenharmony_ciassert.throws(() => { 721cb0ef41Sopenharmony_ci fs.mkdtempSync(testPath, options); 731cb0ef41Sopenharmony_ci}, expectedError); 741cb0ef41Sopenharmony_ci 751cb0ef41Sopenharmony_ciassert.throws(() => { 761cb0ef41Sopenharmony_ci fs.ReadStream(testPath, options); 771cb0ef41Sopenharmony_ci}, expectedError); 781cb0ef41Sopenharmony_ci 791cb0ef41Sopenharmony_ciassert.throws(() => { 801cb0ef41Sopenharmony_ci fs.WriteStream(testPath, options); 811cb0ef41Sopenharmony_ci}, expectedError); 82