From da91b289f4c4486534d560d574b1c864a0cb1ed9 Mon Sep 17 00:00:00 2001 From: "Afshin T. Darian" Date: Tue, 16 Aug 2022 16:44:03 +0100 Subject: [PATCH] Better toObject() test --- packages/algorithm/tests/src/iter.spec.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/algorithm/tests/src/iter.spec.ts b/packages/algorithm/tests/src/iter.spec.ts index 861af7a03..807435ad1 100644 --- a/packages/algorithm/tests/src/iter.spec.ts +++ b/packages/algorithm/tests/src/iter.spec.ts @@ -9,7 +9,7 @@ |----------------------------------------------------------------------------*/ import { expect } from 'chai'; -import { each, every, some, toArray, toObject } from '@lumino/algorithm'; +import { each, every, some, toArray, toObject, zip } from '@lumino/algorithm'; /** * A helper function to test the methods of an iterator. @@ -40,12 +40,10 @@ describe('@lumino/algorithm', () => { describe('toObject()', () => { it('should create an object from a [key, value] iterable', () => { - let data: [string, number][] = [ - ['one', 1], - ['two', 2], - ['three', 3] - ]; - let result = toObject(data); + let keys = ['one', 'two', 'three']; + let values = [1, 2, 3]; + let stream = zip(keys, values); + let result = toObject(stream as Iterable<[string, number]>); expect(result).to.deep.equal({ one: 1, two: 2, three: 3 }); }); });