Skip to content

Commit

Permalink
chore: clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emcelroy committed Dec 10, 2024
1 parent dcc156c commit fb72646
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
11 changes: 1 addition & 10 deletions src/components/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import { App } from "./App";
import { AppConfigContext } from "../app-config-context";
import { AppConfigModel } from "../models/app-config-model";
import { mockAppConfig } from "../test-utils/mock-app-config";
import { MockAppConfigProvider } from "../test-utils/app-config-provider";

jest.mock("../hooks/use-assistant-store", () => ({
useAssistantStore: jest.fn(() => ({
Expand All @@ -22,14 +21,6 @@ jest.mock("../models/app-config-model", () => ({
}
}));

const MockAppConfigProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const mockAppConfigValue = AppConfigModel.create(mockAppConfig);
return (
<AppConfigContext.Provider value={mockAppConfigValue}>
{children}
</AppConfigContext.Provider>
);
};

describe("test load app", () => {
it("renders without crashing", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/developer-options.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const mockTranscriptStore = ChatTranscriptModel.create({
],
});

const assistantStore = AssistantModel.create({
const mockAssistantStore = AssistantModel.create({
assistant: {},
assistantId: "asst_abc123",
instructions: "This is just a test",
Expand All @@ -44,7 +44,7 @@ describe("test developer options component", () => {
return (
<MockAppConfigProvider>
<DeveloperOptionsComponent
assistantStore={assistantStore}
assistantStore={mockAssistantStore}
onCreateThread={onCreateThread}
onDeleteThread={onDeleteThread}
onMockAssistant={onMockAssistant}
Expand Down
4 changes: 2 additions & 2 deletions src/components/keyboard-shortcut-controls.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("test keyboard shortcut controls component", () => {
expect(button).toHaveTextContent("Disable Shortcut");
});

it.skip("renders a form for customizing the keyboard shortcut", async () => {
it("renders a form for customizing the keyboard shortcut", async () => {
render(<WrapperComponent />);
const form = screen.getByTestId("custom-keyboard-shortcut-form");
const input = within(form).getByTestId("custom-keyboard-shortcut");
Expand All @@ -60,7 +60,7 @@ describe("test keyboard shortcut controls component", () => {
expect(dismissButton).toHaveTextContent("dismiss");
});

it.skip("shows an error message if the custom keyboard shortcut input is empty", () => {
it("shows an error message if the custom keyboard shortcut input is empty", () => {
render(<WrapperComponent />);
const form = screen.getByTestId("custom-keyboard-shortcut-form");
const input = within(form).getByTestId("custom-keyboard-shortcut");
Expand Down

0 comments on commit fb72646

Please sign in to comment.