diff options
Diffstat (limited to 'testing/web-platform/tests/fs/script-tests/FileSystemDirectoryHandle-resolve.js')
-rw-r--r-- | testing/web-platform/tests/fs/script-tests/FileSystemDirectoryHandle-resolve.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fs/script-tests/FileSystemDirectoryHandle-resolve.js b/testing/web-platform/tests/fs/script-tests/FileSystemDirectoryHandle-resolve.js new file mode 100644 index 0000000000..a8900f97e5 --- /dev/null +++ b/testing/web-platform/tests/fs/script-tests/FileSystemDirectoryHandle-resolve.js @@ -0,0 +1,27 @@ +'use strict'; + +directory_test(async (t, root_dir) => { + assert_array_equals(await root_dir.resolve(root_dir), []); +}, 'Resolve returns empty array for same directory'); + +directory_test(async (t, root_dir) => { + const subdir = await createDirectory(t, 'subdir-name', root_dir); + const file = await createEmptyFile(t, 'file-name', subdir); + + assert_array_equals(await root_dir.resolve(file), ['subdir-name', 'file-name']); +}, 'Resolve returns correct path'); + +directory_test(async (t, root_dir) => { + const subdir = await createDirectory(t, 'subdirš', root_dir); + const file = await createEmptyFile(t, 'file-name', subdir); + + assert_array_equals(await root_dir.resolve(file), ['subdirš', 'file-name']); + assert_array_equals(await root_dir.resolve(subdir), ['subdirš']); +}, 'Resolve returns correct path with non-ascii characters'); + +directory_test(async (t, root_dir) => { + const subdir = await createDirectory(t, 'subdir-name', root_dir); + const file = await createEmptyFile(t, 'file-name', root_dir); + + assert_equals(await subdir.resolve(file), null); +}, 'Resolve returns null when entry is not a child'); |