sourcecred/src
Dandelion Mané 10f704ebd2
Use AppStateTransitionMachine to drive App (#583)
Pull #579 reifies the cred explorer state as an explicit state
transition machine, with a well-tested implementation. This pull
re-writes `credExplorer/App.js` to use that implementation, and thoroughly
tests it.

The result is that `credExplorer/App.js` has much simpler code
(because it just binds the rendered components to the state machine),
and is much more thoroughly tested.

To ensure easy testability of the `App` class, it was refactored so that
the module exports a factory function which takes a method for creating
the `AppStateTransitionMachine` and returns an `App` class. This ensures
that in test code, we can easily mock the state transition machine. This
had no effect on external callers, since the higher-level `<AppPage>`
class, which already wraps over `LocalStore` choice, was already the
preferred call site.

I also added a loading indicator component, which presently displays a
status text corresponding to the state, such as "Loading graph...", or
"Error while running PageRank". This way, there is always some user
feedback during loading states (which could take a while).

Test plan:
Visual inspection, and the very thorough included unit tests.
2018-08-02 20:16:55 -07:00
..
app Use AppStateTransitionMachine to drive App (#583) 2018-08-02 20:16:55 -07:00
cli CLI takes repo strings as `owner/name` (#559) 2018-07-27 23:44:41 -07:00
core Create a Repo type and use throughout the project (#555) 2018-07-27 21:30:50 -07:00
graphql Create a Repo type and use throughout the project (#555) 2018-07-27 21:30:50 -07:00
plugins Create a Repo type and use throughout the project (#555) 2018-07-27 21:30:50 -07:00
tools Log error contents on promise rejection (#345) 2018-06-05 11:15:13 -07:00
util Extract `dedent` to `util`, adding tests (#538) 2018-07-27 12:30:28 -07:00