concord-consortium/lara

View on GitHub
lara-typescript/src/interactive-api-client/api.spec.ts

Summary

Maintainability
F
5 days
Test Coverage

File api.spec.ts has 553 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { mockIFramePhone, MockPhone } from "../interactive-api-lara-host/mock-iframe-phone";
import * as iframePhone from "iframe-phone";
import * as api from "./api";
import { getClient } from "./client";
import {
Severity: Major
Found in lara-typescript/src/interactive-api-client/api.spec.ts - About 1 day to fix

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

      it("supports interactive state observing", () => {
        const listener = jest.fn();
        api.addInteractiveStateListener(listener);
        getClient().managedState.interactiveState = {foo: 123};
        expect(listener).toHaveBeenCalledWith({foo: 123});
    Severity: Major
    Found in lara-typescript/src/interactive-api-client/api.spec.ts and 2 other locations - About 5 hrs to fix
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 241..251
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 253..263

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

    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("supports global interactive state observing", () => {
        const listener = jest.fn();
        api.addGlobalInteractiveStateListener(listener);
        getClient().managedState.globalInteractiveState = {foo: 123};
        expect(listener).toHaveBeenCalledWith({foo: 123});
    Severity: Major
    Found in lara-typescript/src/interactive-api-client/api.spec.ts and 2 other locations - About 5 hrs to fix
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 229..239
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 241..251

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

    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("supports authored state observing", () => {
        const listener = jest.fn();
        api.addAuthoredStateListener(listener);
        getClient().managedState.authoredState = {foo: 123};
        expect(listener).toHaveBeenCalledWith({foo: 123});
    Severity: Major
    Found in lara-typescript/src/interactive-api-client/api.spec.ts and 2 other locations - About 5 hrs to fix
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 229..239
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 253..263

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

    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("supports setAuthoredState and getAuthoredState", () => {
        api.setAuthoredState({bar: true});
        expect(mockedPhone.messages).toEqual([{type: "authoredState", content: {bar: true}}]);
        expect(api.getAuthoredState()).toEqual({bar: true});
      });
    Severity: Major
    Found in lara-typescript/src/interactive-api-client/api.spec.ts and 1 other location - About 3 hrs to fix
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 68..72

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

    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("supports setGlobalInteractiveState", () => {
        api.setGlobalInteractiveState({baz: true});
        expect(mockedPhone.messages).toEqual([{type: "interactiveStateGlobal", content: {baz: true}}]);
        expect(api.getGlobalInteractiveState()).toEqual({baz: true});
      });
    Severity: Major
    Found in lara-typescript/src/interactive-api-client/api.spec.ts and 1 other location - About 3 hrs to fix
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 62..66

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

    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 implement showModal [lightbox]", () => {
        const options: IShowLightbox = {
          uuid: "foo",
          type: "lightbox",
          url: "https://concord.org"
    Severity: Major
    Found in lara-typescript/src/interactive-api-client/api.spec.ts and 1 other location - About 2 hrs to fix
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 377..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 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("does not yet implement showModal [dialog]", () => {
        const options: IShowDialog = {
          uuid: "foo",
          type: "dialog",
          url: "https://concord.org"
    Severity: Major
    Found in lara-typescript/src/interactive-api-client/api.spec.ts and 1 other location - About 2 hrs to fix
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 319..327

    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("supports sendReportItemAnswer", () => {
          const mockAnswer: any = { foo: 1 };
          api.sendReportItemAnswer(mockAnswer);
          expect(mockedPhone.messages[0]).toEqual({ type: "reportItemAnswer", content: mockAnswer });
        });
    Severity: Major
    Found in lara-typescript/src/interactive-api-client/api.spec.ts and 1 other location - About 2 hrs to fix
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 577..581

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

    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("supports notifyReportItemClientReady", () => {
          const mockMetadata: any = { foo: 1 };
          api.notifyReportItemClientReady(mockMetadata);
          expect(mockedPhone.messages[0]).toEqual({ type: "reportItemClientReady", content: mockMetadata });
        });
    Severity: Major
    Found in lara-typescript/src/interactive-api-client/api.spec.ts and 1 other location - About 2 hrs to fix
    lara-typescript/src/interactive-api-client/api.spec.ts on lines 571..575

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

    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