Skip to content

Commit

Permalink
Fixed prev commit + added a test
Browse files Browse the repository at this point in the history
  • Loading branch information
drore committed Sep 15, 2022
1 parent 1608267 commit 010964c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function getChromeVersionFromCli(includeChromium) {
}

function extractChromeVersionNumer(chromeVersionString) {
return chromeVersionString.replace(/Chromium\s(([0-9]+\.?)+)\s?.*/, '$1');
return chromeVersionString.replace(/\D*(([0-9]+\.?)+)\s?.*/, '$1');
}

async function getChromeVersionWin(includeChromium) {
Expand Down
8 changes: 8 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ describe('Chrome Finder', function() {
});
});

describe('extractChromiumVersionNumer from Chromium 105.0.5195.102 built on Debian 11.4, running on Debian 11.5', function() {
it('should return "105.0.5195.102"', function() {
const versionString = 'Chromium 105.0.5195.102 built on Debian 11.4, running on Debian 11.5';
const versionNumber = extractChromeVersionNumer(versionString);
expect(versionNumber).to.equal('105.0.5195.102');
});
});

describe('extractChromiumVersionNumer from Chromium 90.0.4430.212 Fedora Project', function() {
it('should return "90.0.4430.212"', function() {
const versionString = 'Chromium 90.0.4430.212 Fedora Project';
Expand Down

0 comments on commit 010964c

Please sign in to comment.