perun-network / erdstall-ts-sdk

TypeScript client SDK to interact with Erdstall.
Apache License 2.0
5 stars 2 forks source link

Extend and adapt end to end test for tutorial purposes #132

Closed ndzik closed 2 years ago

ndzik commented 2 years ago

Sooo, this obviously requires https://github.com/perun-network/erdstall-ext/pull/111 to be merged before.

What changed:

  1. Test structure: 1.1 The Teststructure now involves a test harness. This harness is similar to our generic tests but not really generic, which is why I named it like this. It accepts a struct of type SDKActions. These actions implement the bare SDK usage unrelated to the end to end test itself which allowed me to separate it from the ugly and unfriendly testsetup. 1.2 Testharness: The test harness sets up the operator and has some added assertions and tests which not only call methods but also inspect the outcomes. 1.3 SDKActions: The SDKActions are meant to be our tutorial. It includes a lot of usage examples with additional notes and is 99.9% free of test-specific logic, which makes it a breeze to read (IMO). 1.4 Ganache: Instead of generating the accounts using the MNEMONIC, we just ask ganache to return us the appropriate Signers for the prefunded accounts. This results in the same accounts as before. I changed this behavior because I wanted a single source of truth, which is easy to manipulate on Go and TS side.
  2. SDK extension: 2.1 The SDK now properly implements the PhaseShift event. I discussed this with @rmbrt earlier and we both agree that the way we implemented the phaseshift logic before was wrong and out of necessity.
  3. Bugfix: 3.1 The tokenprovider had a bug where it did not return a rejected promise. This lead to unexpected behavior which was fun to debug in the context of this PR...
  4. There is probably more which just slipped my mind.