Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fix to throw error when it should be thrown #150

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions specs/metadata/metadata/ArrayValuesSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,4 +632,23 @@ describe("metadata/ArrayValues", function () {
const actual = ArrayValues.anyDeepGreaterThan(a, b);
expect(actual).toEqual(expected);
});

//==========================================================================
// Error cases for deepMin/deepMax

it("throws error for non-numeric types in deepMin", function () {
expect(function () {
const a = [5, 2];
const b = [3, "NOT_A_NUMBER"];
ArrayValues.deepMin(a, b);
}).toThrowError();
});

it("throws error for non-numeric types in deepMax", function () {
expect(function () {
const a = [5, 2];
const b = [3, "NOT_A_NUMBER"];
ArrayValues.deepMax(a, b);
}).toThrowError();
});
});
4 changes: 2 additions & 2 deletions src/metadata/metadata/ArrayValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class ArrayValues {
// Implementation note:
// The methods here are supposed to be called in a context
// where no (compile-time) type information is available.
// Thes are offered to operate on "any" types, but usually
// These are offered to operate on "any" types, but usually
// delegate to "...Internal" methods with more specific
// type signatures. This does not imply any compile-time
// checks, but these specific signatures might be exposed
Expand All @@ -63,7 +63,7 @@ export class ArrayValues {
if (typeof value === "bigint") {
return true;
}
return true;
return false;
}

/**
Expand Down
Loading