Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[shared_preferences] Test can detect that SharedPreferences is mocked. #4433

Closed
wants to merge 1 commit into from

Conversation

Hu1buerger
Copy link

@Hu1buerger Hu1buerger commented Oct 15, 2021

Checking wheter a integration test using shared_preferences as the
storage backend should be able to check that the current instance is mocked.

Not checking could result in overriding could override app runtime data
or calling [setMockInitialValues] could lead to overriding data from the
test.

closes #1

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@google-cla google-cla bot added the cla: yes label Oct 15, 2021
@Hu1buerger Hu1buerger force-pushed the sp_mock_checkable branch 2 times, most recently from 45861f5 to 869e4ba Compare October 16, 2021 11:44
Checking wheter a integration test using shared_preferences as the
storage backend should be able to check that the current instance is mocked.

Not checking could result in overriding could override app runtime data
or calling [setMockInitialValues] could lead to overriding data from the
test.

Updated pubspecVersion and changelog.md

closes #1

fixing formating

Merge to latest master
Bump compileSdkVersion to 31 (flutter#4432)
@stuartmorgan
Copy link
Contributor

closes #1

This is not correct; could you provide the correct issue link please?

It's not clear to me from the description here what problem this is solving—I'm not sure what the case is where you are mocking values but don't know that you are mocking values—so an issue with more details is needed here.

It's also not clear to me why this needs a new API, rather than checking SharedPreferencesStorePlatform.instance directly.

@Hu1buerger
Copy link
Author

@stuartmorgan Hu1buerger#1 here's the issue

@stuartmorgan
Copy link
Contributor

@stuartmorgan Hu1buerger#1 here's the issue

That's an issue in your own repository, not a Flutter issue, and it doesn't address the questions in my comment.

@stuartmorgan
Copy link
Contributor

Thank you for your contribution. I'm going to close this PR for now since there are outstanding comments, just to get this off our PR review queue. Please don't hesitate to submit a new PR if you have the time to address the review comments. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants