All files / app/src/features/measure/lib get-queries-for-package.ts

90% Statements 9/10
50% Branches 1/2
100% Functions 1/1
90% Lines 9/10

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 151x       1x 1x 1x 1x 1x 1x   1x   1x  
import { queryFetchPackageById } from '@/entities/package'
import { getIdFromIRI } from '@/shared/helpers'
import { Pipe } from '@/entities/pipe'
 
export const getQueriesForPackage = (pipes?: Pipe[]) => {
  return (
    pipes
      ?.filter(pipe => pipe.package)
      .filter((pipe, index, self) => self.findIndex(t => t.package?.['@id'] === pipe.package?.['@id']) === index)
      .map(pipe => ({
        queryFn: () => queryFetchPackageById(getIdFromIRI(pipe?.package?.['@id']) as string)()(),
      })) || []
  )
}