Skip to content

Commit 6f7b06e

Browse files
committed
fix(test): file.spec.131 moveTo may fail due to read order assumption
1 parent 953e653 commit 6f7b06e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/tests.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1941,8 +1941,12 @@ exports.defineAutoTests = function () {
19411941
directoryReader.readEntries(function successRead (entries) {
19421942
expect(entries.length).toBe(2);
19431943
if (!isChrome) {
1944-
expect(entries[0].name).toBe(srcDirNestedFirst);
1945-
expect(entries[1].name).toBe(srcDirNestedSecond);
1944+
// Directory read order is undefined on some platforms, therefore we cannot assume order
1945+
// So we will start with an expected list and iterate over the entries and test to see if they
1946+
// are in our expectation list. When found we will remove them. At the end, our expectation list
1947+
// should be empty.
1948+
const expected = [srcDirNestedFirst, srcDirNestedSecond];
1949+
expect(entries.map((entry) => entry.name)).toEqual(jasmine.arrayWithExactContents(expected));
19461950
}
19471951
deleteEntry(dstDir, done);
19481952
}, failed.bind(null, done, 'Error getting entries from: ' + transferredDirectory));

0 commit comments

Comments
 (0)