feat: use decline instead of reject
This commit is contained in:
parent
f2166c985f
commit
e6c8b946aa
4 changed files with 8 additions and 8 deletions
|
|
@ -132,7 +132,7 @@ const App = () => {
|
||||||
Array<
|
Array<
|
||||||
PendingElicitationRequest & {
|
PendingElicitationRequest & {
|
||||||
resolve: (response: ElicitationResponse) => void;
|
resolve: (response: ElicitationResponse) => void;
|
||||||
reject: (error: Error) => void;
|
decline: (error: Error) => void;
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
>([]);
|
>([]);
|
||||||
|
|
@ -223,7 +223,7 @@ const App = () => {
|
||||||
requestedSchema: request.params.requestedSchema,
|
requestedSchema: request.params.requestedSchema,
|
||||||
},
|
},
|
||||||
resolve,
|
resolve,
|
||||||
reject: (error: Error) => {
|
decline: (error: Error) => {
|
||||||
console.error("Elicitation request rejected:", error);
|
console.error("Elicitation request rejected:", error);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,8 @@ const ElicitationRequest = ({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleReject = () => {
|
const handleDecline = () => {
|
||||||
onResolve(request.id, { action: "reject" });
|
onResolve(request.id, { action: "decline" });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
|
|
@ -158,7 +158,7 @@ const ElicitationRequest = ({
|
||||||
<Button type="button" onClick={handleAccept}>
|
<Button type="button" onClick={handleAccept}>
|
||||||
Submit
|
Submit
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="button" variant="outline" onClick={handleReject}>
|
<Button type="button" variant="outline" onClick={handleDecline}>
|
||||||
Decline
|
Decline
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="button" variant="outline" onClick={handleCancel}>
|
<Button type="button" variant="outline" onClick={handleCancel}>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export interface ElicitationRequestData {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ElicitationResponse {
|
export interface ElicitationResponse {
|
||||||
action: "accept" | "reject" | "cancel";
|
action: "accept" | "decline" | "cancel";
|
||||||
content?: Record<string, unknown>;
|
content?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,14 +138,14 @@ describe("ElicitationRequest", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should call onResolve with reject action when Decline button is clicked", async () => {
|
it("should call onResolve with decline action when Decline button is clicked", async () => {
|
||||||
renderElicitationRequest();
|
renderElicitationRequest();
|
||||||
|
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
fireEvent.click(screen.getByRole("button", { name: /decline/i }));
|
fireEvent.click(screen.getByRole("button", { name: /decline/i }));
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mockOnResolve).toHaveBeenCalledWith(1, { action: "reject" });
|
expect(mockOnResolve).toHaveBeenCalledWith(1, { action: "decline" });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should call onResolve with cancel action when Cancel button is clicked", async () => {
|
it("should call onResolve with cancel action when Cancel button is clicked", async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue