All files / src/helpers/queries index.ts

100% Statements 9/9
66.67% Branches 4/6
100% Functions 1/1
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    50x 26x   13x 5x 5x         8x     50x    
import { CustomQueryFn } from './../../types/Api';
 
const getCustomQuery = <T = any>(customQueryFn: CustomQueryFn<T>, params) => {
  const { defaultQuery, defaultVariables } = params;
 
  if (customQueryFn) {
    const { query, variables } = customQueryFn(defaultQuery, defaultVariables);
    return {
      query: query || defaultQuery,
      variables: variables || defaultVariables};
  }
 
  return { query: defaultQuery, variables: defaultVariables };
};
 
export { getCustomQuery };