Skip to content

Commit

Permalink
Update docstrings and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
afshin committed Aug 21, 2022
1 parent 52c8f5f commit 4a96ee3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/algorithm/src/iter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @deprecated
*
* @param object - The iterable or array-like object of interest.
* @param object - The iterable object of interest.
*
* @returns A new array of values from the given object.
*
Expand All @@ -33,7 +33,7 @@ export function toArray<T>(object: Iterable<T>): T[] {
/**
* Create an object from an iterable of key/value pairs.
*
* @param object - The iterable or array-like object of interest.
* @param object - The iterable object of interest.
*
* @returns A new object mapping keys to values.
*
Expand Down
5 changes: 3 additions & 2 deletions packages/algorithm/tests/src/iter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import { each, every, some, toArray, toObject, zip } from '@lumino/algorithm';
* expected results of that iterator.
*/
export function testIterator<T>(
factory: () => [IterableIterator<T>, T[]]
factory: () => [IterableIterator<T>, T[]],
name = ''
): void {
describe('yield', () => {
describe(`yield ${name}`, () => {
it('should return the same values in the iterator', () => {
let [it, results] = factory();
expect(Array.from(it)).to.deep.equal(results);
Expand Down
6 changes: 3 additions & 3 deletions packages/algorithm/tests/src/retro.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ describe('@lumino/algorithm', () => {
});

it('should call `retro` on a retroable', () => {
let iterator = [1, 2, 3, 4][Symbol.iterator]();
let retroable = { retro: () => iterator };
expect(retro(retroable)).to.equal(iterator);
let data = [1, 2, 3, 4];
let retroable = { retro: () => retro(data) };
testIterator(() => [retro(retroable), data.slice().reverse()], 'retro');
});

it('should reverse an array', () => {
Expand Down

0 comments on commit 4a96ee3

Please sign in to comment.