test(storage): ensure both standard localhost and Android localhost are handled #17484
+39
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add unit tests to ensure that
partsFromHttpUrl
does not return null for localhost URLs on all platforms.The PR #7003 fixed an issue where
refFromUrl
returns null when the URL is localhost, which is required when connecting to the Firebase emulator of the machine. While that fix works on all platforms that use the standardlocalhost
, it does not work on Android emulators, where the only way to connect to the machine of the emulator is by using the127.0.0.1
address, so #12047 patched it to work on Android as well.The PR #12047 was sent by me, and I just came across this code. I improved it a bit by:
localhost
and127.0.0.1
, so adding these two unit tests while removing these two PRs will cause the tests to fail as expected.localhost
and127.0.0.1
Related Issues
refFromUrl()
when using firebase storage emulator. Essentially, check10.0.2.2
domain as well. #12047Emulators vs Firebase Emulators?
It might be confusing, but by emulators I mean Android and iOS emulators, and by Firebase emulators I mean Firebase Local Emulator Suite.
To test and use Firebase fully, only the development machine without a real Android/iOS device and a Firebase project, the emulators are used to run the mobile app, and Firebase emulators are used on the development machine for local hosting, so the apps can connect to them locally.
All platforms, including iOS simulators, desktop, and web, need
localhost
to connect to Firebase emulators, while Android emulators need127.0.0.1
(special case).Checklist
//
).melos run analyze
) does not report any problems on my PR.Breaking Change