fvanwijk/jasmine-mox-matchers

View on GitHub
src/jasmine-mox-matchers.spec.js

Summary

Maintainability
A
0 mins
Test Coverage

File jasmine-mox-matchers.spec.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

/**
 * This spec tests both jasmine 1 and 2+ matchers, but is using Jasmine 4, so the lines where
 * there is a slight difference between Jasmine 1 and 2 in the matchers, are not tested for Jasmine 1.
 */
import expectMatcher from 'testception';
Severity: Minor
Found in src/jasmine-mox-matchers.spec.js - About 3 hrs to fix

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

            it('should assert promises that are rejected with some message as rejected with that message', () => {
              const def = $q.defer();
              def.reject('message');
    
              test
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 2 hrs to fix
    src/jasmine-mox-matchers.spec.js on lines 210..221

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

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

            it('should fail when the promise rejects to another value than the expected value', () => {
              const def = $q.defer();
              def.reject('message');
    
              test
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 2 hrs to fix
    src/jasmine-mox-matchers.spec.js on lines 176..187

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

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

            it('should fail when the promise does not resolve', () => {
              test
                .withActual($q.defer().promise)
                .andExpected('message')
                .toFail()
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 104..110

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

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

            it('should fail when the promise does not resolve', () => {
              test
                .withActual($q.defer().promise)
                .andExpected('value')
                .toFail()
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 189..195

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

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

      describe('toHaveBeenRejected', () => {
        it('is the same matcher as toReject', () => {
          expect(JasmineMoxMatchers.v2.toHaveBeenRejected).toBe(JasmineMoxMatchers.v2.toReject);
        });
      });
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 3 other locations - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 339..343
    src/jasmine-mox-matchers.spec.js on lines 345..349
    src/jasmine-mox-matchers.spec.js on lines 357..361

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

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

            it('should fail when the actual string does not have the expected query params', () => {
              test
                .withActual('path?key1=value1')
                .andExpected({ key2: 'value2' })
                .toFail()
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 227..236

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

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

            it('should pass when actual element has the expected values on the isolate scope', () => {
              test
                .withActual(element)
                .andExpected({ key1: 'value1' })
                .toPass()
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 294..303

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

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

            it('should fail when actual element has the expected values not on the isolate scope', () => {
              test
                .withActual(element)
                .andExpected({ key3: 'value3' })
                .toFail()
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 283..292

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

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

      describe('toHaveBeenResolvedWith', () => {
        it('is the same matcher as toResolveWith', () => {
          expect(JasmineMoxMatchers.v2.toHaveBeenResolvedWith).toBe(JasmineMoxMatchers.v2.toResolveWith);
        });
      });
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 3 other locations - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 339..343
    src/jasmine-mox-matchers.spec.js on lines 351..355
    src/jasmine-mox-matchers.spec.js on lines 357..361

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

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

      describe('toHaveBeenRejectedWith', () => {
        it('is the same matcher as toRejectWith', () => {
          expect(JasmineMoxMatchers.v2.toHaveBeenRejectedWith).toBe(JasmineMoxMatchers.v2.toRejectWith);
        });
      });
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 3 other locations - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 339..343
    src/jasmine-mox-matchers.spec.js on lines 345..349
    src/jasmine-mox-matchers.spec.js on lines 351..355

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

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

            it('should pass when the actual string has the expected query params', () => {
              test
                .withActual('path?key1=value1')
                .andExpected({ key1: 'value1' })
                .toPass()
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 238..247

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

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

      describe('toHaveBeenResolved', () => {
        it('is the same matcher as toResolve', () => {
          expect(JasmineMoxMatchers.v2.toHaveBeenResolved).toEqual(JasmineMoxMatchers.v2.toResolve);
        });
      });
    Severity: Major
    Found in src/jasmine-mox-matchers.spec.js and 3 other locations - About 1 hr to fix
    src/jasmine-mox-matchers.spec.js on lines 345..349
    src/jasmine-mox-matchers.spec.js on lines 351..355
    src/jasmine-mox-matchers.spec.js on lines 357..361

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

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

            it('should assert non-resolving promises as not resolved', () => {
              test
                .withActual($q.defer().promise)
                .toFail()
                .withMessage('Expected promise to have been resolved');
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 45 mins to fix
    src/jasmine-mox-matchers.spec.js on lines 151..156

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

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

            it('should assert non-resolving promises as not rejected', () => {
              test
                .withActual($q.defer().promise)
                .toFail()
                .withMessage('Expected promise to have been rejected');
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js and 1 other location - About 45 mins to fix
    src/jasmine-mox-matchers.spec.js on lines 71..76

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

    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

    Insert ,
    Open

                this: 'value2'
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace _$q_ with (_$q_)
    Open

        inject(_$q_ => {
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace res with (res)
    Open

                .andExpected(res => {
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Insert ,
    Open

                key2: 'value2'
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace version with (version)
    Open

      angular.forEach([1, 2], version => {
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ⏎············.withActual($q.reject())⏎············.toFail()⏎············ with .withActual($q.reject()).toFail()
    Open

              test
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ⏎············.withActual($q.defer().promise)⏎············.toFail()⏎············ with .withActual($q.defer().promise).toFail()
    Open

              test
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ⏎············.withActual(undefined)⏎············.toFail()⏎············ with .withActual(undefined).toFail()
    Open

              test
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace res with (res)
    Open

                .andExpected(res => {
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ⏎············.withActual($q.defer().promise)⏎············.toFail()⏎············ with .withActual($q.defer().promise).toFail()
    Open

              test
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ⏎············.withActual({})⏎············.toFail()⏎············ with .withActual({}).toFail()
    Open

              test
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ⏎············.withActual($q.defer().promise)⏎············.toFail()⏎············ with .withActual($q.defer().promise).toFail()
    Open

              test
    Severity: Minor
    Found in src/jasmine-mox-matchers.spec.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status