light-client icon indicating copy to clipboard operation
light-client copied to clipboard

dApp: Refactor RaidenService module

Open weilbith opened this issue 5 years ago • 0 comments

Description

As pointed out in the conversation of #2186 the team has agreed to refactor the RaidenService.ts module. The tests for this module have become so messy, that nobody has neither an overview, nor understand what actually happens in terms of mocking. Moreover have the recent design adjustments to the notifications shown that also extending the RaidenServices module itself has become quite cumbersome. Also does the CodeClimate tool complain that this module and especially the connect() function are too huge and complex. Everyone working on this module only tries to make it working. Therefore we need to rework it, so productive and meaningful work is possible again.

Although this issue description should not do the work to identify the details what needs to be done how, here are some items the team has already discussed:

  • split the connect function into meaningful abstracted function calls that read easy
  • split logic from data
  • export/move pure and/or independent functions
  • establish a logical function for the notifications, export all notification converter functions to another module and establish an event to notification mapping
  • get rid of endless if-else cases

Acceptance criteria

  • RaidenService module is readable, provides a good overview, has been cleaned up and is easy to extend (Open-Close-Principle, Single-Responsibility-Principle, ...)
  • The unit tests for the RaidenService have become useful, the tester understands them and it is easy to add test cases for new features

Tasks

  • [ ]

weilbith avatar Oct 12 '20 12:10 weilbith