Skip to content
This repository was archived by the owner on Jan 14, 2020. It is now read-only.
This repository was archived by the owner on Jan 14, 2020. It is now read-only.

Tests should be (more) self-contained #245

Open
@tyleryasaka

Description

@tyleryasaka

Our current tests are not self-contained. Meaning, some of the tests use "global" state, which means the test results can vary depending on how many times they've been run, the order they've been run, etc.

More specifically, the global state is the local blockchain instance. It gets started when the server is started, and then just stays running. This is especially unpredictable for the browser tests, because the blockchain gets started with npm start. You can run the browser tests over and over from there (which is convenient during development). Each time you run the tests, new contracts get created. These contracts can affect following tests.

The specific issue I ran into is that the notifications tests take longer and longer after each test run. After just 4 or 5 they start exceeding the 10ms timeout, and fail.

Anyone should be able to reproduce this:

  1. run the browser tests on localhost:8081
  2. wait for them to finish
  3. reload the page
  4. repeat
  5. watch as the length of the notifications tests increases after every test run. Soon they will exceed 10ms.

We have a couple of options:

  • reset the entire blockchain before each test run
  • provide a test helper for re-deploying our persistent contracts (e.g. listings registry), which is effectively the same as a reset.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions