teamdigitale/italia-app

View on GitHub
ts/store/reducers/wallet/__tests__/wallets.test.ts

Summary

Maintainability
F
4 days
Test Coverage

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

import * as E from "fp-ts/lib/Either";
import { Errors } from "io-ts";
import * as pot from "@pagopa/ts-commons/lib/pot";
import _ from "lodash";
import { pipe } from "fp-ts/lib/function";
Severity: Minor
Found in ts/store/reducers/wallet/__tests__/wallets.test.ts - About 6 hrs to fix

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

      it("should return credit cards", () => {
        const maybeCC = creditCardWalletV1Selector(globalState);
        expect(pot.isSome(maybeCC)).toBeTruthy();
        if (pot.isSome(maybeCC)) {
          expect(maybeCC.value.length).toEqual(1);
    Severity: Major
    Found in ts/store/reducers/wallet/__tests__/wallets.test.ts and 1 other location - About 5 hrs to fix
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 101..114

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

    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 credit card supporting pagoPa payments", () => {
        const maybePagoPaCC = pagoPaCreditCardWalletV1Selector(globalState);
        expect(pot.isSome(maybePagoPaCC)).toBeTruthy();
        if (pot.isSome(maybePagoPaCC)) {
          expect(maybePagoPaCC.value.length).toEqual(1);
    Severity: Major
    Found in ts/store/reducers/wallet/__tests__/wallets.test.ts and 1 other location - About 5 hrs to fix
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 71..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 147.

    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

      it("should filter credit card and return one", () => {
        const maybeWallets = PatchedWalletV2ListResponse.decode(walletsV2_3);
        const globalState = mockWalletState(maybeWallets);
        const potCreditCard = creditCardListSelector(globalState);
        expect(pot.isSome(potCreditCard)).toBeTruthy();
    Severity: Major
    Found in ts/store/reducers/wallet/__tests__/wallets.test.ts and 2 other locations - About 4 hrs to fix
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 135..144
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 145..154

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

    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

      it("should filter BPay and return one", () => {
        const maybeWallets = PatchedWalletV2ListResponse.decode(walletsV2_3);
        const globalState = mockWalletState(maybeWallets);
        const potBPay = bPayListSelector(globalState);
        expect(pot.isSome(potBPay)).toBeTruthy();
    Severity: Major
    Found in ts/store/reducers/wallet/__tests__/wallets.test.ts and 2 other locations - About 4 hrs to fix
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 125..134
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 135..144

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

    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

      it("should filter bancomat and return one", () => {
        const maybeWallets = PatchedWalletV2ListResponse.decode(walletsV2_3);
        const globalState = mockWalletState(maybeWallets);
        const potBancomat = bancomatListSelector(globalState);
        expect(pot.isSome(potBancomat)).toBeTruthy();
    Severity: Major
    Found in ts/store/reducers/wallet/__tests__/wallets.test.ts and 2 other locations - About 4 hrs to fix
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 125..134
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 145..154

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

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      it("should return false - no payable methods", () => {
        const withWallets = appReducer(undefined, fetchWalletsSuccess([]));
        expect(withPaymentFeatureSelector(withWallets).length).toEqual(0);
      });
    Severity: Minor
    Found in ts/store/reducers/wallet/__tests__/wallets.test.ts and 1 other location - About 55 mins to fix
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 315..318

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      it("should return false - no payable methods", () => {
        const withWallets = appReducer(undefined, fetchWalletsSuccess([]));
        expect(withPaymentFeatureSelector(withWallets).length).toEqual(0);
      });
    Severity: Minor
    Found in ts/store/reducers/wallet/__tests__/wallets.test.ts and 1 other location - About 55 mins to fix
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 269..272

    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

        if (pot.isSome(walletFull)) {
          expect(Object.keys(walletFull.value).length).toEqual(
            convertedWallets.length
          );
        }
    Severity: Minor
    Found in ts/store/reducers/wallet/__tests__/wallets.test.ts and 1 other location - About 45 mins to fix
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 441..445

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

    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

        if (pot.isSome(walletUpdated)) {
          expect(Object.keys(walletUpdated.value).length).toEqual(
            convertedWallets.length
          );
        }
    Severity: Minor
    Found in ts/store/reducers/wallet/__tests__/wallets.test.ts and 1 other location - About 45 mins to fix
    ts/store/reducers/wallet/__tests__/wallets.test.ts on lines 427..431

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

    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