Skip to content

Commit

Permalink
[webview_flutter] Make WebKitWebViewWidget unit tests stateless (flut…
Browse files Browse the repository at this point in the history
…ter#6228)

This eliminates the state in the Dart unit tests for this class, bringing it into alignment with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#make-each-test-entirely-self-contained.
- `testController` is now returned by `buildWidget`, which clarifies and enforces that the variable can only be used after `buildWidget` is called
- All the mocks are now in a data object that is created via a `configureMocks` call in each test.

The latter will allow easily adjusting specific mocks in individual tests (vs having to create a new group that has an almost-identical duplicate of `setUp`, but with slight changes) which will be useful when adding macOS support, where the mock `WKWebView` will need to be a different class when testing macOS/iOS codepath divergence.
  • Loading branch information
stuartmorgan committed Mar 4, 2024
1 parent 0625827 commit 05f97df
Showing 1 changed file with 341 additions and 208 deletions.
Loading

0 comments on commit 05f97df

Please sign in to comment.