Skip to content
Closed
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
@@ -0,0 +1,54 @@
import React from "react";
import { screen } from "@testing-library/react";
import { renderWithRedux } from "../../../../../../../utils/test-utils";
import ImportUsersPopup from "../import-users-popup";

jest.mock("i18n-react/dist/i18n-react", () => ({
__esModule: true,
default: { translate: (key) => key }
}));

jest.mock(
"openstack-uicore-foundation/lib/components/mui/summits-dropdown",
() => ({
__esModule: true,
default: ({ onChange, excludeSummitIds }) => (
<button
data-testid="summit-select"
type="button"
onClick={() => onChange(2)}
>
{`Select Summit (excluding: ${excludeSummitIds})`}
</button>
)
})
);

const mockCurrentSummit = { id: 1, name: "Current Summit" };

const baseState = {
currentSummitState: { currentSummit: mockCurrentSummit },
sponsorUsersListState: { userGroups: [] }
};

const renderPopup = (props = {}) =>
renderWithRedux(
<ImportUsersPopup
sponsorId={42}
companyId={99}
onClose={jest.fn()}
{...props}
/>,
{ initialState: baseState }
);

describe("ImportUsersPopup (per-sponsor)", () => {
it("mounts and shows the summit selector without throwing", () => {
renderPopup();

expect(
screen.getByText("sponsor_users.import_users.title")
).toBeInTheDocument();
expect(screen.getByTestId("summit-select")).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ const SponsorGlobalImportUsersPopup = ({
setUserOptions(null);
setSelectedUsers([]);
}}
summits={[]}
excludeSummitIds={[summitId]}
/>
{selectedSummit && (
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9044,7 +9044,7 @@ open@^10.0.3:

openstack-uicore-foundation@5.0.47:
version "5.0.47"
resolved "https://registry.npmjs.org/openstack-uicore-foundation/-/openstack-uicore-foundation-5.0.47.tgz#32500fb4d8392cbf5713e968afa875cea42a67a2"
resolved "https://registry.yarnpkg.com/openstack-uicore-foundation/-/openstack-uicore-foundation-5.0.47.tgz#32500fb4d8392cbf5713e968afa875cea42a67a2"
integrity sha512-E/6uO7Q5MtTfhWExshuNIrwVcxDewDvA76YmGzQz2f5LeZ8Gsv22eqBNbylDakwxuPmyD16r/AQEURr5soALAw==
dependencies:
use-sync-external-store "^1.6.0"
Expand Down
Loading