Skip to content

Commit

Permalink
fix max/min
Browse files Browse the repository at this point in the history
  • Loading branch information
uriva committed Nov 8, 2023
1 parent 32220b3 commit 79262d7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/reduce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Deno.test("reduce", () => {
});

Deno.test("min", () => {
assertEquals(min((x) => x)([4, 1, 2, 3]), 1);
assertEquals(min((x: number) => x)([4, 1, 2, 3]), 1);
});

Deno.test("reduce async", async () => {
Expand All @@ -25,7 +25,7 @@ Deno.test("reduce async", async () => {
});

Deno.test("min", () => {
assertEquals(min((x) => x)([4, 1, 2, 3]), 1);
assertEquals(min((x: number) => x)([4, 1, 2, 3]), 1);
});

Deno.test("max async", async () => {
Expand All @@ -42,8 +42,20 @@ Deno.test("max call stack is not a limit on array size", () => {
for (let i = 0; i < size; i++) {
bigArray.push(i);
}
assertEquals(max((x) => x)(bigArray), size - 1);
assertEquals(max((x: number) => x)(bigArray), size - 1);
});

const _1: number = min((x: number) => x)([1, 2, 3, 4]);
const _2: number = min((x: number) => x)([1, 2, 3, 4]);
const _2: number = max((x: number) => x)([1, 2, 3, 4]);
const _3: Promise<number> = min((x: number) => Promise.resolve(x))([
1,
2,
3,
4,
]);
const _4: Promise<number> = max((x: number) => Promise.resolve(x))([
1,
2,
3,
4,
]);

0 comments on commit 79262d7

Please sign in to comment.