Skip to content

Commit c4cbfbc

Browse files
Added the iterator API to the test suite
1 parent 5f23fe1 commit c4cbfbc

File tree

2 files changed

+1
-35
lines changed

2 files changed

+1
-35
lines changed

test/specs/stat.spec.js

-16
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,6 @@ describe("fs.Stats", () => {
5252
});
5353
});
5454

55-
describe("Iterator API", () => {
56-
it("should return stats instead of paths", done => {
57-
Promise.resolve()
58-
.then(async () => {
59-
let data = [];
60-
61-
for await (let stat of readdir.iterator.stat("test/dir")) {
62-
data.push(stat);
63-
}
64-
65-
assertStats(data, dir.shallow.data, done);
66-
})
67-
.catch(done);
68-
});
69-
});
70-
7155
function assertStats (data, expected, done) {
7256
try {
7357
// Should return an array of the correct length

test/utils/for-each-api.js

+1-19
Original file line numberDiff line numberDiff line change
@@ -71,31 +71,13 @@ function forEachApi (tests) {
7171
});
7272
}
7373
});
74-
75-
describe("Iterator API", () => {
76-
for (let test of tests) {
77-
testApi(test, "iterator", async (done) => {
78-
try {
79-
let data = [];
80-
for await (let datum of readdir.iterator.apply(null, test.args)) {
81-
data.push(datum);
82-
}
83-
84-
done(null, data);
85-
}
86-
catch (error) {
87-
done(error);
88-
}
89-
});
90-
}
91-
});
9274
}
9375

9476
/**
9577
* Runs a single test against a single readdir-enhanced API.
9678
*
9779
* @param {object} test - An object containing test info, parameters, and assertions
98-
* @param {string} apiName - The name of the API being tested ("sync", "async", "stream", or "iterator")
80+
* @param {string} apiName - The name of the API being tested ("sync", "async", or "stream")
9981
* @param {function} api - A function that calls the readdir-enhanced API and returns its results
10082
*/
10183
function testApi (test, apiName, api) {

0 commit comments

Comments
 (0)