Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Feb 22, 2021
1 parent c4fb6c3 commit d262efa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/components/AppBar/tests/UserMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Button, MenuItem } from "@material-ui/core";
import React from "react";
import renderer, { ReactTestRenderer } from "react-test-renderer";

import { Path } from "browserHistory";
import UserMenu, { getIsAdmin, UserMenuList } from "components/AppBar/UserMenu";
import { User } from "types/user";

Expand All @@ -13,8 +14,9 @@ jest.mock("backend", () => {

jest.mock("backend/localStorage", () => {
return {
getUserId: () => mockGetUserId(),
getAvatar: jest.fn(),
getCurrentUser: jest.fn(),
getUserId: () => mockGetUserId(),
};
});

Expand All @@ -39,7 +41,7 @@ beforeEach(() => {
describe("UserMenu", () => {
it("renders without crashing", () => {
renderer.act(() => {
testRenderer = renderer.create(<UserMenu />);
testRenderer = renderer.create(<UserMenu currentTab={Path.Root} />);
});
expect(testRenderer.root.findAllByType(Button).length).toEqual(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Array [
style={
Object {
"background": "inherit",
"width": "min-content",
}
}
tabIndex={0}
Expand Down Expand Up @@ -51,6 +52,7 @@ Array [
style={
Object {
"background": "#1976d2",
"width": "min-content",
}
}
tabIndex={0}
Expand Down Expand Up @@ -93,7 +95,16 @@ exports[`NavigationButtons has only one tab shaded 2`] = `
<span
className="MuiButton-label"
>
Project
<svg
aria-hidden={true}
className="MuiSvgIcon-root"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"
/>
</svg>
</span>
<span
className="MuiTouchRipple-root"
Expand Down Expand Up @@ -129,7 +140,19 @@ exports[`ProjectNameButton has tab shaded when itself is called 1`] = `
<span
className="MuiButton-label"
>
Project
<svg
aria-hidden={true}
className="MuiSvgIcon-root"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"
/>
</svg>
</span>
<span
className="MuiTouchRipple-root"
/>
</button>
`;

0 comments on commit d262efa

Please sign in to comment.