department-of-veterans-affairs/vets-website

View on GitHub
src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js

Summary

Maintainability
F
1 wk
Test Coverage

File index.unit.spec.js has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import { expect } from 'chai';
import moment from 'moment-timezone';
import MockDate from 'mockdate';
import { mockFetch } from '@department-of-veterans-affairs/platform-testing/helpers';

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

        it('should display document tile for canceled video at VA location appointment', async () => {
          // Arrange
          const today = moment();
          const responses = MockAppointmentResponse.createClinicResponses({
            localStartTime: today,
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 217..244
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 302..329

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

    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 display document tile for canceled video appointment', async () => {
          // Arrange
          const today = moment();
          const responses = MockAppointmentResponse.createGfeResponses({
            localStartTime: today,
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 217..244
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 387..414

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

    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 display document tile for canceled ATLAS video appointment', async () => {
          // Arrange
          const today = moment();
          const responses = MockAppointmentResponse.createAtlasResponses({
            localStartTime: today,
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 302..329
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 387..414

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

    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 display document tile for past ATLAS video appointment', async () => {
          // Arrange
          const yesterday = moment().subtract(1, 'day');
          const responses = MockAppointmentResponse.createAtlasResponses({
            localStartTime: yesterday,
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 274..300
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 359..385

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

    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 display document tile for past video at VA location appointment', async () => {
          // Arrange
          const yesterday = moment().subtract(1, 'day');
          const responses = MockAppointmentResponse.createClinicResponses({
            localStartTime: yesterday,
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 189..215
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 274..300

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

    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 display document tile for past video appointment', async () => {
          // Arrange
          const yesterday = moment().subtract(1, 'day');
          const responses = MockAppointmentResponse.createGfeResponses({
            localStartTime: yesterday,
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 189..215
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 359..385

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

    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 display document tile for ATLAS video appointment', async () => {
          // Arrange
          const today = moment();
          const responses = MockAppointmentResponse.createAtlasResponses({
            localStartTime: today,
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 246..272
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 331..357

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

        it('should display document tile for video appointment', async () => {
          // Arrange
          const today = moment();
          const responses = MockAppointmentResponse.createGfeResponses({
            localStartTime: today,
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 161..187
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 331..357

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

        it('should display document tile for video at VA location appointment', async () => {
          // Arrange
          const today = moment();
          const responses = MockAppointmentResponse.createClinicResponses({
            localStartTime: today,
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 161..187
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 246..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 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 8 locations. Consider refactoring.
    Open

        const screen = renderWithStoreAndRouter(<AppointmentList />, {
          initialState,
          path: `/${response.id}`,
        });
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 144..147
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 87..90
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 196..199
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 238..241
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 301..304
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 375..378
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 450..453

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

    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 8 locations. Consider refactoring.
    Open

        const screen = renderWithStoreAndRouter(<AppointmentList />, {
          initialState,
          path: `/${response.id}`,
        });
    src/applications/vaos/appointment-list/components/ConfirmedAppointmentDetailsPage/index.unit.spec.js on lines 85..88
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 87..90
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 196..199
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 238..241
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 301..304
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 375..378
    src/applications/vaos/appointment-list/components/RequestedAppointmentDetailsPage.unit.spec.js on lines 450..453

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

    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