@openneuro/app 4.29.0-alpha.1 → 4.29.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openneuro/app",
3
- "version": "4.29.0-alpha.1",
3
+ "version": "4.29.0-alpha.3",
4
4
  "description": "React JS web frontend for the OpenNeuro platform.",
5
5
  "license": "MIT",
6
6
  "main": "public/client.js",
@@ -20,7 +20,7 @@
20
20
  "@emotion/react": "11.11.1",
21
21
  "@emotion/styled": "11.11.0",
22
22
  "@niivue/niivue": "0.45.1",
23
- "@openneuro/components": "^4.29.0-alpha.1",
23
+ "@openneuro/components": "^4.29.0-alpha.3",
24
24
  "@sentry/react": "^8.25.0",
25
25
  "@tanstack/react-table": "^8.9.3",
26
26
  "buffer": "^6.0.3",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "6c4cb2bde08a8a0cbead95d505a7d002290fdb5b"
77
+ "gitHead": "4cb4528c5c2dbc8d04b3a4785ce964b83a7e8116"
78
78
  }
@@ -39,10 +39,10 @@ export const ValidationBlock: React.FC<ValidationBlockProps> = ({
39
39
  </div>
40
40
  )
41
41
  } else {
42
- // Reconstruct DatasetIssues from JSON
43
- const datasetIssues = new DatasetIssues()
44
42
  // If data exists, populate this. Otherwise we show pending.
45
43
  if (validation?.issues) {
44
+ // Reconstruct DatasetIssues from JSON
45
+ const datasetIssues = new DatasetIssues()
46
46
  datasetIssues.issues = validation.issues
47
47
  datasetIssues.codeMessages = validation.codeMessages.reduce(
48
48
  (acc, curr) => {
@@ -51,11 +51,17 @@ export const ValidationBlock: React.FC<ValidationBlockProps> = ({
51
51
  },
52
52
  new Map<string, string>(),
53
53
  )
54
+ return (
55
+ <div className="validation-accordion">
56
+ <Validation issues={datasetIssues} />
57
+ </div>
58
+ )
59
+ } else {
60
+ return (
61
+ <div className="validation-accordion">
62
+ <Validation issues={null} />
63
+ </div>
64
+ )
54
65
  }
55
- return (
56
- <div className="validation-accordion">
57
- <Validation issues={datasetIssues} />
58
- </div>
59
- )
60
66
  }
61
67
  }
@@ -0,0 +1,42 @@
1
+ import React from "react"
2
+ import { render, screen } from "@testing-library/react"
3
+ import { ValidationBlock } from "../ValidationBlock"
4
+ import { vi } from "vitest"
5
+
6
+ vi.mock("../../../config.ts")
7
+
8
+ describe("ValidationBlock component", () => {
9
+ it("renders legacy validation if issues prop is present", () => {
10
+ const issues = [
11
+ {},
12
+ ]
13
+ render(<ValidationBlock datasetId="ds000031" issues={issues} />)
14
+ expect(screen.getByText("BIDS Validation")).toBeInTheDocument()
15
+ })
16
+ it("renders schema validation if validation prop is present", () => {
17
+ const validation = {
18
+ issues: [
19
+ {
20
+ code: "JSON_KEY_RECOMMENDED",
21
+ location: "/dataset_description.json",
22
+ rule: "rules.dataset_metadata.dataset_description",
23
+ subCode: "DatasetType",
24
+ },
25
+ ],
26
+ codeMessages: [
27
+ { code: "JSON_KEY_RECOMMENDED", message: "message" },
28
+ ],
29
+ }
30
+ render(
31
+ <ValidationBlock
32
+ datasetId="ds000031"
33
+ validation={validation}
34
+ />,
35
+ )
36
+ expect(screen.getByText("BIDS Validation")).toBeInTheDocument()
37
+ })
38
+ it("renders pending validation if neither issues nor validation props are present", () => {
39
+ render(<ValidationBlock datasetId="ds000031" />)
40
+ expect(screen.getByText("Validation Pending")).toBeInTheDocument()
41
+ })
42
+ })