All files / pages/Student StudentCourseShowPage.jsx

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/4

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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45              4x   4x               4x 4x                                                    
import React from "react";
import { useParams } from "react-router";
import BasicLayout from "main/layouts/BasicLayout/BasicLayout";
import { useBackend } from "main/utils/useBackend";
import { Tab, Tabs } from "react-bootstrap";
 
export default function StudentCourseShowPage() {
  const courseId = useParams().id;
 
  const { data: course } = useBackend(
    [`/api/courses/${courseId}`],
    // Stryker disable next-line StringLiteral : GET and empty string are equivalent
    { method: "GET", url: `/api/courses/${courseId}` },
    null,
    true,
  );
 
  const testId = "StudentCourseShowPage";
  return (
    <BasicLayout>
      {!course ? (
        <div data-testid={`${testId}-loading`}>Course: Loading...</div>
      ) : (
        <div className="border rounded-3 p-4 mb-4">
          <div className="d-flex align-items-center gap-2">
            <h1 data-testid={`${testId}-title`} className="h3 mb-0 fw-semibold">
              {course.courseName}
            </h1>
            <span className="badge bg-primary-subtle text-primary-emphasis rounded-pill">
              {course.term}
            </span>
          </div>
        </div>
      )}
      <Tabs defaultActiveKey="placeholder">
        <Tab eventKey="placeholder" title="Placeholder" className="pt-2">
          <p data-testid={`${testId}-placeholder-text`}>
            More features coming soon
          </p>
        </Tab>
      </Tabs>
    </BasicLayout>
  );
}