generated from rdilweb/template-docusaurus-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
244 additions
and
180 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
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
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
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
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
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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import React from "react"; | ||
import { expect, test, describe, jest } from "@jest/globals"; | ||
import { render, act } from "@testing-library/react"; | ||
import JSONSchemaViewer from "../../src/theme/JSONSchemaViewer/index"; | ||
import React from "react" | ||
import { expect, test, describe, jest } from "@jest/globals" | ||
import { render, act } from "@testing-library/react" | ||
import JSONSchemaViewer from "../../src/theme/JSONSchemaViewer/index" | ||
|
||
import type { RenderResult } from "@testing-library/react"; | ||
import type { JSONSchema } from "../../src/theme/JSONSchemaViewer/types"; | ||
import type { RenderResult } from "@testing-library/react" | ||
import type { JSONSchema } from "../../src/theme/JSONSchemaViewer/types" | ||
|
||
jest.mock("@stoplight/json-ref-resolver", () => { | ||
const resolve = jest.fn(() => Promise.reject(new Error("Resolver error"))); | ||
const resolve = jest.fn(() => Promise.reject(new Error("Resolver error"))) | ||
return { | ||
Resolver: jest.fn(() => ({ resolve })), | ||
}; | ||
}); | ||
} | ||
}) | ||
|
||
describe("JSONSchemaViewer states", () => { | ||
test("Can render error when something bad happens", async () => { | ||
const fakeSchema: JSONSchema = { type: "object" } | ||
let result: RenderResult | null = null; | ||
let result: RenderResult | null = null | ||
|
||
// Render the component within act | ||
await act(async () => { | ||
result = render(<JSONSchemaViewer schema={fakeSchema} />); | ||
}); | ||
result = render(<JSONSchemaViewer schema={fakeSchema} />) | ||
}) | ||
|
||
// Capture the snapshot | ||
expect(result!.asFragment()).toMatchSnapshot(); | ||
}); | ||
}); | ||
expect(result!.asFragment()).toMatchSnapshot() | ||
}) | ||
}) |
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
Oops, something went wrong.