[RNMobile] Audio block URL Parser unit tests#31920
Conversation
|
Size Change: 0 B Total Size: 1.62 MB ℹ️ View Unchanged
|
|
@fluiddot the failing tests here are flaky as I have re-run them several times. Since these changes are restricted to |
packages/components/src/mobile/audio-player/audio-url-parser.native.js
Outdated
Show resolved
Hide resolved
| .split( '/' ) | ||
| .pop(); | ||
| const parts = fileName.split( '.' ); | ||
| const extension = parts.length === 2 ? parts.pop().toUpperCase() + ' ' : ''; |
There was a problem hiding this comment.
I see that if the file contains an extension. we're adding an extra blank space at the end of the string, what's the reason for this?
There was a problem hiding this comment.
Ah, yes, I decided to add a space here because there are times when the extension isn't present but if it is I need to add the space here so within the UI itself the extension doesn't get attached to the audio file Text in the UI. For more context, see this comment #27817 (comment)
There was a problem hiding this comment.
Oh ok, I'm wondering if the extra space should be handled then in the component instead since it's specific to how to render it, wdyt? My first impression was that this method was agnostic to the component but maybe since it's located under the same folder makes sense to include it 🤔 .
There was a problem hiding this comment.
You are right about the component handling this especially since it's UI-related. I could create another small PR to resolve this since this PR solved the main need which was to add the tests 😄
packages/components/src/mobile/audio-player/test/audio-url-parser.native.js
Outdated
Show resolved
Hide resolved
packages/components/src/mobile/audio-player/test/audio-url-parser.native.js
Outdated
Show resolved
Hide resolved
packages/components/src/mobile/audio-player/test/audio-url-parser.native.js
Show resolved
Hide resolved
…lock-IV-from-url-unit-tests
|
Thanks for such a thorough review @fluiddot I implemented the changes you requested. This PR is ready for another round 🙇🏾 |
wordpress-mobile/gutenberg-mobile#3524
Description
Refactored the URL parsing logic within the
audio-player. It was moved to another file so it could be testable. Once that was done, unit tests were written for the different URL variations that are supported.How has this been tested?
Insert From URLflow in the audio block's media upload selection works with the refactored URL parsing component.npm run test-unit:nativeand they all passed.Screenshots
Types of changes
Checklist:
*.native.jsfiles for terms that need renaming or removal).