src/app/legacy/containers/ArticleTimestamp/index.test.jsx

Summary

Maintainability
D
2 days
Test Coverage

File index.test.jsx has 314 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import {
  isNull,
  suppressPropWarnings,
} from '#psammead/psammead-test-helpers/src';
Severity: Minor
Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx - About 3 hrs to fix

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

        it('should show the correct local date', () => {
          const { getByText } = render(
            <WrappedArticleTimestamp {...props} service="news" />,
          );
          const timeEl = getByText(/9 August 2019/);
    Severity: Major
    Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 2 hrs to fix
    src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 364..371

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

    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 show the correct local date for Bengali', () => {
          const { getByText } = render(
            <WrappedArticleTimestamp {...props} service="bengali" />,
          );
          const timeEl = getByText(/১০ অগাস্ট ২০১৯/);
    Severity: Major
    Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 2 hrs to fix
    src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 354..362

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

    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 render with a prefix', () => {
        const { container } = render(
          <WrappedArticleTimestamp
            firstPublished={1530947227000}
            lastPublished={1552666749637}
    Severity: Major
    Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 1 hr to fix
    src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 73..83

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

    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 render with a suffix', () => {
        const { container } = render(
          <WrappedArticleTimestamp
            firstPublished={1530947227000}
            lastPublished={1552666749637}
    Severity: Major
    Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 1 hr to fix
    src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 61..71

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

    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 render a 'created' Timestamp correctly", () => {
        const { container } = render(
          <WrappedArticleTimestamp
            firstPublished={1530947227000} // Sat Jul 07 2018 07:07:07 UTC
            lastPublished={1530947227000} // Sat Jul 07 2018 07:07:07 UTC
    Severity: Major
    Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 1 hr to fix
    src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 50..59

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

    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 render both a 'created' and an 'updated' Timestamp correctly", () => {
        const { container } = render(
          <WrappedArticleTimestamp
            firstPublished={1530947227000} // Sat Jul 07 2018 07:07:07
            lastPublished={1552666749637} // Fri Mar 15 2019 16:19:09
    Severity: Major
    Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 1 hr to fix
    src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 39..48

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

    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

        const { getByText } = render(
          <WrappedArticleTimestamp
            firstPublished={1530947280000} // Sat Jul 07 2018 07:08:00 UTC
            lastPublished={1530947286000} // Sat Jul 07 2018 07:08:06 UTC
            minutesTolerance={1}
    Severity: Minor
    Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 50 mins to fix
    src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 221..227

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

    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

        const { getAllByText } = render(
          <WrappedArticleTimestamp
            firstPublished={1530947280000} // Sat Jul 07 2018 07:08:00 UTC
            lastPublished={1531047280000} // Sun Jul 08 2018 10:54:40 UTC
            minutesTolerance={1}
    Severity: Minor
    Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 50 mins to fix
    src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 206..212

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

    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('with no data', () => {
        suppressPropWarnings(['firstPublished', 'undefined']);
        suppressPropWarnings(['lastPublished', 'undefined']);
        isNull('should return null', <WrappedArticleTimestamp />);
      });
    Severity: Minor
    Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 35 mins to fix
    src/app/legacy/containers/Headings/index.test.jsx on lines 85..89

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

    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