From 43aaf07a9673e378fba2aabb01b5d4c53b08713b Mon Sep 17 00:00:00 2001 From: na-trium-144 <100704180+na-trium-144@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:06:24 +0900 Subject: [PATCH 1/2] add support for size property at lengthOf --- types/chai/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 9f5cb99cdc30c0..4c11cc9ec24be7 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -1210,7 +1210,11 @@ declare namespace Chai { * @param length Potential expected length of object. * @param message Message to display on error. */ - lengthOf(object: T, length: number, message?: string): void; + lengthOf( + object: T, + length: number, + message?: string, + ): void; /** * Asserts that fn will throw an error. From 3f3b729d675692dae60c4eb6b723a022b32bf757 Mon Sep 17 00:00:00 2001 From: na-trium-144 <100704180+na-trium-144@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:27:24 +0900 Subject: [PATCH 2/2] add test for length of map and set --- types/chai/chai-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/chai/chai-tests.ts b/types/chai/chai-tests.ts index cc264d598330d9..0b549cd9f0becc 100644 --- a/types/chai/chai-tests.ts +++ b/types/chai/chai-tests.ts @@ -1809,6 +1809,8 @@ suite("assert", () => { assert.lengthOf("foobar", 6); assert.lengthOf("foobar", 5); assert.lengthOf({ length: 1 }, 5); + assert.lengthOf(new Set([1, 2, 3]), 3); + assert.lengthOf(new Map([['a', 1], ['b', 2], ['c', 3]]), 3); }); test("match", () => {