Skip to content

Commit a0a1118

Browse files
committed
Fix cursor tests
1 parent 8a0b737 commit a0a1118

File tree

1 file changed

+3
-45
lines changed

1 file changed

+3
-45
lines changed

src/test/08-cursors.ts

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -134,66 +134,24 @@ describe("Cursor API", () => {
134134
await loadMore(cursor, 0);
135135
});
136136
});
137-
describe("cursor.each", () => {
137+
describe("cursor.forEach", () => {
138138
it("invokes the callback for each value", async () => {
139139
const results: any[] = [];
140-
await cursor.each((value) => {
140+
await cursor.forEach((value) => {
141141
results.push(value);
142142
});
143143
expect(results).to.eql(aqlResult);
144144
});
145145
it("aborts if the callback returns false", async () => {
146146
const results: any[] = [];
147-
await cursor.each((value: any) => {
147+
await cursor.forEach((value: any) => {
148148
results.push(value);
149149
if (value === 5) return false;
150150
return;
151151
});
152152
expect(results).to.eql([0, 1, 2, 3, 4, 5]);
153153
});
154154
});
155-
describe("cursor.every", () => {
156-
it("returns true if the callback returns a truthy value for every item", async () => {
157-
const results: any[] = [];
158-
const result = await cursor.every((value) => {
159-
if (results.indexOf(value) !== -1) return false;
160-
results.push(value);
161-
return true;
162-
});
163-
expect(results).to.eql(aqlResult);
164-
expect(result).to.equal(true);
165-
});
166-
it("returns false if the callback returns a non-truthy value for any item", async () => {
167-
const results: any[] = [];
168-
const result = await cursor.every((value) => {
169-
results.push(value);
170-
return value < 5;
171-
});
172-
expect(results).to.eql([0, 1, 2, 3, 4, 5]);
173-
expect(result).to.equal(false);
174-
});
175-
});
176-
describe("cursor.some", () => {
177-
it("returns false if the callback returns a non-truthy value for every item", async () => {
178-
const results: any[] = [];
179-
const result = await cursor.some((value) => {
180-
if (results.indexOf(value) !== -1) return true;
181-
results.push(value);
182-
return false;
183-
});
184-
expect(results).to.eql(aqlResult);
185-
expect(result).to.equal(false);
186-
});
187-
it("returns true if the callback returns a truthy value for any item", async () => {
188-
const results: any[] = [];
189-
const result = await cursor.some((value) => {
190-
results.push(value);
191-
return value >= 5;
192-
});
193-
expect(results).to.eql([0, 1, 2, 3, 4, 5]);
194-
expect(result).to.equal(true);
195-
});
196-
});
197155
describe("cursor.map", () => {
198156
it("maps all result values over the callback", async () => {
199157
const results = await cursor.map((value) => value * 2);

0 commit comments

Comments
 (0)