-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(server): Limit validation to 50k issues
Prevents failing to report validation for datasets with larger than 16MB BSON issues.
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
packages/openneuro-server/src/graphql/resolvers/__tests__/validation.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { validationSeveritySort } from "../validation" | ||
|
||
vi.mock("../../../config.ts") | ||
|
||
describe("validation resolvers", () => { | ||
describe("validationSeveritySort", () => { | ||
it("sorts severity error before warning", () => { | ||
const issues = [ | ||
{ severity: "warning" }, | ||
{ severity: "error" }, | ||
{ severity: "error" }, | ||
{ severity: "warning" }, | ||
{ severity: "error" }, | ||
] | ||
const sortedIssues = issues.sort(validationSeveritySort) | ||
expect(sortedIssues[0].severity).toBe("error") | ||
expect(sortedIssues[1].severity).toBe("error") | ||
expect(sortedIssues[2].severity).toBe("error") | ||
expect(sortedIssues[3].severity).toBe("warning") | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters