Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests pass (but with console errors and warnings) #357

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export const AddRequestedPackage = ({
<StyledIconButton
onClick={() => onCancel(false)}
data-testid="cancelIcon"
theme={theme}
>
<DeleteIconAlt />
</StyledIconButton>
Expand Down
6 changes: 4 additions & 2 deletions test/components/BlockContainerEditMode.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("<BlockContainerEditMode />", () => {
</BlockContainerEditMode>
)
);
expect(container).toHaveTextContent("Switch to YAML Editor");
expect(container).toHaveTextContent("YAML");
});

it("should call onToggleEditMode when the user switches the view", () => {
Expand All @@ -32,7 +32,9 @@ describe("<BlockContainerEditMode />", () => {
</BlockContainerEditMode>
)
);
const switchButton = component.getByLabelText("Switch to Standard View");
const switchButton = component.getByLabelText("YAML", {
exact: false
});
fireEvent.click(switchButton);
expect(onToggleEditorView).toHaveBeenCalled();
});
Expand Down
10 changes: 6 additions & 4 deletions test/environmentCreate/SpecificationCreate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("<SpecificationCreate />", () => {
});

it("should switch the view to the yaml editor", () => {
const switchButton = component.getByLabelText("Switch to YAML Editor");
const switchButton = component.getByLabelText("YAML", { exact: false });
gabalafou marked this conversation as resolved.
Show resolved Hide resolved
fireEvent.click(switchButton);

const vatSelectInput = component.container.querySelector(
Expand All @@ -45,7 +45,7 @@ describe("<SpecificationCreate />", () => {

expect(mockOnCreateEnvironment).toHaveBeenCalled();

const switchButton = component.getByLabelText("Switch to YAML Editor");
const switchButton = component.getByLabelText("YAML", { exact: false });
fireEvent.click(switchButton);

fireEvent.click(createButton);
Expand All @@ -56,7 +56,7 @@ describe("<SpecificationCreate />", () => {
});

it("should update channels and dependencies", async () => {
const switchButton = component.getByLabelText("Switch to YAML Editor");
const switchButton = component.getByLabelText("YAML", { exact: false });
fireEvent.click(switchButton);

const code = stringify({
Expand All @@ -69,7 +69,9 @@ describe("<SpecificationCreate />", () => {
});

await waitFor(() => {
expect(screen.getByText("conda-channel")).not.toBeNull();
expect(
screen.getByText("conda-channel", { exact: false })
).not.toBeNull();
});

const emptyCode = stringify({
Expand Down
12 changes: 6 additions & 6 deletions test/environmentDetails/SpecificationEdit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,15 @@ describe("<SpecificationEdit />", () => {
</Provider>
)
);
const switchButton = component.getByLabelText("Switch to YAML Editor");
const switchButton = component.getByLabelText("YAML", { exact: false });
fireEvent.click(switchButton);

act(() => {
store.dispatch(updatePackages(["numpy"]));
store.dispatch(updateChannels(["conda-store"]));
});

expect(
component.queryByText("Switch to Standard View")
).toBeInTheDocument();
expect(component.queryByText("YAML", { exact: false })).toBeInTheDocument();
});

it("should cancel environment edition", () => {
Expand Down Expand Up @@ -93,7 +91,7 @@ describe("<SpecificationEdit />", () => {
</Provider>
)
);
const switchButton = component.getByLabelText("Switch to YAML Editor");
const switchButton = component.getByLabelText("YAML", { exact: false });
fireEvent.click(switchButton);

const code = stringify({
Expand All @@ -106,7 +104,9 @@ describe("<SpecificationEdit />", () => {
});

await waitFor(() => {
expect(screen.getByText("conda-channel")).not.toBeNull();
expect(
screen.getByText("conda-channel", { exact: false })
).not.toBeNull();
});

const emptyCode = stringify({
Expand Down
2 changes: 1 addition & 1 deletion test/environments/EnvironmentList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe("<EnvironmentsList />", () => {
)
);

expect(component.container).toHaveTextContent("Shared environments");
expect(component.container).toHaveTextContent("Shared Environments");
expect(component.container).toHaveTextContent("default");
});
});
4 changes: 2 additions & 2 deletions test/testutils.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ThemeProvider } from "@mui/material";
import React from "react";
import { CondaSpecification } from "../src/common/models";
import { theme } from "../src/theme";
import { condaStoreTheme } from "../src/theme";

export const NAMESPACES = [
{
Expand Down Expand Up @@ -90,5 +90,5 @@ export const BUILD = {
};

export const mockTheme = (children: any) => {
return <ThemeProvider theme={theme}>{children}</ThemeProvider>;
return <ThemeProvider theme={condaStoreTheme}>{children}</ThemeProvider>;
};
Loading