From 8ec53a8966e2938b92327d634c04bd82396d634c Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Wed, 7 Aug 2024 17:52:03 -0700 Subject: [PATCH 1/3] Make Fetch integration test handle UTF-8 content. - Move test away from external endpoints (uses test web server) - Validate UTF-8 `fetch` handling --- vnext/TestWebSite/wwwroot/static/utf-8.json | 5 +++++ vnext/TestWebSite/wwwroot/static/utf-8.txt | 1 + vnext/src-win/IntegrationTests/FetchTest.js | 7 +++---- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 vnext/TestWebSite/wwwroot/static/utf-8.json create mode 100644 vnext/TestWebSite/wwwroot/static/utf-8.txt diff --git a/vnext/TestWebSite/wwwroot/static/utf-8.json b/vnext/TestWebSite/wwwroot/static/utf-8.json new file mode 100644 index 00000000000..b08812a5758 --- /dev/null +++ b/vnext/TestWebSite/wwwroot/static/utf-8.json @@ -0,0 +1,5 @@ +{ + "IDS_ERR_CHANGES_SAVED": "Изменения сохранены.", + "IDS_ERR_CHANGES_NOT_SAVED": "Ошибка при сохранении изменений.", + "IDS_ERR_SOMETHING_WRONG": "Что-то пошло не так :(" +} diff --git a/vnext/TestWebSite/wwwroot/static/utf-8.txt b/vnext/TestWebSite/wwwroot/static/utf-8.txt new file mode 100644 index 00000000000..b68bf491d7b --- /dev/null +++ b/vnext/TestWebSite/wwwroot/static/utf-8.txt @@ -0,0 +1 @@ +IDS_ERR_CHANGES_SAVED : Изменения сохранены diff --git a/vnext/src-win/IntegrationTests/FetchTest.js b/vnext/src-win/IntegrationTests/FetchTest.js index 79c666fa581..78b75068814 100644 --- a/vnext/src-win/IntegrationTests/FetchTest.js +++ b/vnext/src-win/IntegrationTests/FetchTest.js @@ -15,8 +15,9 @@ const {AppRegistry, View} = ReactNative; const {TestModule} = ReactNative.NativeModules; const uri = - 'https://raw.githubusercontent.com/microsoft/react-native-windows/main/.yarnrc.yml'; -const expectedContent = 'enableScripts: false'; + 'http://localhost:5555/static/utf-8.txt'; +const expectedContent = "IDS_ERR_CHANGES_SAVED : Изменения сохранены\n"; + type State = { uri: string, @@ -26,8 +27,6 @@ type State = { class FetchTest extends React.Component<{...}, State> { state: State = { - uri: 'https://raw.githubusercontent.com/microsoft/react-native-windows/main/.yarnrc.yml', - expected: 'enableScripts: false', content: '', }; From 196faceb8fc2a6328b9ba0d7a4efea277d35c422 Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Wed, 7 Aug 2024 17:53:40 -0700 Subject: [PATCH 2/3] Change files --- ...ative-windows-b3755ae4-83be-44b9-ad2d-9f809f9aba5b.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-b3755ae4-83be-44b9-ad2d-9f809f9aba5b.json diff --git a/change/react-native-windows-b3755ae4-83be-44b9-ad2d-9f809f9aba5b.json b/change/react-native-windows-b3755ae4-83be-44b9-ad2d-9f809f9aba5b.json new file mode 100644 index 00000000000..492eca3e1db --- /dev/null +++ b/change/react-native-windows-b3755ae4-83be-44b9-ad2d-9f809f9aba5b.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Make Fetch integration test handle UTF-8 content.", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} From c70798c213e58782022cc0a251452f50b365c2d7 Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Fri, 9 Aug 2024 16:05:47 -0700 Subject: [PATCH 3/3] Clean up FetchTest.js --- vnext/src-win/IntegrationTests/FetchTest.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/vnext/src-win/IntegrationTests/FetchTest.js b/vnext/src-win/IntegrationTests/FetchTest.js index 78b75068814..74a065e9247 100644 --- a/vnext/src-win/IntegrationTests/FetchTest.js +++ b/vnext/src-win/IntegrationTests/FetchTest.js @@ -18,10 +18,7 @@ const uri = 'http://localhost:5555/static/utf-8.txt'; const expectedContent = "IDS_ERR_CHANGES_SAVED : Изменения сохранены\n"; - type State = { - uri: string, - expected: string, content: string, };