resources/assets/js/components/song/SongContextMenu.spec.ts

Summary

Maintainability
F
4 days
Test Coverage

Function test has 187 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected test () {
    it('queues and plays', async () => {
      const queueMock = this.mock(queueStore, 'queueIfNotQueued')
      const playMock = this.mock(playbackService, 'play')
      const song = factory<Song>('song', { playback_state: 'Stopped' })
Severity: Major
Found in resources/assets/js/components/song/SongContextMenu.spec.ts - About 7 hrs to fix

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

        it('goes to artist details screen', async () => {
          const goMock = this.mock(this.router, 'go')
          await this.renderComponent(factory<Song>('song'))
    
          await this.user.click(screen.getByText('Go to Artist'))
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 1 other location - About 3 hrs to fix
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 64..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 113.

    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('goes to album details screen', async () => {
          const goMock = this.mock(this.router, 'go')
          await this.renderComponent(factory<Song>('song'))
    
          await this.user.click(screen.getByText('Go to Album'))
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 1 other location - About 3 hrs to fix
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 73..80

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

    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('pauses playback', async () => {
          const pauseMock = this.mock(playbackService, 'pause')
          await this.renderComponent(factory<Song>('song', { playback_state: 'Playing' }))
    
          await this.user.click(screen.getByText('Pause'))
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 1 other location - About 3 hrs to fix
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 55..62

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

    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('resumes playback', async () => {
          const resumeMock = this.mock(playbackService, 'resume')
          await this.renderComponent(factory<Song>('song', { playback_state: 'Paused' }))
    
          await this.user.click(screen.getByText('Play'))
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 1 other location - About 3 hrs to fix
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 46..53

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

    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('queues to bottom', async () => {
          this.fillQueue()
          const queueMock = this.mock(queueStore, 'queue')
          await this.renderComponent()
    
    
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 2 other locations - About 2 hrs to fix
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 100..108
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 120..128

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

    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('queues after current song', async () => {
          this.fillQueue()
          const queueMock = this.mock(queueStore, 'queueAfterCurrent')
          await this.renderComponent()
    
    
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 2 other locations - About 2 hrs to fix
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 110..118
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 120..128

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

    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('queues to top', async () => {
          this.fillQueue()
          const queueMock = this.mock(queueStore, 'queueToTop')
          await this.renderComponent()
    
    
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 2 other locations - About 2 hrs to fix
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 100..108
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 110..118

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

    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

        it('queues', async () => {
          const queueMock = this.mock(queueStore, 'queue')
          await this.renderComponent()
    
          await this.user.click(screen.getByText('Queue'))
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 3 other locations - About 2 hrs to fix
    resources/assets/js/components/album/AlbumContextMenu.spec.ts on lines 54..61
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 82..89
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 159..166

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

    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

        it('adds to favorites', async () => {
          const likeMock = this.mock(favoriteStore, 'like')
          await this.renderComponent()
    
          await this.user.click(screen.getByText('Favorites'))
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 3 other locations - About 2 hrs to fix
    resources/assets/js/components/album/AlbumContextMenu.spec.ts on lines 54..61
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 82..89
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 91..98

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

    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

        it('downloads', async () => {
          const downloadMock = this.mock(downloadService, 'fromSongs')
          await this.renderComponent()
    
          await this.user.click(screen.getByText('Download'))
    Severity: Major
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 3 other locations - About 2 hrs to fix
    resources/assets/js/components/album/AlbumContextMenu.spec.ts on lines 54..61
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 91..98
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 159..166

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

    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 allow edit songs if current user is not admin', async () => {
          await this.actingAs().renderComponent()
          expect(screen.queryByText('Edit…')).toBeNull()
        })
    Severity: Minor
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 1 other location - About 55 mins to fix
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 287..290

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

    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 have an option to delete songs if current user is not admin', async () => {
          await this.actingAs().renderComponent()
          expect(screen.queryByText('Delete from Filesystem')).toBeNull()
        })
    Severity: Minor
    Found in resources/assets/js/components/song/SongContextMenu.spec.ts and 1 other location - About 55 mins to fix
    resources/assets/js/components/song/SongContextMenu.spec.ts on lines 259..262

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

    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