Skip to content

Commit

Permalink
feat: sync chrome-for-testing json files (#737)
Browse files Browse the repository at this point in the history
closes #730

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced data fetching for Chrome for Testing with new JSON entries
for version management.
  
- **Bug Fixes**
- Improved data validation in tests to ensure correct structure and
content of fetched data.

- **Tests**
- Added assertions to validate properties of fetched items in the
ChromeForTestingBinary tests.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
fengmk2 authored Nov 30, 2024
1 parent 1d128e2 commit 9bb12fd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app/common/adapter/binary/ChromeForTestingBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,28 @@ export class ChromeForTestingBinary extends AbstractBinary {
return;
}

this.dirItems['/'].push({
name: 'known-good-versions-with-downloads.json',
date: data.timestamp,
size: '-',
isDir: false,
url: jsonApiEndpoint,
});
this.dirItems['/'].push({
name: 'latest-patch-versions-per-build.json',
date: data.timestamp,
size: '-',
isDir: false,
url: 'https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build.json',
});
this.dirItems['/'].push({
name: 'last-known-good-versions.json',
date: data.timestamp,
size: '-',
isDir: false,
url: 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json',
});

// "timestamp": "2023-09-16T00:21:21.964Z",
// "versions": [
// {
Expand Down
9 changes: 9 additions & 0 deletions test/common/adapter/binary/ChromeForTestingBinary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ describe('test/common/adapter/binary/ChromeForTestingBinary.test.ts', () => {
persist: false,
});
const result = await binary.fetch('/');
assert.equal(result?.items[0].name, 'known-good-versions-with-downloads.json');
assert.equal(result?.items[0].date, '2023-09-16T00:21:21.964Z');
assert.equal(result?.items[0].isDir, false);
assert.equal(result?.items[1].name, 'latest-patch-versions-per-build.json');
assert.equal(result?.items[1].date, '2023-09-16T00:21:21.964Z');
assert.equal(result?.items[1].isDir, false);
assert.equal(result?.items[2].name, 'last-known-good-versions.json');
assert.equal(result?.items[2].date, '2023-09-16T00:21:21.964Z');
assert.equal(result?.items[2].isDir, false);
const latestVersion = result!.items![result!.items.length - 1].name;
assert(latestVersion);
assert.equal(latestVersion, '119.0.6008.0/');
Expand Down

0 comments on commit 9bb12fd

Please sign in to comment.