Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: be more exact when waiting for peers #866

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Commits on Sep 24, 2024

  1. test: be more exact when waiting for peers

    `waitForPeers`, a test helper, currently checks that the *number* of
    connected peers is expected. This has two problems:
    
    - If the number of connected peers is *more than needed*, it will never
      resolve.
    - If the *number* of connected peers is correct but the actual peers are
      different, the promise could resolve prematurely.
    
    This snippet highlights the problem:
    
    ```javascript
    const managers = await createManagers(3, t)
    const [a, b, c] = managers
    
    connectPeers(managers)
    
    await waitForPeers([a, c])
    ```
    
    I think this is a useful change on its own, but will also make [an
    upcoming change][0] easier.
    
    [0]: #865
    EvanHahn committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    eb6582e View commit details
    Browse the repository at this point in the history