Repository: manusa/electronim
Pull request #370 (2024-01-07 06:42:08)

⬆ Bump @testing-library/user-event to 14.5.2

sonarcloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=manusa_electronim&pullRequest=370) **Quality Gate passed**  
Kudos, no new issues were introduced!

[0 New issues](https://sonarcloud.io/project/issues?id=manusa_electronim&pullRequest=370&resolved=false&inNewCodePeriod=true)  
[0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=manusa_electronim&pullRequest=370&resolved=false&inNewCodePeriod=true)  
No data about Coverage  
No data about Duplication  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=manusa_electronim&pullRequest=370)



Patch:
diff --git a/package-lock.json b/package-lock.json
index 99fbaa8..ded7d48 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -40,7 +40,7 @@
       },
       "devDependencies": {
         "@testing-library/dom": "9.3.3",
-        "@testing-library/user-event": "14.5.1",
+        "@testing-library/user-event": "14.5.2",
         "chrome-tabs": "5.4.0",
         "css-loader": "6.8.1",
         "electron-builder": "24.6.4",
@@ -1676,9 +1676,9 @@
       }
     },
     "node_modules/@testing-library/user-event": {
-      "version": "14.5.1",
-      "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.5.1.tgz",
-      "integrity": "sha512-UCcUKrUYGj7ClomOo2SpNVvx4/fkd/2BbIHDCle8A0ax+P3bU7yJwDBDrS6ZwdTMARWTGODX1hEsCcO+7beJjg==",
+      "version": "14.5.2",
+      "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.5.2.tgz",
+      "integrity": "sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ==",
       "dev": true,
       "engines": {
         "node": ">=12",
@@ -10626,9 +10626,9 @@
       }
     },
     "@testing-library/user-event": {
-      "version": "14.5.1",
-      "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.5.1.tgz",
-      "integrity": "sha512-UCcUKrUYGj7ClomOo2SpNVvx4/fkd/2BbIHDCle8A0ax+P3bU7yJwDBDrS6ZwdTMARWTGODX1hEsCcO+7beJjg==",
+      "version": "14.5.2",
+      "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.5.2.tgz",
+      "integrity": "sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ==",
       "dev": true,
       "requires": {}
     },
diff --git a/package.json b/package.json
index 24bd2f6..156da16 100644
--- a/package.json
+++ b/package.json
@@ -185,7 +185,7 @@
   },
   "devDependencies": {
     "@testing-library/dom": "9.3.3",
-    "@testing-library/user-event": "14.5.1",
+    "@testing-library/user-event": "14.5.2",
     "chrome-tabs": "5.4.0",
     "css-loader": "6.8.1",
     "electron-builder": "24.6.4",
diff --git a/src/user-agent/index.js b/src/user-agent/index.js
index cf1f8f5..846ddaa 100644
--- a/src/user-agent/index.js
+++ b/src/user-agent/index.js
@@ -14,7 +14,7 @@
    limitations under the License.
  */
 const axios = require('axios');
-const CHROMIUM_VERSIONS = 'https://omahaproxy.appspot.com/all.json';
+const CHROMIUM_VERSIONS = `https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions/all/releases?filter=endtime>${new Date().toISOString()}`;
 const FIREFOX_VERSIONS = 'https://product-details.mozilla.org/1.0/firefox_versions.json';
 
 const BROWSER_VERSIONS = {
@@ -28,12 +28,10 @@ const USER_AGENT_INTERCEPTOR_FILTER = {
 };
 
 const latestChromium = async () => {
-  const {data: tags} = await axios.get(CHROMIUM_VERSIONS);
-  const stableVersion = tags
-    .filter(version => version.os === 'linux')
-    .flatMap(version => version.versions)
-    .filter(version => version.channel === 'stable');
-  return stableVersion && stableVersion.length > 0 ? stableVersion[0].version : null;
+  const {data} = await axios.get(CHROMIUM_VERSIONS);
+  const stableVersion = data.releases
+    .flatMap(release => release.version);
+  return stableVersion && stableVersion.length > 0 ? stableVersion[0] : null;
 };
 
 const latestFirefox = async () => {


Test patch:
diff --git a/src/user-agent/__tests__/index.test.js b/src/user-agent/__tests__/index.test.js
index 9e355aa..d1eb440 100644
--- a/src/user-agent/__tests__/index.test.js
+++ b/src/user-agent/__tests__/index.test.js
@@ -25,10 +25,12 @@ describe('User Agent module test suite', () => {
   describe('initBrowserVersions', () => {
     test('valid responses, should return a valid version for all browsers,', async () => {
       // Given
-      axios.get.mockImplementationOnce(async () => ({data: [
-        {os: 'linux', versions: [{channel: 'other', version: '5uck5'}, {channel: 'stable', version: '1337'}]},
-        {os: 'win'}
-      ]}));
+      axios.get.mockImplementationOnce(async () => ({data: {
+        releases: [
+          {name: 'chrome/platforms/linux/channels/stable/versions/1337/releases/1704308709', version: '1337'},
+          {name: 'chrome/platforms/linux/channels/stable/versions/1336/releases/1704308708', version: '1336'}
+        ]
+      }}));
       axios.get.mockImplementation(async () => ({data: {
         FIREFOX_DEVEDITION: '313373',
         LATEST_FIREFOX_VERSION: 'ff.1337',
@@ -43,9 +45,11 @@ describe('User Agent module test suite', () => {
     });
     test('invalidResponse, should return null,', async () => {
       // Given
-      axios.get.mockImplementation(async () => ({data: [
-        {os: 'win'}, 'not Valid'
-      ]}));
+      axios.get.mockImplementation(async () => ({data: {
+        releases: [
+          {os: 'win'}, 'not Valid'
+        ]
+      }}));
       // When
       await userAgent.initBrowserVersions();
       // Then