Skip to content

Commit 3e0914c

Browse files
committed
🌿 Separate test steps of is
1 parent 1ccd9fc commit 3e0914c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

is_test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,21 @@ Deno.test("isOneOf<T>", async (t) => {
294294
});
295295
});
296296

297-
Deno.test("is defines aliases of functions", async () => {
297+
Deno.test("is", async (t) => {
298298
const mod = await import("./is.ts");
299-
const cases = Object.entries(mod)
299+
const casesOfAliasAndIsFunction = Object.entries(mod)
300300
.filter(([k, _]) => k.startsWith("is"))
301301
.map(([k, v]) => [k.slice(2), v] as const);
302-
for (const [alias, fn] of cases) {
303-
assertStrictEquals(is[alias as keyof typeof is], fn);
302+
for (const [alias, fn] of casesOfAliasAndIsFunction) {
303+
await t.step(`defines \`${alias}\` function`, () => {
304+
assertStrictEquals(is[alias as keyof typeof is], fn);
305+
});
304306
}
305-
assertEquals(
306-
Object.keys(is).length,
307-
cases.length,
308-
"The number of entries in `is` is not equal to `is*` functions",
307+
await t.step(
308+
"only has entries that are the same as the `is*` function aliases",
309+
() => {
310+
const aliases = casesOfAliasAndIsFunction.map(([a]) => a).toSorted();
311+
assertEquals(Object.keys(is).toSorted(), aliases);
312+
},
309313
);
310314
});

0 commit comments

Comments
 (0)