Commit Graph

825 Commits

Author SHA1 Message Date
Dandelion Mané 56c17d2597
Implement AppState and StateTransitionMachine (#579)
The cred explorer app has a variety of valid states. Currently, it is
thrown together without explicit documentation of what its states are,
how they transition, or error handling or testing. I worry that this
will be hard to maintain.

This commit creates the AppState type which explicitly reifies every
reachable state for the app, and a StateTransitionMachine which handles
transitions between states. The transitions are thoroughly tested,
including edge cases where the user makes a change while waiting for a
promise to resolve, or where one of the promises failes.

Test plan:
The unit tests are comprehensive. `yarn test` passes.

Thanks to @wchargin for much discussion about how to structure the
states.
2018-08-02 19:18:33 -07:00
William Chargin 038d166972
Link to `CONTRIBUTING.md` from the README (#585)
Summary:
The information currently in the README is helpful but incomplete. We
now have a `CONTRIBUTING.md` guide, so we can simply link to that.

Test Plan:
None.

wchargin-branch: contributing-md-readme
2018-08-02 13:58:06 -07:00
Claire L fa66c7ba80
Rename "Explore(r)" to "Prototype" in route and navigation (#584)
"Explore(r)" does not accurately convey the current state of the
project. In order to more accurately convey the current state,
"Explore(r)" has been updated to "Prototype"

Addresses #584

Test plan: Visual inspection and manual testing of pathing
2018-08-02 13:17:33 -07:00
Claire L 8e653403dc
Better navbar styling and external project links
Currently, the navbar lacks styling, and only provides links to the home and explorer pages.
This change adds:
* Better styling for the navbar
* External links to SourceCred github and twitter
Test plan: visual inspection
2018-08-02 12:20:51 -07:00
William Chargin ee93f4aa01
Write `CONTRIBUTING.md` (#574)
Summary:
Having a guide for contributors makes the experience more pleasant for
everyone. In the best case, contributors read the guide and submit
perfect PRs. In the event that a discrepancy occurs, we can gently point
the contributor to the guide—saving us from having to re-explain common
pitfalls, and signaling to the contributor that this is a matter of
practice and that we are not “out to get them”.

This guide, like all documentation, is intended to evolve over time.

Test Plan:
None.

wchargin-branch: contributing-md
2018-08-02 12:16:35 -07:00
William Chargin 9d5c4454c5
Remove `src/app/public` (#582)
Summary:
This subtree has no effect on the new build process; it contains only
stale code.

Test Plan:
Running `yarn test --full` passes. Running `yarn build` and running an
HTTP server on the result indicates the expected behavior, as does
running `yarn start`. A quick `git grep public` finds no amok results.

wchargin-branch: remove-public
2018-07-31 21:45:25 -07:00
Dandelion Mané 56f0b8b1b9
Streamline the cred explorer UI (#581)
This commit removes some unecessary text and whitespace from the cred
explorer. The result is more minimal. It's not super pretty, but that
will come later.

Test plan: Visual inspection
2018-07-31 19:59:37 -07:00
William Chargin 48275590ba
Remove `clean-webpack-plugin` (#578)
Summary:
As of #577, this is no longer needed.

Test Plan:
Running `yarn && yarn test --full` suffices.

wchargin-branch: remove-clean-webpack-plugin
2018-07-31 19:10:03 -07:00
William Chargin 480bdf1bc7
Refine the build directory cleaning logic (#577)
Summary:
We were asking the `clean-webpack-plugin` to remove the `build/`
directory in all cases. However, Webpack accepts a command-line
parameter `--output-path`. When such a parameter is passed, we would be
removing the wrong directory.

The proper behavior is to remove “whatever the actual output path is”.
Webpack exposes this information, but it appears that the
`clean-webpack-plugin` does not take advantage of it. Therefore, this
commit includes a small Webpack plugin to do the right thing.

Test Plan:
Test that the behavior is correct when no output directory is specified:
```
mkdir -p build && touch build/wat && yarn build && ! [ -e build/wat ]
```

Test that the behavior is correct with an explicit `--output-path`:
```
outdir="$(mktemp -d)" && touch "${outdir}/wat" && \
    yarn build --output-path "${outdir}" && \
    ! [ -e "${outdir}/wat" ]
```

Test that the plugin refuses to remove the root directory:

```
! yarn build --output-path . && \
    sed -i '/path: /d' config/makeWebpackConfig.js && ! yarn build
```

(Feel free to comment out the actual `rimraf.sync` line in the plugin
when testing this.)

wchargin-branch: clean-actual-build-directory
2018-07-31 15:27:32 -07:00
Dandelion Mané 8009cd279b
Remove graph node and edge count (#575)
This commit removes the node and edge counts that are displayed on the
cred explorer. While this is nice information to surface, I think it's
currently surfaced in the wrong place: it should be displayed as part of
the PagerankTable.

My proximate motivation for removing it is that it cleans up the data
structure slightly and I'm about to intensively refactor the whole file.

Test plan: `yarn test`; also, I manually engaged the cred explorer and
it still works properly.
2018-07-31 13:26:53 -07:00
William Chargin dbf5caa08f
Permit STOPSHIPs in Markdown files (#573)
Summary:
This way, we can document what STOPSHIPs are without having to tip-toe
around the phrase.

Test Plan:
Add `STOPSHIP` to `README.md`, and note that `yarn test` fails before
this change but passes after it.

wchargin-branch: stopship-markdown-okay
2018-07-31 10:58:29 -07:00
William Chargin 2af2fe3b43
Add a template for pull requests (#572)
Summary:
By pre-filling the “summary” and “test plan” fields, we create a strong
suggestion that people fill them out.

I’ve written this template in accordance with Phabricator commit style
(which is also what I use personally). I don’t intend for this to be
normative. It is perfectly valid to leave off the “Summary” header, for
instance, and it is perfectly valid to spell “Test Plan” with a
lowercase “p”. However, for a template in particular I think that
including the “Summary” header is better than excluding it, to give
contributors an idea of what’s supposed to go there.

I expect that upon drafting a pull request with a single commit, the
commit’s body, if non-empty, will take precedence over the pull request
template. If this is not the case, then we can reconsider whether we
want to include this template.

Test Plan:
Note that [GitHub documentation][1] indicates that this is the correct
file path. Then, merge and hope for the best.

[1]: https://blog.github.com/2016-02-17-issue-and-pull-request-templates/

wchargin-branch: pull-request-template
2018-07-31 10:53:35 -07:00
William Chargin 3b5ad594bd
package.json: reorganize test commands (#571)
Summary:
Running `yarn test` (equiv. `npm test` or `npm run test`) now runs all
checks. It takes the place of the former `yarn travis`. This is more in
line with the expectation of a top-level `test` command: if it passes,
your code is good.

The `unit` command now runs Jest once, not in watch mode. It takes the
place of the former `ci-test`. To run tests in watch mode, run any of
the following:

  - `yarn unit --watch`, or
  - `npm run unit -- --watch`, or
  - `npm unit -- --watch`.

This behavior is more consistent with the standard behavior of commands
like `make test`. It is also empirically what @wchargin and
@decentralion want most of the time.

Test Plan:
Verify that each of the scripts `test`, `unit`, and `coverage` passes.
Verify that each of the aforementioned `--watch` invocations works.
Verify that `.travis.yml` has the correct `script:` command.

wchargin-branch: reorganize-test-command
2018-07-31 10:53:10 -07:00
William Chargin c1cb29b1e6
new-webpack: remove old scripts and configs (#570)
Summary:
These are no longer used.

Test Plan:
Both `yarn start` and `yarn build` still work.

wchargin-branch: webpack-remove-old
2018-07-30 18:14:37 -07:00
William Chargin 0128df8c18
new-webpack: replace old scripts in `package.json` (#569)
Test Plan:
Run `yarn start` and note that everything checks out.

Run `yarn build && (cd build/ && python -m SimpleHTTPServer)` and note
that everything checks out, except that the static assets are of course
not included in the build.

wchargin-branch: webpack-replace-scripts
2018-07-30 18:10:54 -07:00
William Chargin b45ef739fe
new-webpack: clean `build/` before prod (#568)
Summary:
In our current system, we build by invoking `scripts/build.js`, which
begins by removing the `build/` directory. This behavior is nice,
because it prevents cross-contamination between builds. In this commit,
we add a plugin to achieve the same result from directly within Webpack.

Test Plan:
Run

```
mkdir -p ./build
touch ./build/wat
NODE_ENV=production node ./node_modules/.bin/webpack \
    --config config/makeWebpackConfig.js
```

and ensure that `./build/wat` does not exist after the build completes.

wchargin-branch: webpack-clean-build
2018-07-30 18:01:47 -07:00
William Chargin 1d48bf9390
new-webpack: serve static files (#567)
Summary:
This commit makes the Webpack dev server fully functional under the new
config, by serving the static SourceCred directory via a piece of
injected middleware.

Test Plan:
Run

```
NODE_ENV=development node ./node_modules/.bin/webpack-dev-server \
    --config config/makeWebpackConfig.js
```

and navigate to the cred explorer. Note that the repository registry is
fetched, and the whole cred explorer works.

wchargin-branch: webpack-statics
2018-07-30 17:29:34 -07:00
William Chargin 37eddcaf27
new-webpack: only minify in prod (#566)
Summary:
Extraction of the plugin list to a function is mostly trivial, but
requires a novel `// $ExpectFlowError`. The error has been there the
whole time, but Flow only catches it now. Why? Who knows.

Test Plan:
Run

```
NODE_ENV=development node ./node_modules/.bin/webpack-dev-server \
    --config config/makeWebpackConfig.js
```

Note that the compilation/recompilation time is much faster than
previously.

wchargin-branch: webpack-minify-prod-only
2018-07-30 17:11:30 -07:00
William Chargin fca43f4362
new-webpack: allow running in dev (#565)
Summary:
In addition to simply disabling the prod-only check, we apply a
workaround for a known bug that breaks static site generation in Webpack
versions >= 2.0.

Test Plan:
Run

```
NODE_ENV=development node ./node_modules/.bin/webpack-dev-server \
    --config config/makeWebpackConfig.js
```

and visit http://localhost:8080/webpack-dev-server/ (note the trailing
slash) or just http://localhost:8080/. Expect the server to be slow, as
it is actually building for production.

wchargin-branch: webpack-enable-dev
2018-07-30 16:26:13 -07:00
William Chargin 7bf0ed3c84
new-webpack: functionize (#564)
Summary:
This will enable us to differentiate the production and development
behavior where necessary (primarily, only running minification in prod).

Best reviewed with `git show -w`.

Test Plan:
The diff with `git show -w` and the fact that `yarn flow` passes should
be sufficient. If you really want to be thorough, run Webpack with this
config file and `NODE_ENV` set to `production`.

wchargin-branch: webpack-functionize
2018-07-30 16:22:55 -07:00
William Chargin e2a94c2aa8
new-webpack: add Flow typing (#563)
Summary:
There really should be an `// $ExpectFlowError` on the dynamic `require`
on line 182:

```js
      paths: require(paths.appRouteData).routeData.map(({path}) => path),
```

However, for some reason Flow does not catch this error now, so adding a
suppression comment generates an “unused suppression” warning. We
therefore omit the suppression in this commit; we will add it later,
once Flow magically finds the error.

Test Plan:
`yarn flow` reports no errors; a deliberately introduced error is
properly caught.

wchargin-branch: webpack-flow
2018-07-30 16:19:21 -07:00
William Chargin 8dec3aa61b
new-webpack: copy prod config to new shared config (#562)
Summary:
This module will become the shared home of the production and
development configurations.

Test Plan:
Run:

```
rm -r build/
NODE_ENV=production node node_modules/.bin/webpack \
    --config config/makeWebpackConfig.js
(cd build && python -m SimpleHTTPServer)
```

and load http://localhost:8000. Note that the main content of app still
works, although the static assets in the SourceCred directory are not
loaded so the useful functionality is crippled.

wchargin-branch: webpack-init
2018-07-30 16:15:30 -07:00
William Chargin e492965c12
Treat plugin adapters generically in `App` (#560)
Test Plan:
Unit tests pass, and manual testing indicates that graph loading works.

wchargin-branch: generic-plugin-adapters
2018-07-28 11:24:06 -07:00
Dandelion Mané 3266eb31fa
CLI takes repo strings as `owner/name` (#559)
Test plan:
```
$ yarn backend
$ node bin/sourcecred.js load sourcecred/sourcecred
```
2018-07-27 23:44:41 -07:00
Dandelion Mané 4406c96c95
Create a Repo type and use throughout the project (#555)
Our data model orients on getting repos from GitHub, which are
alternatively represented as strings like "sourcecred/sourcecred", or
pairs of variables representing the owner and name, or objects with
owner and name properties. We also have a few different implementations
of repo validation, which are not applied consistently.

This commit changes all that. We now have a consistent Repo type which
is an object containing a string owner and string name. Thanks to a
clever suggestion by @wchargin, it is implemented as an opaque subtype
of an object containing those properties, so that the only valid way to
construct a Repo typed object is to use one of the functions that
consistently validates the repo.

As a fly-by fix, I noticed that there were some functions in the GitHub
query generation that didn't properly mark arguments as readOnly. I've
fixed these.

Test plan: No externally-observable behavior changes (except insofar as
there is a slight change in variable names in the GitHub graphql query,
which has also resulted in a snapshot diff). `yarn travis --full`
passes. `git grep repoOwner` presents no hits.
2018-07-27 21:30:50 -07:00
Dandelion Mané dd09e28d6e
Make deploy script wait for valid response (#557)
Currently, any non-yes keystroke causes the deply script to abort.
This is frustrating, as it may take the user several minutes of waiting
to get to the prompt, only to have the program inadvertently terminate.

As of this change, the deploys script patiently re-prompts until it gets
a valid input.

Paired with @wchargin.

Test plan: Ran locally and tested the yes, no, and invalid response
cases. Also ran the script through shellcheck.
2018-07-27 21:30:20 -07:00
Dandelion Mané 81ccda773a
Deploy script adds necessary CNAME file (#558)
The CNAME file is needed so that our custom domain will continue working
after deploys.

Test plan:
- Verified that the generated build now includes the cname file.
- Verified that if a CNAME file is already present, the script will
fail.

Paired with @wchargin
2018-07-27 21:22:39 -07:00
William Chargin bdb9ae9c46
Demonstrate the GitHub token env var in the README (#556)
Summary:
Using the environment variable is the preferred way to interact with the
CLI, simply because it’s easier for users. We should demonstrate this
interface instead of the legacy flag-only version.

Paired with @decentralion.

wchargin-branch: readme-env-var
2018-07-27 20:59:54 -07:00
William Chargin 68fa7237a0
Add external link to Discord invite (#551)
Test Plan:
None really needed—the infrastructure has already been tested—but you
can verify that this works both under `yarn start` and `yarn build` by
navigating to the evident URL.

wchargin-branch: discord-invite
2018-07-27 20:18:22 -07:00
William Chargin 8e062592ae
Add external redirect infrastructure (#550)
Summary:
This patch extends our routing infrastructure to add support for
_external_ redirects. It does not include dedicated support for
site-internal redirects.

Test Plan:
Add an external redirect to `routeData`, like the following:

```diff
diff --git a/src/app/routeData.js b/src/app/routeData.js
index 83dff72..eaba130 100644
--- a/src/app/routeData.js
+++ b/src/app/routeData.js
@@ -36,6 +36,15 @@ const routeData /*: $ReadOnlyArray<RouteDatum> */ = [
     title: "SourceCred explorer",
     navTitle: "Explorer",
   },
+  {
+    path: "/discord-invite",
+    contents: {
+      type: "EXTERNAL_REDIRECT",
+      redirectTo: "https://discord.gg/tsBTgc9",
+    },
+    title: "SourceCred Discord invite",
+    navTitle: null,
+  },
 ];
 exports.routeData = routeData;

```

Then:
  - run `yarn build`, and:
     - verify that the appropriate `index.html` file is correctly
       generated;
     - verify that opening the `index.html` file in a browser redirects
       you to the appropriate destination, even with JavaScript
       disabled;
     - verify that the link in the body of the HTML page is correct
       (easier to do if you remove the `<meta>` tag)
  - run `yarn start`, and:
    1. use the React DevTools to change the “Explorer” link’s `to` prop
       from `/explorer` to `/discord-invite`;
    2. click the link; and
    3. verify that you are properly redirected.

wchargin-branch: add-external-redirect
2018-07-27 19:13:51 -07:00
William Chargin 24a950629a
Add all available flow-typed libdefs (#548)
Summary:
Generated with `flow-typed install --skip --overwrite`.

Test Plan:
Amazingly, `yarn flow` passes. Go team.

wchargin-branch: add-libdefs
2018-07-27 17:23:24 -07:00
Dandelion Mané 49da7cfdb0
Display cred explorer scores as -Log(score) (#535)
@wchargin suggested displaying scores this way. This way, lowest scores
are best, and higher scores are worse. This is a little
counterintuitive, but maybe less counterintuitive than the current
approach, which arbitrarily adds 10 to scores to keep them non-negative,
and results in an arbitrary crossing point where scores become negative
without any particular significance.

Test plan: Travis, and manual inspection of the frontend.
2018-07-27 17:04:29 -07:00
William Chargin 873eca6350
Upgrade Flow to v0.76.0 (#546)
Summary:
In addition to a routine libdef update, we also need to work around a
particularly nasty new bug in Flow, which requires `any`-casts that are
even more unsafe than usual. That said, I think that it’s worth that
cost to remain up to date with Flow, so that we can amortize future such
issues.

Test Plan:
Running `yarn travis --full` passes.

wchargin-branch: upgrade-flow-v0.76.0
2018-07-27 15:54:59 -07:00
Dandelion Mané e669e89315
RepositorySelect displays NO_REPOS on 404 (#547)
Test plan: Unit tests included, plus I manually tested it.
2018-07-27 15:47:15 -07:00
Dandelion Mané 0b0815eb12
When repo registry fails, error to console (#544)
Some slight changes were needed to the other test code to avoid spurious
errors. Specifically, we now always set up a mocked fetch response in
non-failure cases, even if we don't wait for it to resolve.

Test plan: I manually tested it, also see the new unit tests.
2018-07-27 15:42:18 -07:00
Dandelion Mané 126fdb69dc
Add default weights for node types (#543)
Modifies the PluginAdapter interface so that NodeTypes come with
default weights, and modify the WeightConfig so that it loads those
NodeTypes as the default weights.

The new weight choices are not super principled, but are clearly better
than the uniform default. Now, projects find that most pull requests are
more valuable than most git blobs. :)

Sadly, the WeightConfig does not yet have any tests, so there are no
test changes.

Test plan: I manually verified that it works as expected, by clearing
application data and reloading the cred explorer.
2018-07-27 15:34:11 -07:00
Dandelion Mané 294616b556
RepositorySelect tests verify no console errors (#545)
We should really do this as a matter of course on all frontend testing.
Not sure what the right pattern is for ensuring that.

Test plan: Travis
2018-07-27 15:32:47 -07:00
Dandelion Mané ec5b76a83d
Upgrade oclif packages to latest (#542)
This required adding a [files property] to the package.json,
otherwise oclif started complaining.

Test plan: I manually tested both CLI commands, and they seem fine.

[files property]: https://docs.npmjs.com/files/package.json#files
2018-07-27 14:32:30 -07:00
Dandelion Mané b61b8fbdb8
Improve error messages when GitHub query fails (#536)
Currently, the GitHub graph fetcher will characteristically fail if:
1. it times out GitHub's server
2. it triggers the semidocumented abuse detection mechanism

In case 1, an intelligible error is posted to the console. In case 2, it
produces an unintelligible TypeError, because the response is not a
valid GraphQL response (the error field is not populated; it has a
custom message instead).

As of this commit, we gracefully catch both cases, and print a message
to console directing the user to #350, which has context on GitHub query
failures. This new catch works because in case 2, the data field is
empty, so we now properly recognize `x.data === undefined` as an error
case.

Thanks to @wchargin for the investigatory work behind this commit.

Fixes #223.

Test plan:
We don't have unit tests that cover this case, but I did manually test
it by asking GitHub to fetch `ipfs/go-ipfs`, which consistently fails.
I also tested it by using an invalid length-40 GitHub API token.
2018-07-27 13:27:40 -07:00
Dandelion Mané deaba09d00
Upgrade react and react-dom to latest (#541)
Test plan: `yarn travis --full`, as well as thorough manual frontend
testing
2018-07-27 13:27:19 -07:00
Dandelion Mané 28a31cfcd6
Reorganize dependencies and devDependencies (#540)
This commit is a good faith effort to separate our dependencies (code
that SourceCred app or CLI require to run) from devDependencies (all
other deps) in our package.json.

We don't have any actual dependents, so it's hard to test this
distinction. Hence, it's a good faith effort.

Test plan:
`rm -r node_modules && yarn && yarn travis` works.
2018-07-27 12:38:40 -07:00
William Chargin 4058a3fd85
Extract `dedent` to `util`, adding tests (#538)
Summary:
There have been a couple of occasions on which we’ve considered using
it, but didn’t want to require from `app/`.

Test Plan:
Unit tests added, with full coverage.

wchargin-branch: extract-dedent
2018-07-27 12:30:28 -07:00
Dandelion Mané 6b13ab64a0
Remove unused tensorflowjs dependency (#539)
Test plan: Travis
2018-07-27 12:29:04 -07:00
Dandelion Mané 797fb6331d
Upgrade jest to 23.4.1 (#537)
Flow types regenerated via flow-typed install jest@23.4.1

Test plan: Travis
2018-07-27 12:28:04 -07:00
Dandelion Mané aa3382a8b2
Default to selecting last loaded repository (#531)
In #529, I made the cred explorer populate a dropdown with the list of
repositories that are available to explore. That dropdown defaults to
selecting the alphabetically first repository.

This has an unfortunate consequence in that it makes it impossible for
us to explicitly set a default - for example, we would like
sourcecred.github.io/explorer to show sourcecred/sourcecred by default,
but instead it shows example-git.

So that we can choose the default, I've changed the logic so that it
instead shows the most-recently-loaded data first. This required
a breaking change to the repoRegistry serialized format, so I've also
refactored the module to use compat, which I should have done from the
beginning.

Test plan:
Unit tests for the repo selector are updated. The CLI load command
unfortunately has no tests, so I manually tested that it always provides
the lastest repository last, and appropriately handles the case where
the same repository is loaded multiple times.
2018-07-27 10:33:15 -07:00
Dandelion Mané e845e8cbbc
Modify sourcecred.github.io's example repos (#533)
Showing our example-github and example-git repos on sourcecred.github.io
is not particularly interesting. Let's show ipfs/js-ipfs instead!

Since sourcecred/sourcecred is the last repo to load, as of #531 it will
be the default option.

Test plan: Dry run of deploy script
2018-07-26 21:57:43 -07:00
Dandelion Mané a0c07bf0d7
Import the sourcecred.github.io deploy script (#532)
This copies the deploy script from sourcecred/sourcecred.github.io into
the sourcecred/sourcecred repository. It's been modified to reflect the
fact that it is no longer run from within the sourcecred.github.io
repository.

We’re moving this script into the main SourceCred repository so that it
can be versioned in the same tree as everything else, and in particular
so that the hash-of-built-commit depends on the build script itself.

The script was originally created by @wchargin in
https://github.com/sourcecred/sourcecred.github.io/pull/1 at hash
e8bc5b669b31df34b439b194cb62af4fd9a789d8, subsequently modified in
https://github.com/sourcecred/sourcecred.github.io/pull/2 and
https://github.com/sourcecred/sourcecred.github.io/pull/3 and
https://github.com/sourcecred/sourcecred.github.io/pull/4

Paired with @wchargin

Test plan: Ran locally (on dry-run) and inspected output.
2018-07-26 21:05:18 -07:00
Dandelion Mané f110114833
Convert Explorer repository selection to dropdown (#529)
Context: The Cred Explorer loads data (currently on a per-repository
basis) that has previously been prepared by running the `sourcecred
load` cli command.

Currently, to select a repository to load, the user must manually type
the repository owner and name. This is a confusing UI, because it
suggests that any repository may be chosen, when in fact only repos
already loaded into the data store are available. The user is given no
feedback as to which repositories are valid options.

As of #516, the backend stores a registry listing available
repositories. This commit adds a `RepositorySelect` component which
loads the available from that registry, and makes them available in a
dropdown, in sorted order.

When the user manually selects one of the repositories, that selection
is persisted into localStorage and respected on future loads. If the
user hasn't made such a choice, then the first repository is selected by
default.

The implementation is highly influenced by testability considerations.
The default export, `<RepositorySelect onChange={} localStore={} />`, is
pretty straightforward. The `RepositorySelect` is somewhat cumbersome to
test because it asynchronously fetches data and then updates its state,
which affects the render output. So as to avoid testing inside async
react components wherever possible, I've factored out:

* `loadStatus`, which uses fetch and localStore to get the status of the
selector.
* `PureRepositorySelect`, which just renders a `Status`, such as
loading, failure, or valid
* `LocalStoreRepositorySelect`, which wraps the `PureRepositorySelect`
with logic to bind the repository select to localStore on change.

Test plan: Extensive unit tests were added. Also, to ensure that the
tests were testing the right thing, I manually tested:
- attempting to load invalid registry
- attempting to load with no registry
- attempting to load with empty registry
- loading without valid localStore
- changing the setting via dropdown
- loading from localStore after changing the dropdown

And all behavior was as expected.

Thanks to @wchargin for considerable help testing this PR.
2018-07-26 19:24:25 -07:00
Dandelion Mané e36a7c1af2
Fix a mistake in the implementation of #527 (#530)
Test plan: Travis
2018-07-26 18:32:34 -07:00
Dandelion Mané e06b88364e
Add jest-fetch-mock as dev dependency (#528)
Also add config/jest/setupJest.js so we can configure jest-fetch-mock

Test plan: I have verified that mocked fetch works as expected in a
downstream commit.
2018-07-26 15:08:14 -07:00