HabitRPG/habitrpg

View on GitHub
test/api/v3/integration/groups/GET-groups_groupId_invites.test.js

Summary

Maintainability
F
3 days
Test Coverage

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

  it('returns an error if req.query.limit is over 60', async () => {
    const { group, groupLeader: leader } = await createAndPopulateGroup({
      groupDetails: {
        type: 'guild',
        privacy: 'private',
test/api/v3/integration/groups/GET-groups_groupId_invites.test.js on lines 113..130
test/api/v3/integration/groups/GET-groups_groupId_invites.test.js on lines 132..149

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

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('returns an error if req.query.limit is under 1', async () => {
    const { group, groupLeader: leader } = await createAndPopulateGroup({
      groupDetails: {
        type: 'guild',
        privacy: 'private',
test/api/v3/integration/groups/GET-groups_groupId_invites.test.js on lines 94..111
test/api/v3/integration/groups/GET-groups_groupId_invites.test.js on lines 132..149

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

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('returns an error if req.query.limit is not an integer', async () => {
    const { group, groupLeader: leader } = await createAndPopulateGroup({
      groupDetails: {
        type: 'guild',
        privacy: 'private',
test/api/v3/integration/groups/GET-groups_groupId_invites.test.js on lines 94..111
test/api/v3/integration/groups/GET-groups_groupId_invites.test.js on lines 113..130

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

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('fails if user doesn\'t have access to the group', async () => {
    const group = await generateGroup(user, { type: 'party', name: generateUUID() });
    const anotherUser = await generateUser();
    await expect(anotherUser.get(`/groups/${group._id}/invites`)).to.eventually.be.rejected.and.eql({
      code: 404,
test/api/v3/integration/groups/GET-groups_groupId_members.test.js on lines 41..49

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

    expect(res[0]).to.eql({
      _id: invited._id,
      id: invited._id,
      profile: { name: invited.profile.name },
      auth: {
test/api/v3/integration/challenges/GET-challenges_challengeId_members.test.js on lines 59..71
test/api/v3/integration/challenges/GET-challenges_challengeId_members.test.js on lines 79..91
test/api/v3/integration/groups/GET-groups_groupId_members.test.js on lines 56..68

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

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

  it('fails if group doesn\'t exists', async () => {
    await expect(user.get(`/groups/${generateUUID()}/invites`)).to.eventually.be.rejected.and.eql({
      code: 404,
      error: 'NotFound',
      message: t('groupNotFound'),
test/api/v3/integration/challenges/GET-challenges_challengeId_members.test.js on lines 17..23
test/api/v3/integration/challenges/GET-challenges_challengeId_members.test.js on lines 25..31
test/api/v3/integration/challenges/GET-challenges_challengeId_members_memberId.test.js on lines 16..22
test/api/v3/integration/challenges/GET-challenges_challengeId_members_memberId.test.js on lines 24..30
test/api/v3/integration/challenges/POST-challenge_flag.test.js on lines 29..36
test/api/v3/integration/challenges/POST-challenge_flag_clear.test.js on lines 32..39
test/api/v3/integration/challenges/POST-challenge_flag_clear.test.js on lines 41..48
test/api/v3/integration/groups/GET-groups_groupId_members.test.js on lines 33..39
test/api/v3/integration/tasks/GET-tasks_challenge_challengeId.test.js on lines 46..52
test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 44..50
test/api/v3/integration/tasks/POST-tasks_move_taskId_to_position.test.js on lines 14..20
test/api/v3/integration/tasks/POST-tasks_move_taskId_to_position.test.js on lines 22..28
test/api/v3/integration/tasks/POST-tasks_unlink-one_taskId.test.js on lines 63..70
test/api/v3/integration/tasks/challenges/DELETE-tasks_id_challenge_challengeId.test.js on lines 30..36
test/api/v4/inbox/DELETE-inbox_messages_messageId.test.js on lines 37..44
test/api/v4/news/DELETE-news.test.js on lines 31..37
test/api/v4/news/GET-news_id.test.js on lines 22..28
test/api/v4/news/PUT-news_newsId.test.js on lines 33..39

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

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

    const res2 = await user.get(`/groups/${group._id}/invites?lastId=${res[res.length - 1]._id}`);
test/api/v3/integration/challenges/GET-challenges_challengeId_members.test.js on lines 193..193
test/api/v3/integration/groups/GET-groups_groupId_members.test.js on lines 231..231

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

There are no issues that match your filters.

Category
Status