Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import { render, waitFor } from "@testing-library/react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("@sentry/react-router", () => {
|
||||
const sentryOnError = vi.fn();
|
||||
return {
|
||||
__esModule: true,
|
||||
sentryOnError,
|
||||
};
|
||||
});
|
||||
|
||||
import * as Sentry from "@sentry/react-router";
|
||||
|
||||
import { RouteTracingProvider, sentryHydrationErrorHandler } from "./routeTracing";
|
||||
|
||||
const mockedOnError = Sentry.sentryOnError as unknown as ReturnType<typeof vi.fn>;
|
||||
|
||||
describe("sentryHydrationErrorHandler", () => {
|
||||
it("delegates to Sentry.sentryOnError", async () => {
|
||||
const err = new Error("hydration-boom");
|
||||
const info = { errorInfo: { componentStack: "test-stack" } as React.ErrorInfo };
|
||||
sentryHydrationErrorHandler(err, info);
|
||||
await waitFor(() => expect(mockedOnError).toHaveBeenCalledWith(err, info));
|
||||
});
|
||||
|
||||
it("swallows exceptions thrown by the SDK", () => {
|
||||
mockedOnError.mockImplementationOnce(() => {
|
||||
throw new Error("sdk-down");
|
||||
});
|
||||
expect(() => sentryHydrationErrorHandler(new Error("boom"), {})).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("RouteTracingProvider", () => {
|
||||
it("renders its children unchanged", () => {
|
||||
const { getByText } = render(
|
||||
<RouteTracingProvider>
|
||||
<span>route-tracing-content</span>
|
||||
</RouteTracingProvider>
|
||||
);
|
||||
expect(getByText("route-tracing-content")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user