-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3215 from OpenNeuroOrg/no-validation-pending
fix(app): Display pending validation when schema validator is running
- Loading branch information
Showing
2 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
packages/openneuro-app/src/scripts/dataset/components/__tests__/ValidationBlock.spec.tsx
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,42 @@ | ||
import React from "react" | ||
import { render, screen } from "@testing-library/react" | ||
import { ValidationBlock } from "../ValidationBlock" | ||
import { vi } from "vitest" | ||
|
||
vi.mock("../../../config.ts") | ||
|
||
describe("ValidationBlock component", () => { | ||
it("renders legacy validation if issues prop is present", () => { | ||
const issues = [ | ||
{}, | ||
] | ||
render(<ValidationBlock datasetId="ds000031" issues={issues} />) | ||
expect(screen.getByText("BIDS Validation")).toBeInTheDocument() | ||
}) | ||
it("renders schema validation if validation prop is present", () => { | ||
const validation = { | ||
issues: [ | ||
{ | ||
code: "JSON_KEY_RECOMMENDED", | ||
location: "/dataset_description.json", | ||
rule: "rules.dataset_metadata.dataset_description", | ||
subCode: "DatasetType", | ||
}, | ||
], | ||
codeMessages: [ | ||
{ code: "JSON_KEY_RECOMMENDED", message: "message" }, | ||
], | ||
} | ||
render( | ||
<ValidationBlock | ||
datasetId="ds000031" | ||
validation={validation} | ||
/>, | ||
) | ||
expect(screen.getByText("BIDS Validation")).toBeInTheDocument() | ||
}) | ||
it("renders pending validation if neither issues nor validation props are present", () => { | ||
render(<ValidationBlock datasetId="ds000031" />) | ||
expect(screen.getByText("Validation Pending")).toBeInTheDocument() | ||
}) | ||
}) |