api/src/__tests__/ticketMutations.test.ts

Summary

Maintainability
F
5 days
Test Coverage

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

import { graphqlRequest } from '../db/connection';
import {
  boardFactory,
  checklistFactory,
  checklistItemFactory,
Severity: Minor
Found in api/src/__tests__/ticketMutations.test.ts - About 3 hrs to fix

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

      test('Ticket archive', async () => {
        const mutation = `
          mutation ticketsArchive($stageId: String!) {
            ticketsArchive(stageId: $stageId)
          }
    Severity: Major
    Found in api/src/__tests__/ticketMutations.test.ts and 3 other locations - About 7 hrs to fix
    api/src/__tests__/dealMutations.test.ts on lines 443..464
    api/src/__tests__/growthHackMutations.test.ts on lines 410..433
    api/src/__tests__/taskMutations.test.ts on lines 404..425

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

      test('Update ticket move to pipeline stage', async () => {
        const mutation = `
          mutation ticketsEdit($_id: String!, ${commonTicketParamDefs}) {
            ticketsEdit(_id: $_id, ${commonTicketParams}) {
              _id
    Severity: Major
    Found in api/src/__tests__/ticketMutations.test.ts and 3 other locations - About 7 hrs to fix
    api/src/__tests__/dealMutations.test.ts on lines 298..325
    api/src/__tests__/growthHackMutations.test.ts on lines 244..275
    api/src/__tests__/taskMutations.test.ts on lines 258..285

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

    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

      test('Change ticket if move to another stage', async () => {
        const anotherStage = await stageFactory({ pipelineId: pipeline._id });
    
        const args = {
          proccessId: Math.random().toString(),
    Severity: Major
    Found in api/src/__tests__/ticketMutations.test.ts and 2 other locations - About 5 hrs to fix
    api/src/__tests__/growthHackMutations.test.ts on lines 217..242
    api/src/__tests__/taskMutations.test.ts on lines 231..256

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

    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

      test('Change ticket', async () => {
        const args = {
          proccessId: Math.random().toString(),
          itemId: ticket._id,
          aboveItemId: '',
    Severity: Major
    Found in api/src/__tests__/ticketMutations.test.ts and 1 other location - About 4 hrs to fix
    api/src/__tests__/growthHackMutations.test.ts on lines 187..215

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

    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

      test('Watch ticket', async () => {
        const mutation = `
          mutation ticketsWatch($_id: String!, $isAdd: Boolean!) {
            ticketsWatch(_id: $_id, isAdd: $isAdd) {
              _id
    Severity: Major
    Found in api/src/__tests__/ticketMutations.test.ts and 1 other location - About 4 hrs to fix
    api/src/__tests__/growthHackMutations.test.ts on lines 296..323

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

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

      afterEach(async () => {
        // Clearing test data
        await Boards.deleteMany({});
        await Pipelines.deleteMany({});
        await Stages.deleteMany({});
    Severity: Major
    Found in api/src/__tests__/ticketMutations.test.ts and 9 other locations - About 2 hrs to fix
    api/src/__tests__/boardMutations.test.ts on lines 75..82
    api/src/__tests__/engageMessageQueries.test.ts on lines 49..56
    api/src/__tests__/growthHackMutations.test.ts on lines 89..96
    api/src/__tests__/integrationMutations.test.ts on lines 76..83
    api/src/__tests__/knowledgeBaseMutations.test.ts on lines 65..72
    api/src/__tests__/scriptMutations.test.ts on lines 36..43
    api/src/__tests__/structureMutations.test.ts on lines 32..39
    api/src/__tests__/taskMutations.test.ts on lines 94..101
    api/src/__tests__/widgetMutations.test.ts on lines 1141..1148

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

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

      test('Remove ticket', async () => {
        const mutation = `
          mutation ticketsRemove($_id: String!) {
            ticketsRemove(_id: $_id) {
              _id
    Severity: Major
    Found in api/src/__tests__/ticketMutations.test.ts and 8 other locations - About 2 hrs to fix
    api/src/__tests__/channelMutations.test.ts on lines 131..146
    api/src/__tests__/checklistMutations.test.ts on lines 244..263
    api/src/__tests__/emailTemplateMutations.test.ts on lines 91..108
    api/src/__tests__/fieldMutations.test.ts on lines 236..253
    api/src/__tests__/fieldMutations.test.ts on lines 524..538
    api/src/__tests__/growthHackMutations.test.ts on lines 277..294
    api/src/__tests__/responseTemplateMutations.test.ts on lines 136..153
    api/src/__tests__/segmentMutations.test.ts on lines 174..189

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

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

        if (clonedTicketChecklist) {
          const clonedTicketChecklistItems = await ChecklistItems.find({
            checklistId: clonedTicketChecklist._id
          });
    
    
    Severity: Major
    Found in api/src/__tests__/ticketMutations.test.ts and 3 other locations - About 2 hrs to fix
    api/src/__tests__/dealMutations.test.ts on lines 426..433
    api/src/__tests__/growthHackMutations.test.ts on lines 397..404
    api/src/__tests__/taskMutations.test.ts on lines 387..394

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

    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