Skip to content

Commit f0f8c46

Browse files
riteshshukla04uffoltzl
authored andcommitted
Added more test cases for URL (facebook#50768)
Summary: I forgot to add toString and protocol in test cases last time when we merged this facebook#50043 ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [INTERNAL][ADDED] More Test cases Pull Request resolved: facebook#50768 Test Plan: Tested with yarn jest Reviewed By: rshest, cipolleschi Differential Revision: D73169665 Pulled By: cortinico fbshipit-source-id: 1115c0ccce52a67663fcd60ef376ce7bde502d1f
1 parent e8ed016 commit f0f8c46

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

packages/react-native/Libraries/Blob/__tests__/URL-test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ describe('URL', function () {
5353
expect(url.pathname).toBe('/docs/path');
5454
expect(url.port).toBe('8080');
5555
expect(url.search).toBe('?query=testQuery&key=value');
56+
expect(url.protocol).toBe('https:');
57+
expect(url.toString()).toBe(
58+
'https://username:[email protected]:8080/docs/path?query=testQuery&key=value#fragment',
59+
);
5660

5761
// Test searchParams
5862
const searchParams = url.searchParams;

packages/rn-tester/js/examples/Urls/UrlExample.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ function URLComponent(props: Props) {
3131
<RNTesterText testID="URL-password">{`password: ${parsedUrl.password}`}</RNTesterText>
3232
<RNTesterText testID="URL-username">{`username: ${parsedUrl.username}`}</RNTesterText>
3333
<RNTesterText testID="URL-pathname">{`pathname: ${parsedUrl.pathname}`}</RNTesterText>
34+
<RNTesterText testID="URL-protocol">{`protocol: ${parsedUrl.protocol}`}</RNTesterText>
35+
<RNTesterText testID="URL-toString">{`toString: ${parsedUrl.toString()}`}</RNTesterText>
3436
<RNTesterText testID="URL-port">{`port: ${parsedUrl.port}`}</RNTesterText>
3537
<RNTesterText testID="URL-search">{`search: ${parsedUrl.search}`}</RNTesterText>
3638
<RNTesterText testID="URL-search-params">{`searchParams: ${parsedUrl.searchParams.toString()}`}</RNTesterText>

0 commit comments

Comments
 (0)