ElectronicBabylonianLiterature/ebl-frontend

View on GitHub
src/fragmentarium/application/FragmentService.test.ts

Summary

Maintainability
A
0 mins
Test Coverage

File FragmentService.test.ts has 592 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import Promise from 'bluebird'
import Folio from 'fragmentarium/domain/Folio'
import { fragment } from 'test-support/test-fragment'
import createLemmatizationTestText from 'test-support/test-text'
import { TestData, testDelegation } from 'test-support/utils'
Severity: Major
Found in src/fragmentarium/application/FragmentService.test.ts - About 1 day to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

      describe('update genre', () => {
        let expectedFragment: Fragment
    
        beforeEach(async () => {
          expectedFragment = produce(fragment, (draft: Draft<Fragment>) => {
    Severity: Major
    Found in src/fragmentarium/application/FragmentService.test.ts and 2 other locations - About 7 hrs to fix
    src/fragmentarium/application/FragmentService.test.ts on lines 414..433
    src/fragmentarium/application/FragmentService.test.ts on lines 435..457

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 181.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

      describe('update date', () => {
        let expectedFragment: Fragment
    
        beforeEach(async () => {
          expectedFragment = produce(fragment, (draft: Draft<Fragment>) => {
    Severity: Major
    Found in src/fragmentarium/application/FragmentService.test.ts and 2 other locations - About 7 hrs to fix
    src/fragmentarium/application/FragmentService.test.ts on lines 393..412
    src/fragmentarium/application/FragmentService.test.ts on lines 435..457

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 181.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

      describe('update dates in text', () => {
        let expectedFragment: Fragment
    
        beforeEach(async () => {
          expectedFragment = produce(fragment, (draft: Draft<Fragment>) => {
    Severity: Major
    Found in src/fragmentarium/application/FragmentService.test.ts and 2 other locations - About 7 hrs to fix
    src/fragmentarium/application/FragmentService.test.ts on lines 393..412
    src/fragmentarium/application/FragmentService.test.ts on lines 414..433

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 181.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

      describe('update transliteration', () => {
        const transliteration = '1. kur'
    
        beforeEach(async () => {
          fragmentRepository.updateTransliteration.mockReturnValue(
    Severity: Major
    Found in src/fragmentarium/application/FragmentService.test.ts and 2 other locations - About 4 hrs to fix
    src/fragmentarium/application/FragmentService.test.ts on lines 296..315
    src/fragmentarium/application/FragmentService.test.ts on lines 316..330

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 132.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

      describe('update introduction', () => {
        const introduction = 'Introductory @i{text}'
    
        beforeEach(async () => {
          fragmentRepository.updateIntroduction.mockReturnValue(
    Severity: Major
    Found in src/fragmentarium/application/FragmentService.test.ts and 2 other locations - About 4 hrs to fix
    src/fragmentarium/application/FragmentService.test.ts on lines 276..295
    src/fragmentarium/application/FragmentService.test.ts on lines 316..330

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 132.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

      describe('update notes', () => {
        const notes = 'Notes @i{text}'
    
        beforeEach(async () => {
          fragmentRepository.updateNotes.mockReturnValue(Promise.resolve(fragment))
    Severity: Major
    Found in src/fragmentarium/application/FragmentService.test.ts and 2 other locations - About 4 hrs to fix
    src/fragmentarium/application/FragmentService.test.ts on lines 276..295
    src/fragmentarium/application/FragmentService.test.ts on lines 296..315

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 132.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Wontfix

    const imageRepository = {
      find: jest.fn(),
      findFolio: jest.fn(),
      findPhoto: jest.fn(),
      findThumbnail: jest.fn(),
    Severity: Major
    Found in src/fragmentarium/application/FragmentService.test.ts and 1 other location - About 1 hr to fix
    src/fragmentarium/application/FragmentSearchService.test.ts on lines 10..15

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status