Shaheer Sarfaraz b94f85b149
Reduce low risk duplication (#79)
* clean up helpers

* shared in it's own top level folder

* workspaces setup

* build fix

* disable workspaces?

* run ci

* rename job-flow to gradcracker

* optional dependencies

* formatting?

* more optional modules

* allow post install runs

* node bump

* remove post install

* add optionals

* add more

* formatting

* comments, but im unsure

* run typescript DIRECTLY

* better build

* camoufox simplification

* lint

* build process doesn't exist

* build fix

* lockfile

* type check everything, build only for client

* rename steps correctly

* import from package!

* fix formatting

* don't fetch twice

* fix concern
2026-02-02 21:30:14 +00:00

52 lines
1.6 KiB
TypeScript

import type { UpdateSettingsInput } from "@shared/settings-schema.js";
import { render, screen } from "@testing-library/react";
import { FormProvider, useForm } from "react-hook-form";
import { Accordion } from "@/components/ui/accordion";
import { WebhooksSection } from "./WebhooksSection";
const WebhooksHarness = () => {
const methods = useForm<UpdateSettingsInput>({
defaultValues: {
pipelineWebhookUrl: "https://pipeline.com",
jobCompleteWebhookUrl: "https://job.com",
webhookSecret: "",
},
});
return (
<FormProvider {...methods}>
<Accordion type="multiple" defaultValue={["webhooks"]}>
<WebhooksSection
pipelineWebhook={{
default: "https://default-p.com",
effective: "https://pipeline.com",
}}
jobCompleteWebhook={{
default: "https://default-j.com",
effective: "https://job.com",
}}
webhookSecretHint="sec-"
isLoading={false}
isSaving={false}
/>
</Accordion>
</FormProvider>
);
};
describe("WebhooksSection", () => {
it("renders both webhook sections and the secret", () => {
render(<WebhooksHarness />);
expect(screen.getByText("Pipeline Status")).toBeInTheDocument();
expect(screen.getByText("Job Completion")).toBeInTheDocument();
expect(
screen.getByDisplayValue("https://pipeline.com"),
).toBeInTheDocument();
expect(screen.getByDisplayValue("https://job.com")).toBeInTheDocument();
expect(screen.getByText("sec-********")).toBeInTheDocument();
});
});