Skip to content

Commit 076be88

Browse files
committed
Add test to verify mount() correctly handles files (addresses #503)
This test confirms that the mount() method properly creates a file node (not a directory) when mounting a file. The issue described in #503 appears to have been resolved in PR #2338 when file mounting support was added to NODEFS. The test explicitly checks: - That the mount point doesn't exist before mounting - That after mounting a file, isFile() returns true - That after mounting a file, isDir() returns false This ensures the behavior described in issue #503 is working correctly.
1 parent 69947bd commit 076be88

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/php-wasm/node/src/test/mount.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,21 @@ describe('Mounting', () => {
138138
}
139139
});
140140

141+
it('Should create a file node, not a directory, when mounting a file', async () => {
142+
// This test addresses issue #503
143+
// Ensure the mount point doesn't exist yet
144+
expect(php.fileExists(fileMountPoint)).toBe(false);
145+
146+
await php.mount(
147+
fileMountPoint,
148+
createNodeFsMountHandler(filePath)
149+
);
150+
151+
// The mount point should be a file, not a directory
152+
expect(php.isFile(fileMountPoint)).toBe(true);
153+
expect(php.isDir(fileMountPoint)).toBe(false);
154+
});
155+
141156
it('Should unmount mounted file and remove created node from VFS', async () => {
142157
const unmount = await php.mount(
143158
fileMountPoint,

0 commit comments

Comments
 (0)