Skip to content

Commit e36941c

Browse files
committed
fix(app): Show "valid" if schema validation has returned no issues but ran
1 parent 22f7118 commit e36941c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/openneuro-app/src/scripts/dataset/components/ValidationBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const ValidationBlock: React.FC<ValidationBlockProps> = ({
5050
)
5151
} else {
5252
// If data exists, populate this. Otherwise we show pending.
53-
if (validation?.warnings + validation?.errors > 0) {
53+
if (validation) {
5454
return (
5555
<div className="validation-accordion">
5656
<Validation

packages/openneuro-app/src/scripts/dataset/components/__tests__/ValidationBlock.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,14 @@ describe("ValidationBlock component", () => {
4444
render(<ValidationBlock datasetId="ds000031" />)
4545
expect(screen.getByText("Validation Pending")).toBeInTheDocument()
4646
})
47+
it("renders validation if `validation` is present but errors and warnings are zero", () => {
48+
render(
49+
<ValidationBlock
50+
datasetId="ds000031"
51+
validation={{ errors: 0, warnings: 0, issues: [], codeMessages: [] }}
52+
/>,
53+
)
54+
expect(screen.getByText("Valid")).toBeInTheDocument()
55+
expect(screen.queryByText("Validation Pending")).not.toBeInTheDocument()
56+
})
4757
})

0 commit comments

Comments
 (0)