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

Fix main branch pre-commit issues #1433

Merged
merged 1 commit into from
Nov 28, 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
8 changes: 5 additions & 3 deletions ansible_ai_connect_admin_portal/__mocks__/monaco-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ const editor = {
create: () => {
return {
dispose: () => {},
}
};
},
defineTheme: function() {}
defineTheme: function () {},
};

const monaco = {
editor,
languages: {json: {jsonDefaults: { setDiagnosticsOptions: function () {}}}}
languages: {
json: { jsonDefaults: { setDiagnosticsOptions: function () {} } },
},
};

module.exports = monaco;
4 changes: 2 additions & 2 deletions ansible_ai_connect_admin_portal/__mocks__/monaco-yaml.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const monacoYaml = {
configureMonacoYaml: function () {}
};
configureMonacoYaml: function () {},
};

module.exports = monacoYaml;
2 changes: 1 addition & 1 deletion ansible_ai_connect_admin_portal/src/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function AppHeader(props: AppHeaderProps) {
<ToolbarItem>
<PageMastheadDropdown
id="account-menu"
icon={<UserCircleIcon/>}
icon={<UserCircleIcon />}
userName={userName}
>
<DropdownItem
Expand Down
9 changes: 7 additions & 2 deletions ansible_ai_connect_admin_portal/src/PageMastheadDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
DropdownList,
DropdownItem,
} from "@patternfly/react-core";
import React from 'react';
import React from "react";
import { ReactNode, useCallback, useState } from "react";
import { useBreakpoint } from "@ansible/ansible-ui-framework";

Expand All @@ -32,7 +32,12 @@ export function PageMastheadDropdown(props: PageMastheadDropdownProps) {
id={id}
onSelect={onSelect}
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle ref={toggleRef} onClick={onToggle} isExpanded={isOpen} data-testid="page-masthead-dropdown__button">
<MenuToggle
ref={toggleRef}
onClick={onToggle}
isExpanded={isOpen}
data-testid="page-masthead-dropdown__button"
>
<Flex
alignItems={{ default: "alignItemsCenter" }}
flexWrap={{ default: "nowrap" }}
Expand Down
4 changes: 3 additions & 1 deletion ansible_ai_connect_admin_portal/src/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ describe("App", () => {
adminDashboardUrl={"http://admin_dashboard-url/"}
/>,
);
const accountMenu = await screen.findByTestId("page-masthead-dropdown__button");
const accountMenu = await screen.findByTestId(
"page-masthead-dropdown__button",
);
expect(accountMenu).toBeInTheDocument();
expect(accountMenu).toHaveTextContent("Batman");
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render, screen } from "@testing-library/react";
import "@testing-library/jest-dom";
import { AppHeader } from "../AppHeader";
import { BrowserRouter } from 'react-router-dom';
import { BrowserRouter } from "react-router-dom";

describe("AppHeader", () => {
// Store the original 'location' object so that it can be restored for other tests.
Expand All @@ -23,9 +23,11 @@ describe("AppHeader", () => {
render(
<BrowserRouter>
<AppHeader userName={"Batman"} />
</BrowserRouter>
</BrowserRouter>,
);
const accountMenu = await screen.findByTestId(
"page-masthead-dropdown__button",
);
const accountMenu = await screen.findByTestId("page-masthead-dropdown__button");
expect(accountMenu).toBeInTheDocument();
expect(accountMenu).toHaveTextContent("Batman");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ describe("App", () => {
it("Rendering::With Username", async () => {
window.history.pushState({}, "Test page", "/console");
render(<AppDenied userName={"Batman"} hasSubscription={true} />);
const accountMenu = await screen.findByTestId("page-masthead-dropdown__button");
const accountMenu = await screen.findByTestId(
"page-masthead-dropdown__button",
);
expect(accountMenu).toBeInTheDocument();
expect(accountMenu).toHaveTextContent("Batman");
});

it("Rendering::Without Username", async () => {
window.history.pushState({}, "Test page", "/console");
render(<AppDenied hasSubscription={false} />);
const accountMenu = await screen.findByTestId("page-masthead-dropdown__button");
const accountMenu = await screen.findByTestId(
"page-masthead-dropdown__button",
);
expect(accountMenu).toBeInTheDocument();
expect(accountMenu).toHaveTextContent("UnknownUser");
});
Expand Down