Skip to content

Commit b5992fb

Browse files
committed
test: add test that moveDirectory moves contents correctly
Assisted-by: Claude Opus 4.6
1 parent 950ae32 commit b5992fb

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/test-move-directory.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ describe('moveDirectory', function () {
2121
clearInterval(timer)
2222
})
2323

24+
it('moves contents to dest with matching structure', async function () {
25+
tmpDir = await fsp.mkdtemp(path.join(os.tmpdir(), 'node-gyp-move-test-'))
26+
const srcDir = path.join(tmpDir, 'src')
27+
const destDir = path.join(tmpDir, 'dest')
28+
await fsp.mkdir(path.join(srcDir, 'subdir'), { recursive: true })
29+
await fsp.writeFile(path.join(srcDir, 'a.txt'), 'hello')
30+
await fsp.writeFile(path.join(srcDir, 'subdir', 'b.txt'), 'world')
31+
32+
await moveDirectory(srcDir, destDir)
33+
34+
const destA = await fsp.readFile(path.join(destDir, 'a.txt'), 'utf8')
35+
assert.strictEqual(destA, 'hello')
36+
const destB = await fsp.readFile(path.join(destDir, 'subdir', 'b.txt'), 'utf8')
37+
assert.strictEqual(destB, 'world')
38+
})
39+
2440
it('large file appears atomically (no partial writes visible)', async function () {
2541
if (!FULL_TEST) {
2642
return this.skip('Skipping due to test environment configuration')

0 commit comments

Comments
 (0)