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

Update batchLink tests to use fake timers #10612

Merged
merged 3 commits into from
Mar 3, 2023

Conversation

TrevinAvery
Copy link
Contributor

Checklist:

  • If this PR contains changes to the library itself (not necessary for e.g. docs updates), please include a changeset (see CONTRIBUTING.md)
  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests

The batchLink.ts tests would fail intermittently when running all tests in parallel locally. I believe this is because the timers were queuing up because they couldn't run immediately. Switching them to use fake timers should make them more consistent.

Note: There is one test that is still using real timers because I could not get it to pass with fake timers. For some reason, the functions passed to subscribe would always get called after the timers completed, no matter how long they were. I'm not sure why.

@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2023

⚠️ No Changeset found

Latest commit: 8145d7e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@alessbell alessbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @TrevinAvery! This LGTM ✅ I was curious about the batch interval test, I hope you don't mind I pushed to your branch with a small update so it now uses jest.runOnlyPendingTimers(). Really appreciate the thought that went into this 🎉

@alessbell alessbell merged commit 260914a into apollographql:main Mar 3, 2023
gastonmorixe added a commit to rocketreferrals/apollo-client that referenced this pull request Mar 10, 2023
commit 72b222e
Merge: def116b afccbdb
Author: Gaston Morixe <gaston@gastonmorixe.com>
Date:   Fri Mar 10 18:23:57 2023 -0300

    Merge branch 'main' into gm/fix/merge-function-called-before-deepmerge-sep202022

commit afccbdb
Author: Trevin Avery <TrevinAvery@gmail.com>
Date:   Wed Mar 8 11:18:47 2023 -0800

    Fix snapshot with non-ascii character (apollographql#10611)

commit 02605bb
Author: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
Date:   Wed Mar 8 10:18:29 2023 +0100

    `useQuery`: delay unsubscribe to fix race conditions (apollographql#10629)

    * add test for current behavior
    * add failing test for polling
    * slightly delay unsubscribe
    * adjust tests to new behavior

commit 355dce8
Author: Jeff Auriemma <bignimbus@users.noreply.github.com>
Date:   Tue Mar 7 11:47:45 2023 -0500

    Bump date in roadmap

commit 3b504f7
Author: Jeff Auriemma <bignimbus@users.noreply.github.com>
Date:   Tue Mar 7 11:41:42 2023 -0500

    Update dates and notes for upcoming releases

commit c4daaf6
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon Mar 6 15:34:20 2023 -0500

    chore(deps): update dependency graphql-ws to v5.12.0 (apollographql#10625)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Alessia Bellisario <alessia@apollographql.com>

commit 88993a2
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon Mar 6 14:02:53 2023 -0500

    chore(deps): update dependency @types/node to v18.14.6 (apollographql#10622)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit aa81522
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon Mar 6 14:01:45 2023 -0500

    chore(deps): update dependency rimraf to v4.3.0 (apollographql#10623)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit e4fb0ca
Author: Henry Q. Dineen <henryqdineen@users.noreply.github.com>
Date:   Fri Mar 3 12:14:58 2023 -0500

    remove obsolete @types/fast-json-stable-stringify dev dep (apollographql#10617)

commit 260914a
Author: Trevin Avery <TrevinAvery@gmail.com>
Date:   Fri Mar 3 08:43:01 2023 -0800

    Update batchLink tests to use fake timers (apollographql#10612)

    * Update batchLink tests to use fake timers

    * fix: refactor batch interval test to support fake timers

    ---------

    Co-authored-by: Alessia Bellisario <alessia@apollographql.com>

commit ebee40b
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Fri Mar 3 10:49:59 2023 -0500

    chore(deps): update dependency eslint to v8.35.0 (apollographql#10613)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 5161f09
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu Mar 2 17:41:57 2023 -0700

    chore(deps): update dependency @types/node to v18.14.4 (apollographql#10602)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 7823843
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu Mar 2 17:31:57 2023 -0700

    chore(deps): update cimg/node docker tag to v19.7.0 (apollographql#10605)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit f8fed6b
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu Mar 2 16:59:56 2023 -0700

    chore(deps): update dependency @babel/parser to v7.21.2 (apollographql#10606)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit e9f0dd5
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu Mar 2 16:45:50 2023 -0700

    chore(deps): update dependency @types/glob to v8.1.0 (apollographql#10607)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit bbb04b0
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu Mar 2 16:32:10 2023 -0700

    chore(deps): update dependency terser to v5.16.5 (apollographql#10603)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit f9868b8
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu Mar 2 16:03:25 2023 -0700

    chore(deps): update dependency @typescript-eslint/eslint-plugin to v5.54.0 (apollographql#10608)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit ef13979
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu Mar 2 15:43:19 2023 -0700

    chore(deps): update jaywcjlove/github-action-package action to v1.3.1 (apollographql#10604)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit e6d552f
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu Mar 2 15:33:26 2023 -0700

    chore(deps): update dependency @typescript-eslint/parser to v5.54.0 (apollographql#10609)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit def116b
Merge: a32e0d2 6bd651b
Author: Gaston Morixe <gaston@gastonmorixe.com>
Date:   Tue Sep 20 11:57:40 2022 -0500

    Merge tag 'v3.6.8' into gm/fix/merge-function-called-before-deepmerge-sep202022

commit a32e0d2
Author: Gaston Morixe <gaston@gastonmorixe.com>
Date:   Tue Mar 8 17:38:31 2022 -0300

    custom version

commit 42a20f8
Author: Gaston Morixe <gaston@gastonmorixe.com>
Date:   Tue Mar 8 17:07:12 2022 -0300

    increatese maxSize to 28.65

commit 045a9d5
Author: Gaston Morixe <gaston@gastonmorixe.com>
Date:   Mon Mar 7 18:35:02 2022 -0300

    Run Policies's merge before cache merge

    adds test

    fix formatting
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants