• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IQSS / dataverse-frontend / 7273953173

19 Dec 2023 04:22PM UTC coverage: 98.16% (+0.002%) from 98.158%
7273953173

push

github

MellyGray
feat(FilePage): add dataset citation

457 of 471 branches covered (0.0%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

1463 of 1485 relevant lines covered (98.52%)

4330.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/sections/file/useFile.tsx
1
import { useEffect, useState } from 'react'
2
import { FileRepository } from '../../files/domain/repositories/FileRepository'
3
import { getFileById } from '../../files/domain/useCases/getFileById'
4
import { File } from '../../files/domain/models/File'
5

6
export function useFile(repository: FileRepository, id: number) {
24✔
7
  const [file, setFile] = useState<File>()
24✔
8
  const [isLoading, setIsLoading] = useState<boolean>(true)
24✔
9

10
  useEffect(() => {
24✔
11
    setIsLoading(true)
9✔
12

13
    getFileById(repository, id)
9✔
14
      .then((file: File | undefined) => {
15
        setFile(file)
9✔
16
        setIsLoading(false)
9✔
17
      })
18
      .catch(() => {
19
        throw new Error('There was an error getting the file')
×
20
        setIsLoading(false)
×
21
      })
22
  }, [repository, id])
23

24
  return {
24✔
25
    file,
26
    isLoading
27
  }
28
}
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc