11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_cirequire('../common'); 41cb0ef41Sopenharmony_ciconst fs = require('node:fs'); 51cb0ef41Sopenharmony_ciconst path = require('node:path'); 61cb0ef41Sopenharmony_ciconst assert = require('node:assert'); 71cb0ef41Sopenharmony_ciconst { describe, it } = require('node:test'); 81cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_citmpdir.refresh(); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cidescribe('File operations with filenames containing surrogate pairs', () => { 131cb0ef41Sopenharmony_ci it('should write, read, and delete a file with surrogate pairs in the filename', () => { 141cb0ef41Sopenharmony_ci // Create a temporary directory 151cb0ef41Sopenharmony_ci const tempdir = fs.mkdtempSync(tmpdir.resolve('emoji-fruit- ')); 161cb0ef41Sopenharmony_ci assert.strictEqual(fs.existsSync(tempdir), true); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci const filename = '.txt'; 191cb0ef41Sopenharmony_ci const content = 'Test content'; 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci // Write content to a file 221cb0ef41Sopenharmony_ci fs.writeFileSync(path.join(tempdir, filename), content); 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci // Read content from the file 251cb0ef41Sopenharmony_ci const readContent = fs.readFileSync(path.join(tempdir, filename), 'utf8'); 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ci // Check if the content matches 281cb0ef41Sopenharmony_ci assert.strictEqual(readContent, content); 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci }); 311cb0ef41Sopenharmony_ci}); 32