All files / components/Jobs JobsTable.jsx

100% Statements 7/7
100% Branches 2/2
100% Functions 5/5
100% Lines 7/7

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 46 47 48 49 50 51 52 53 54 55 56 57          37x                               7x         7x         7x                     12x                   37x   37x    
import React from "react";
import OurTable from "main/components/Common/OurTable";
import { formatTime } from "main/utils/dateUtils";
 
export default function JobsTable({ jobs }) {
  const columns = [
    {
      header: "id",
      accessorKey: "id",
    },
    {
      header: "Job Name",
      accessorKey: "jobName",
    },
    {
      header: "User Email",
      accessorKey: "createdByEmail",
    },
    {
      header: "Course Id",
      accessorFn: (row) =>
        row.scopeType === "course" ? String(row.scopeId) : "",
      id: "courseId",
    },
    {
      header: "Created",
      accessorFn: (row) => formatTime(row.createdAt),
      id: "createdAt",
    },
    {
      header: "Updated",
      accessorFn: (row) => formatTime(row.updatedAt),
      id: "updatedAt",
    },
    {
      header: "Status",
      accessorKey: "status",
    },
    {
      header: "Log",
      accessorKey: "log",
      cell: ({ cell }) => (
        <div
          style={{ maxWidth: 450, maxHeight: 100, overflowY: "auto" }}
          data-testid={`JobsTable-cell-row-${cell.row.index}-col-${cell.column.id}-div`}
        >
          <pre style={{ whiteSpace: "pre-wrap" }}>{cell.getValue()}</pre>
        </div>
      ),
    },
  ];
 
  const testid = "JobsTable";
 
  return <OurTable data={jobs} columns={columns} testid={testid} />;
}