All files / src customRender.jsx

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

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              5x 9x                     5x   1x   1x                  
import React from 'react';
import { render, screen } from '@testing-library/react';
import { CASProvider } from './contexts/CASProvider';
import { CoursesProvider } from './contexts/CoursesProvider';
import { StudentsProvider } from './contexts/StudentsProvider';
import { SnackbarProvider } from 'notistack';
 
export const customRender = (ui, CASValue = {}, studentsValue = {}, coursesValue = {}) => {
  return render(
    <SnackbarProvider>
      <CASProvider value={20}>
        <StudentsProvider value={50}>
          <CoursesProvider value={100}>{ui}</CoursesProvider>
        </StudentsProvider>
      </CASProvider>
    </SnackbarProvider>,
  );
};
 
export const customRenderCAS = (ui, CASValue = {}, studentsValue = {}, coursesValue = {}) => {
 
  const user={authorityRole: "DEANERY", email: "test@test.pl", id: "123"}
 
  return render(
    <SnackbarProvider>
      <CASProvider value={{user}}>
        <StudentsProvider value={50}>
          <CoursesProvider value={100}>{ui}</CoursesProvider>
        </StudentsProvider>
      </CASProvider>
    </SnackbarProvider>,
  );
};