All files / components/School SchoolDropdown.js

100% Statements 6/6
100% Branches 0/0
100% Functions 1/1
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 34            10x               10x 10x 9x           10x                      
import { useBackend } from 'main/utils/useBackend';
import React from "react";
import OurAddDropdownForm from '../OurAddDropdownForm';
 
export default function SchoolDropdown(){
    const { data: schools, error: _error, status: _status } =
    useBackend(
      // Stryker disable next-line all : don't test internal caching of React Query
      ["/api/schools/all"],
      // Stryker disable next-line all : GET is the default
      { method: "GET", url: "/api/schools/all" },
      []
    );
 
    const fixedSchools = [];
    for(let i = 0; i < schools.length; ++i){
        fixedSchools.push({
            label: schools[i].name,
            key: schools[i].name,
        });
    }
 
    return (
        <OurAddDropdownForm
            content={fixedSchools}
            label="Name"
            testId="school-dropdown"
            basis={null}
            autocomplete={true}
        ></OurAddDropdownForm>
    )
}