codedang icon indicating copy to clipboard operation
codedang copied to clipboard

[Bug]: Backend Test가 CI에서 통과되면 안되는데, 통과가 되는 버그가 존재합니다.

Open gyunseo opened this issue 7 months ago • 1 comments

Describe the bug

How to Reproduce

git checkout main

cd apps/backend
pnpm test
  270 passing (960ms)
  5 failing

  1) ProblemService
       deleteProblem
         should return deleted problem:
     TypeError: Cannot read properties of undefined (reading 'deleteMany')
      at ProblemService.deleteProblem (apps/admin/src/problem/problem.service.ts:517:31)
      at async Context.<anonymous> (apps/admin/src/problem/problem.service.spec.ts:265:22)

  2) GroupService
       getGroups
         should return a list of groups that showOnList is true:

      AssertionError: expected { …(2) } to deeply equal { …(2) }
      + expected - actual

             "id": 4
             "memberNum": 2
           }
         ]
      -  "total": 2
      +  "total": 4
       }
      
      at Context.<anonymous> (apps/client/src/group/group.service.spec.ts:136:27)

  3) SubmissionService
       getContestSubmisssions
         should return submissions:
     TypeError: Cannot read properties of undefined (reading 'findFirst')
      at SubmissionService.getContestSubmissions (apps/client/src/submission/submission.service.ts:646:44)
      at /workspace/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]_reflec_ijr7iadn7n5dxx67o5xooiutgy/node_modules/nestjs-otel/lib/tracing/decorators/span.js:19:26
      at NoopContextManager.with (/workspace/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/context/NoopContextManager.ts:31:15)
      at ContextAPI.with (/workspace/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/api/context.ts:77:42)
      at NoopTracer.startActiveSpan (/workspace/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/trace/NoopTracer.ts:98:27)
      at ProxyTracer.startActiveSpan (/workspace/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/trace/ProxyTracer.ts:51:20)
      at SubmissionService.PropertyDescriptor (/workspace/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]_reflec_ijr7iadn7n5dxx67o5xooiutgy/node_modules/nestjs-otel/lib/tracing/decorators/span.js:16:27)
      at Context.<anonymous> (apps/client/src/submission/submission.service.spec.ts:423:23)
      at processImmediate (node:internal/timers:478:21)

  4) SubmissionService
       getContestSubmisssions
         should throw exception if user is not registered to contest:

      AssertionError: expected promise to be rejected with 'NotFoundException' but it was rejected with 'TypeError: Cannot read properties of …'
      + expected - actual

      -TypeError: Cannot read properties of undefined (reading 'findFirst')
      +NotFoundException
      
  

  5) SubmissionService
       getContestSubmisssions
         should throw exception if contest doesn't have this problem:

      AssertionError: expected promise to be rejected with 'NotFoundException' but it was rejected with 'TypeError: Cannot read properties of …'
      + expected - actual

      -TypeError: Cannot read properties of undefined (reading 'findFirst')
      +NotFoundException
      
  



 ELIFECYCLE  Test failed. See above for more details.

와 같이 현재 local에서 mocha test를 돌리면, 에러가 나오는데, GitHub CI에서 잡히지 않습니다. 빨리 해결해야 될 문제로 보입니다.

Reproduction

Logs

270 passing (960ms) 5 failing

  1. ProblemService deleteProblem should return deleted problem: TypeError: Cannot read properties of undefined (reading 'deleteMany') at ProblemService.deleteProblem (apps/admin/src/problem/problem.service.ts:517:31) at async Context. (apps/admin/src/problem/problem.service.spec.ts:265:22)

  2. GroupService getGroups should return a list of groups that showOnList is true:

    AssertionError: expected { …(2) } to deeply equal { …(2) }

    • expected - actual

       "id": 4
       "memberNum": 2
      

      } ]

    • "total": 2
    • "total": 4 }

    at Context. (apps/client/src/group/group.service.spec.ts:136:27)

  3. SubmissionService getContestSubmisssions should return submissions: TypeError: Cannot read properties of undefined (reading 'findFirst') at SubmissionService.getContestSubmissions (apps/client/src/submission/submission.service.ts:646:44) at /workspace/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]_reflec_ijr7iadn7n5dxx67o5xooiutgy/node_modules/nestjs-otel/lib/tracing/decorators/span.js:19:26 at NoopContextManager.with (/workspace/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/context/NoopContextManager.ts:31:15) at ContextAPI.with (/workspace/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/api/context.ts:77:42) at NoopTracer.startActiveSpan (/workspace/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/trace/NoopTracer.ts:98:27) at ProxyTracer.startActiveSpan (/workspace/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/src/trace/ProxyTracer.ts:51:20) at SubmissionService.PropertyDescriptor (/workspace/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]_reflec_ijr7iadn7n5dxx67o5xooiutgy/node_modules/nestjs-otel/lib/tracing/decorators/span.js:16:27) at Context. (apps/client/src/submission/submission.service.spec.ts:423:23) at processImmediate (node:internal/timers:478:21)

  4. SubmissionService getContestSubmisssions should throw exception if user is not registered to contest:

    AssertionError: expected promise to be rejected with 'NotFoundException' but it was rejected with 'TypeError: Cannot read properties of …'

    • expected - actual

    -TypeError: Cannot read properties of undefined (reading 'findFirst') +NotFoundException

  5. SubmissionService getContestSubmisssions should throw exception if contest doesn't have this problem:

    AssertionError: expected promise to be rejected with 'NotFoundException' but it was rejected with 'TypeError: Cannot read properties of …'

    • expected - actual

    -TypeError: Cannot read properties of undefined (reading 'findFirst') +NotFoundException

 ELIFECYCLE  Test failed. See above for more details.

System Info

No response

Validations

gyunseo avatar Jul 01 '24 09:07 gyunseo