Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
cleobnvntra committed Nov 18, 2024
1 parent 8e80d7b commit aeeaca2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions __tests__/components/buttons/FileAttachmentbutton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jest.mock("../../../src/context/BotRefsContext", () => ({
useBotRefsContext: jest.fn(() => ({
botIdRef: { current: "testBotId" },
flowRef: { current: { currentPath: { file: jest.fn() } } },
// ...other mocked values
})),
}));

Expand All @@ -41,7 +40,7 @@ jest.mock("../../../src/context/BotRefsContext", () => ({
const renderFileAttachmentButton = (blockAllowsAttachment: boolean, showMediaDisplay: boolean) => {
const initialSettings = {
fileAttachment: {
sendFileName: true, // Ensure this is truthy
sendFileName: true,
multiple: true,
accept: ".jpg,.png",
showMediaDisplay: showMediaDisplay,
Expand Down Expand Up @@ -151,10 +150,9 @@ describe("FileAttachmentButton Component", () => {
});

it("does not proceed when getCurrPath returns null", () => {
// Mock getCurrPath to return null
(usePathsInternal as jest.Mock).mockReturnValueOnce({
blockAllowsAttachment: true,
getCurrPath: jest.fn().mockReturnValue(null), // Simulate null return value
getCurrPath: jest.fn().mockReturnValue(null),
getPrevPath: jest.fn(),
goToPath: jest.fn(),
});
Expand All @@ -166,7 +164,6 @@ describe("FileAttachmentButton Component", () => {

fireEvent.change(input, { target: { files: [file] } });

// Expect no calls to mockHandleSubmitText or mockInjectMessage
expect(mockHandleSubmitText).not.toHaveBeenCalled();
expect(mockInjectMessage).not.toHaveBeenCalled();
});
Expand Down

0 comments on commit aeeaca2

Please sign in to comment.