All files / components/Nav GithubLogin.js

100% Statements 6/6
100% Branches 8/8
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25          28x 28x 6x   22x 2x               20x            
import { Button, Navbar } from "react-bootstrap";
import { Link } from "react-router-dom";
 
export default function GithubLogin({ currentUser, systemInfo }) {
  var githubOauthLogin =
    systemInfo?.githubOauthLogin || "/oauth2/authorization/github";
  if (!currentUser || !currentUser.loggedIn) {
    return <span data-testid="GithubLogin-logged-out" />;
  }
  if (currentUser.root.user.githubLogin) {
    return (
      <>
        <Navbar.Text className="me-3" as={Link} to="/profile">
          Github: {currentUser.root.user.githubLogin}
        </Navbar.Text>
      </>
    );
  }
  return (
    <>
      <Button href={githubOauthLogin}>Connect Github</Button>
    </>
  );
}