teamdigitale/italia-app

View on GitHub
ts/features/fci/utils/__tests__/signatureFields.test.ts

Summary

Maintainability
C
1 day
Test Coverage

File signatureFields.test.ts has 317 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { TypeEnum as ClausesTypeEnum } from "../../../../../definitions/fci/Clause";
import { SignatureField } from "../../../../../definitions/fci/SignatureField";
import I18n from "../../../../i18n";
import { mockDocuments } from "../../types/__mocks__/SignatureRequestDetailView.mock";
import {
Severity: Minor
Found in ts/features/fci/utils/__tests__/signatureFields.test.ts - About 3 hrs to fix

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

    const requiredSignatureFields = [
      {
        clause: {
          title: "clause title 1",
          type: ClausesTypeEnum.REQUIRED
    Severity: Major
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 2 other locations - About 1 hr to fix
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 69..84
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 86..101

    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 62.

    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.
    Open

    const reqAndOptSignatureFields = [
      {
        clause: {
          title: "clause title 3",
          type: ClausesTypeEnum.OPTIONAL
    Severity: Major
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 2 other locations - About 1 hr to fix
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 52..67
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 69..84

    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 62.

    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.
    Open

    const optionalSignatureFields = [
      {
        clause: {
          title: "clause title 3",
          type: ClausesTypeEnum.OPTIONAL
    Severity: Major
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 2 other locations - About 1 hr to fix
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 52..67
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 86..101

    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 62.

    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.
    Open

        it("should return a sorted array when only UNFAIR and REQUIRED types are present in the following order: UNFAIR, REQUIRED", () => {
          const ordered = [
            requiredSignatureFields[1], // UNFAIR
            requiredSignatureFields[0] // REQUIRED
          ];
    Severity: Minor
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 1 other location - About 55 mins to fix
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 237..245

    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 54.

    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.
    Open

        it("should return a sorted array when only REQUIRED and OPTIONAL types are present in the following order: REQUIRED, OPTION", () => {
          const ordered = [
            reqAndOptSignatureFields[1], // REQUIRED
            reqAndOptSignatureFields[0] // OPTIONAL
          ];
    Severity: Minor
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 1 other location - About 55 mins to fix
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 227..235

    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 54.

    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.
    Open

    jest.mock("react-native-blob-util", () => ({
      fs: {
        readFile: jest
          .fn()
          .mockImplementation(() => Promise.resolve("base64-encoded-pdf-bytes"))
    Severity: Minor
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 1 other location - About 55 mins to fix
    ts/features/fci/saga/__tests__/handleDrawSignatureBox.test.ts on lines 14..20

    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 53.

    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.
    Open

        it("it should return 6 if the clauses array contains REQUIRED and UNFAIR", () => {
          expect(
            getClausesCountByTypes(mockCreateSignatureBody.documents_to_sign, [
              ClausesTypeEnum.REQUIRED,
              ClausesTypeEnum.UNFAIR
    Severity: Minor
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 1 other location - About 40 mins to fix
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 294..301

    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 48.

    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.
    Open

        it("it should return 7 if the clauses array contains REQUIRED and OPTIONAL", () => {
          expect(
            getClausesCountByTypes(mockCreateSignatureBody.documents_to_sign, [
              ClausesTypeEnum.OPTIONAL,
              ClausesTypeEnum.REQUIRED
    Severity: Minor
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 1 other location - About 40 mins to fix
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 279..286

    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 48.

    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.
    Open

      describe("Test getRequiredSignatureFields", () => {
        it("it should returns an array of UNFAIR and REQUIRED signature fields", () => {
          expect(getRequiredSignatureFields(signatureFields)).toStrictEqual(
            requiredSignatureFields
          );
    Severity: Minor
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 1 other location - About 30 mins to fix
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 208..214

    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 45.

    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.
    Open

      describe("Test getOptionalSignatureFields", () => {
        it("it should returns an array of OPTIONAL signature fields", () => {
          expect(getOptionalSignatureFields(signatureFields)).toStrictEqual(
            optionalSignatureFields
          );
    Severity: Minor
    Found in ts/features/fci/utils/__tests__/signatureFields.test.ts and 1 other location - About 30 mins to fix
    ts/features/fci/utils/__tests__/signatureFields.test.ts on lines 200..206

    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 45.

    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