All files / components/Courses StudentCoursesTable.jsx

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

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          22x               22x                                
import { useBackend, useBackendMutation } from "main/utils/useBackend";
import CoursesTable from "main/components/Courses/CoursesTable";
import React from "react";
 
export function StudentCoursesTable({ testid }) {
  const { data: courses } = useBackend(
    ["/api/courses/list/students"],
    // Stryker disable next-line StringLiteral : The default value for an empty ("") method is GET. Therefore, there is no way to kill a mutation that transforms "GET" to ""
    { method: "GET", url: "/api/courses/list/students" },
    // Stryker disable next-line all : don't test default value of empty list
    [],
  );
 
  return (
    <>
      {courses.length > 0 ? (
        <>
          <CoursesTable
            courses={courses}
            testId={testid}
            courseNameLinkPrefix="/student/courses"
          />
        </>
      ) : (
        <p>You are not enrolled in any student courses yet.</p>
      )}
    </>
  );
}