mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 22:37:04 +08:00
fix(electron): make sure updater receive correct installer files (#8798)
fix AF-1680
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`testing for client update > filter valid installer files > filter for platform [darwin] arch [arm64] 1`] = `
|
||||
[
|
||||
"affine-0.18.0-stable-macos-arm64.dmg",
|
||||
"affine-0.18.0-stable-macos-arm64.zip",
|
||||
"affine-0.18.0-stable-macos-x64.dmg",
|
||||
"affine-0.18.0-stable-macos-x64.zip",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`testing for client update > filter valid installer files > filter for platform [darwin] arch [x64] 1`] = `
|
||||
[
|
||||
"affine-0.18.0-stable-macos-x64.dmg",
|
||||
"affine-0.18.0-stable-macos-x64.zip",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`testing for client update > filter valid installer files > filter for platform [linux] arch [x64] 1`] = `
|
||||
[
|
||||
"affine-0.18.0-stable-linux-x64.appimage",
|
||||
"affine-0.18.0-stable-linux-x64.deb",
|
||||
"affine-0.18.0-stable-linux-x64.flatpak",
|
||||
"affine-0.18.0-stable-linux-x64.zip",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`testing for client update > filter valid installer files > filter for platform [win32] arch [arm64] 1`] = `
|
||||
[
|
||||
"affine-0.18.0-stable-windows-arm64.nsis.exe",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`testing for client update > filter valid installer files > filter for platform [win32] arch [arm64] and is squirrel installer 1`] = `
|
||||
[
|
||||
"affine-0.18.0-stable-windows-arm64.exe",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`testing for client update > filter valid installer files > filter for platform [win32] arch [x64] 1`] = `
|
||||
[
|
||||
"affine-0.18.0-stable-windows-x64.nsis.exe",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`testing for client update > filter valid installer files > filter for platform [win32] arch [x64] and is squirrel installer 1`] = `
|
||||
[
|
||||
"affine-0.18.0-stable-windows-x64.exe",
|
||||
]
|
||||
`;
|
||||
@@ -45,6 +45,16 @@
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.17.0-canary.7/affine-0.17.0-canary.7-canary-windows-x64.nsis.exe",
|
||||
"size": 133493672
|
||||
},
|
||||
{
|
||||
"name": "affine-0.17.0-canary.7-canary-windows-arm64.exe",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.17.0-canary.7/affine-0.17.0-canary.7-canary-windows-arm64.exe",
|
||||
"size": 182557416
|
||||
},
|
||||
{
|
||||
"name": "affine-0.17.0-canary.7-canary-windows-arm64.nsis.exe",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.17.0-canary.7/affine-0.17.0-canary.7-canary-windows-arm64.nsis.exe",
|
||||
"size": 133493672
|
||||
},
|
||||
{
|
||||
"name": "codecov.yml",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.17.0-canary.7/codecov.yml",
|
||||
|
||||
@@ -1,73 +1,73 @@
|
||||
[
|
||||
{
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/tag/v0.16.3",
|
||||
"name": "0.16.3",
|
||||
"tag_name": "v0.16.3",
|
||||
"published_at": "2024-08-14T07:43:22Z",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/tag/v0.18.0",
|
||||
"name": "0.18.0",
|
||||
"tag_name": "v0.18.0",
|
||||
"published_at": "2024-11-13T07:43:22Z",
|
||||
"assets": [
|
||||
{
|
||||
"name": "affine-0.16.3-stable-linux-x64.appimage",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/affine-0.16.3-stable-linux-x64.appimage",
|
||||
"name": "affine-0.18.0-stable-linux-x64.appimage",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/affine-0.18.0-stable-linux-x64.appimage",
|
||||
"size": 178308288
|
||||
},
|
||||
{
|
||||
"name": "affine-0.16.3-stable-linux-x64.zip",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/affine-0.16.3-stable-linux-x64.zip",
|
||||
"name": "affine-0.18.0-stable-linux-x64.zip",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/affine-0.18.0-stable-linux-x64.zip",
|
||||
"size": 176405078
|
||||
},
|
||||
{
|
||||
"name": "affine-0.16.3-stable-macos-arm64.dmg",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/affine-0.16.3-stable-macos-arm64.dmg",
|
||||
"name": "affine-0.18.0-stable-macos-arm64.dmg",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/affine-0.18.0-stable-macos-arm64.dmg",
|
||||
"size": 168093091
|
||||
},
|
||||
{
|
||||
"name": "affine-0.16.3-stable-macos-arm64.zip",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/affine-0.16.3-stable-macos-arm64.zip",
|
||||
"name": "affine-0.18.0-stable-macos-arm64.zip",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/affine-0.18.0-stable-macos-arm64.zip",
|
||||
"size": 167540517
|
||||
},
|
||||
{
|
||||
"name": "affine-0.16.3-stable-macos-x64.dmg",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/affine-0.16.3-stable-macos-x64.dmg",
|
||||
"name": "affine-0.18.0-stable-macos-x64.dmg",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/affine-0.18.0-stable-macos-x64.dmg",
|
||||
"size": 175029125
|
||||
},
|
||||
{
|
||||
"name": "affine-0.16.3-stable-macos-x64.zip",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/affine-0.16.3-stable-macos-x64.zip",
|
||||
"name": "affine-0.18.0-stable-macos-x64.zip",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/affine-0.18.0-stable-macos-x64.zip",
|
||||
"size": 174752343
|
||||
},
|
||||
{
|
||||
"name": "affine-0.16.3-stable-windows-x64.exe",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/affine-0.16.3-stable-windows-x64.exe",
|
||||
"name": "affine-0.18.0-stable-windows-x64.exe",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/affine-0.18.0-stable-windows-x64.exe",
|
||||
"size": 177757416
|
||||
},
|
||||
{
|
||||
"name": "affine-0.16.3-stable-windows-x64.nsis.exe",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/affine-0.16.3-stable-windows-x64.nsis.exe",
|
||||
"name": "affine-0.18.0-stable-windows-x64.nsis.exe",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/affine-0.18.0-stable-windows-x64.nsis.exe",
|
||||
"size": 130302976
|
||||
},
|
||||
{
|
||||
"name": "codecov.yml",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/codecov.yml",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/codecov.yml",
|
||||
"size": 91
|
||||
},
|
||||
{
|
||||
"name": "latest-linux.yml",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/latest-linux.yml",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/latest-linux.yml",
|
||||
"size": 539
|
||||
},
|
||||
{
|
||||
"name": "latest-mac.yml",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/latest-mac.yml",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/latest-mac.yml",
|
||||
"size": 865
|
||||
},
|
||||
{
|
||||
"name": "latest.yml",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/latest.yml",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/latest.yml",
|
||||
"size": 540
|
||||
},
|
||||
{
|
||||
"name": "web-static.zip",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.16.3/web-static.zip",
|
||||
"url": "https://github.com/toeverything/AFFiNE/releases/download/v0.18.0/web-static.zip",
|
||||
"size": 61989498
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
version: 0.16.3
|
||||
files:
|
||||
- url: affine-0.16.3-stable-linux-x64.appimage
|
||||
sha512: nmID71T7jq9yKCdujVUeL71TLXmwIdaaWZB0ouDX13Np1vahS1+1A5uJbHUzTH0N/sN0W+LKUg9L29wNgi42gw==
|
||||
size: 178308288
|
||||
- url: affine-0.16.3-stable-linux-x64.zip
|
||||
sha512: fsHTT0fUeU/uLGdlRiuddzSuJWIOcaUTgUj7DB5XSQJ4qA5blAcpij8zOil0ww3Ea7Kwe7qcIe4SSCtNFu31sQ==
|
||||
size: 176405078
|
||||
path: affine-0.16.3-stable-linux-x64.appimage
|
||||
sha512: nmID71T7jq9yKCdujVUeL71TLXmwIdaaWZB0ouDX13Np1vahS1+1A5uJbHUzTH0N/sN0W+LKUg9L29wNgi42gw==
|
||||
releaseDate: 2024-08-14T07:11:42.171Z
|
||||
@@ -1,17 +0,0 @@
|
||||
version: 0.16.3
|
||||
files:
|
||||
- url: affine-0.16.3-stable-macos-arm64.dmg
|
||||
sha512: fmJWpi45gVYYUavb0Cd6Y9DR2nxBc3wMagHOiMF1PPg+4tEyHGmVIhRIwY/QaJ5TAR+3tRAENZwen2gvja0UtQ==
|
||||
size: 168093091
|
||||
- url: affine-0.16.3-stable-macos-arm64.zip
|
||||
sha512: u1ud8pJ613A5Oqh3fbcnUUOA4hNoURWBdtAMJoeZ6EIAUvZzV0tsDcAqLiEP89LKbitaH0IdrW3D8EFSsZ9kRw==
|
||||
size: 167540517
|
||||
- url: affine-0.16.3-stable-macos-x64.dmg
|
||||
sha512: Ou1W6/xHyM+ZN9BLYvc+8qCB8wR9F3jLQP5m3oG0uIDDw7wwoR+ny3gcWbDzalfxoOR84CvM74LIfc7BQf69Uw==
|
||||
size: 175029125
|
||||
- url: affine-0.16.3-stable-macos-x64.zip
|
||||
sha512: oot098M9qqdRbw+znnuLjVedZ1U59p4m+gzSxRtpCuYdfvumvu5/RN1jvY2cHssqstJj/Ybh4eBTlREZMgKyyg==
|
||||
size: 174752343
|
||||
path: affine-0.16.3-stable-macos-arm64.dmg
|
||||
sha512: fmJWpi45gVYYUavb0Cd6Y9DR2nxBc3wMagHOiMF1PPg+4tEyHGmVIhRIwY/QaJ5TAR+3tRAENZwen2gvja0UtQ==
|
||||
releaseDate: 2024-08-14T07:11:41.503Z
|
||||
@@ -1,11 +0,0 @@
|
||||
version: 0.16.3
|
||||
files:
|
||||
- url: affine-0.16.3-stable-windows-x64.exe
|
||||
sha512: 47zaLkAhSxPuWsKq01dSEt8GusXqK1rmSaiOTBLe32lmUiXPhUqYO5JhzbrjJKx7/TFcic4UDJ/Zir3wf9fKRA==
|
||||
size: 177757416
|
||||
- url: affine-0.16.3-stable-windows-x64.nsis.exe
|
||||
sha512: G3Rxa3onqlJTGQIcz7Rz6ZQ/6rAwjzjYnW/HB5yzXkjN6e5yfW2JBk765+AyiPFV5Mn4Rloj7V6GM6m4q7WfWg==
|
||||
size: 130302976
|
||||
path: affine-0.16.3-stable-windows-x64.exe
|
||||
sha512: 47zaLkAhSxPuWsKq01dSEt8GusXqK1rmSaiOTBLe32lmUiXPhUqYO5JhzbrjJKx7/TFcic4UDJ/Zir3wf9fKRA==
|
||||
releaseDate: 2024-08-14T07:11:40.285Z
|
||||
@@ -3,9 +3,13 @@ files:
|
||||
- url: affine-0.17.0-canary.7-canary-linux-x64.appimage
|
||||
sha512: qspZkDlItrHu02vSItbjc3I+t4FcOiHOzGt0Ap6IeZEFKal+hoOh4WIcUN16dlS/OoFm+is8yPBHqN/70xhWKA==
|
||||
size: 181990592
|
||||
- url: affine-0.17.0-canary.7-canary-linux-x64.deb
|
||||
sha512: fom2iuMiPUlnHAGJhQdAnWJwMggK4rloNkiWqH8ZHF1Q09oturgSMGgkUEWZWXsZPpORt545eYNv5Zg9aff8yQ==
|
||||
size: 180105256
|
||||
- url: affine-0.17.0-canary.7-canary-linux-x64.flatpak
|
||||
sha512: fom2iuMiPUlnHAGJhQdAnWJwMggK4rloNkiWqH8ZHF1Q09oturgSMGgkUEWZWXsZPpORt545eYNv5Zg9aff8yQ==
|
||||
size: 180105256
|
||||
- url: affine-0.17.0-canary.7-canary-linux-x64.zip
|
||||
sha512: fom2iuMiPUlnHAGJhQdAnWJwMggK4rloNkiWqH8ZHF1Q09oturgSMGgkUEWZWXsZPpORt545eYNv5Zg9aff8yQ==
|
||||
size: 180105256
|
||||
path: affine-0.17.0-canary.7-canary-linux-x64.appimage
|
||||
sha512: qspZkDlItrHu02vSItbjc3I+t4FcOiHOzGt0Ap6IeZEFKal+hoOh4WIcUN16dlS/OoFm+is8yPBHqN/70xhWKA==
|
||||
releaseDate: 2024-08-29T08:20:53.453Z
|
||||
|
||||
@@ -12,6 +12,4 @@ files:
|
||||
- url: affine-0.17.0-canary.7-canary-macos-x64.zip
|
||||
sha512: PL24krtjeiQY53F7OuS+hh8EZP3YpbLle0JboXiddSrulypxzBRquOCCinNW88Kg8ZJbOrfTkxaNOHpOAVfeaQ==
|
||||
size: 176948223
|
||||
path: affine-0.17.0-canary.7-canary-macos-arm64.dmg
|
||||
sha512: Tdy7dgrCHP95PjsZBt1evxUk7DUkn+JpseBQj1Gz60MmcsFx+0NtJvofZbUcsLFiS0IC32JM/szHlHiNGEznrQ==
|
||||
releaseDate: 2024-08-29T08:20:52.810Z
|
||||
|
||||
@@ -6,6 +6,10 @@ files:
|
||||
- url: affine-0.17.0-canary.7-canary-windows-x64.nsis.exe
|
||||
sha512: ztugqKwPpxDDSK1OpzUPkGvL8wLXwg9rh985bs9ZvxydY037yKBAZOk96PPtow2qqRb5/9Xn8MuGrWgchqXkVg==
|
||||
size: 133493672
|
||||
path: affine-0.17.0-canary.7-canary-windows-x64.exe
|
||||
sha512: cF47Wcu69PXyMVswSzrdNktNO2lqkjsyJ/HQr2qWjFPuIJfcad9QDTfOyCVsMCV6KGUSSeFiTHyObWgKd6z2DQ==
|
||||
- url: affine-0.17.0-canary.7-canary-windows-arm64.exe
|
||||
sha512: cF47Wcu69PXyMVswSzrdNktNO2lqkjsyJ/HQr2qWjFPuIJfcad9QDTfOyCVsMCV6KGUSSeFiTHyObWgKd6z2DQ==
|
||||
size: 182557416
|
||||
- url: affine-0.17.0-canary.7-canary-windows-arm64.nsis.exe
|
||||
sha512: ztugqKwPpxDDSK1OpzUPkGvL8wLXwg9rh985bs9ZvxydY037yKBAZOk96PPtow2qqRb5/9Xn8MuGrWgchqXkVg==
|
||||
size: 133493672
|
||||
releaseDate: 2024-08-29T08:20:51.573Z
|
||||
|
||||
39
packages/frontend/apps/electron/test/main/fixtures/releases/0.18.0/latest.yml
vendored
Normal file
39
packages/frontend/apps/electron/test/main/fixtures/releases/0.18.0/latest.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
version: 0.18.0
|
||||
files:
|
||||
- url: affine-0.18.0-stable-windows-x64.exe
|
||||
sha512: cF47Wcu69PXyMVswSzrdNktNO2lqkjsyJ/HQr2qWjFPuIJfcad9QDTfOyCVsMCV6KGUSSeFiTHyObWgKd6z2DQ==
|
||||
size: 182557416
|
||||
- url: affine-0.18.0-stable-windows-x64.nsis.exe
|
||||
sha512: ztugqKwPpxDDSK1OpzUPkGvL8wLXwg9rh985bs9ZvxydY037yKBAZOk96PPtow2qqRb5/9Xn8MuGrWgchqXkVg==
|
||||
size: 133493672
|
||||
- url: affine-0.18.0-stable-windows-arm64.exe
|
||||
sha512: cF47Wcu69PXyMVswSzrdNktNO2lqkjsyJ/HQr2qWjFPuIJfcad9QDTfOyCVsMCV6KGUSSeFiTHyObWgKd6z2DQ==
|
||||
size: 182557416
|
||||
- url: affine-0.18.0-stable-windows-arm64.nsis.exe
|
||||
sha512: ztugqKwPpxDDSK1OpzUPkGvL8wLXwg9rh985bs9ZvxydY037yKBAZOk96PPtow2qqRb5/9Xn8MuGrWgchqXkVg==
|
||||
size: 133493672
|
||||
- url: affine-0.18.0-stable-linux-x64.appimage
|
||||
sha512: qspZkDlItrHu02vSItbjc3I+t4FcOiHOzGt0Ap6IeZEFKal+hoOh4WIcUN16dlS/OoFm+is8yPBHqN/70xhWKA==
|
||||
size: 181990592
|
||||
- url: affine-0.18.0-stable-linux-x64.deb
|
||||
sha512: fom2iuMiPUlnHAGJhQdAnWJwMggK4rloNkiWqH8ZHF1Q09oturgSMGgkUEWZWXsZPpORt545eYNv5Zg9aff8yQ==
|
||||
size: 180105256
|
||||
- url: affine-0.18.0-stable-linux-x64.flatpak
|
||||
sha512: fom2iuMiPUlnHAGJhQdAnWJwMggK4rloNkiWqH8ZHF1Q09oturgSMGgkUEWZWXsZPpORt545eYNv5Zg9aff8yQ==
|
||||
size: 180105256
|
||||
- url: affine-0.18.0-stable-linux-x64.zip
|
||||
sha512: fom2iuMiPUlnHAGJhQdAnWJwMggK4rloNkiWqH8ZHF1Q09oturgSMGgkUEWZWXsZPpORt545eYNv5Zg9aff8yQ==
|
||||
size: 180105256
|
||||
- url: affine-0.18.0-stable-macos-arm64.dmg
|
||||
sha512: Tdy7dgrCHP95PjsZBt1evxUk7DUkn+JpseBQj1Gz60MmcsFx+0NtJvofZbUcsLFiS0IC32JM/szHlHiNGEznrQ==
|
||||
size: 170556866
|
||||
- url: affine-0.18.0-stable-macos-arm64.zip
|
||||
sha512: pmYD0B5Z9hrzgjcHmRCKnNawoPJiO5r1RjBBZi+THVL3TyKXzpJBr9HTNQkjYnQYgqHX4q2eoONsDNCIoqTeBA==
|
||||
size: 170382513
|
||||
- url: affine-0.18.0-stable-macos-x64.dmg
|
||||
sha512: k4a4GUmy/6MmSc1xVGJNeNCCtYylWWSRcfDoZA+syUhZFY6x3xrOft972ONsiRrJukXWlKrFmVTwoW68Ywe49A==
|
||||
size: 176815834
|
||||
- url: affine-0.18.0-stable-macos-x64.zip
|
||||
sha512: PL24krtjeiQY53F7OuS+hh8EZP3YpbLle0JboXiddSrulypxzBRquOCCinNW88Kg8ZJbOrfTkxaNOHpOAVfeaQ==
|
||||
size: 176948223
|
||||
releaseDate: 2024-08-29T08:20:51.573Z
|
||||
@@ -2,6 +2,7 @@ import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import type { UpdateCheckResult } from 'electron-updater';
|
||||
import { parseUpdateInfo } from 'electron-updater/out/providers/Provider';
|
||||
import fs from 'fs-extra';
|
||||
import { flatten } from 'lodash-es';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
@@ -16,7 +17,10 @@ import {
|
||||
vi,
|
||||
} from 'vitest';
|
||||
|
||||
import { AFFiNEUpdateProvider } from '../../src/main/updater/affine-update-provider';
|
||||
import {
|
||||
AFFiNEUpdateProvider,
|
||||
availableForMyPlatformAndInstaller,
|
||||
} from '../../src/main/updater/affine-update-provider';
|
||||
import { MockedAppAdapter, MockedUpdater } from './mocks';
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||
@@ -27,23 +31,11 @@ vi.mock('electron', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
const platformTail = (() => {
|
||||
// https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/providers/Provider.ts#L30
|
||||
const platform = process.platform;
|
||||
if (platform === 'linux') {
|
||||
const arch = process.env['TEST_UPDATER_ARCH'] || process.arch;
|
||||
const archSuffix = arch === 'x64' ? '' : `-${arch}`;
|
||||
return '-linux' + archSuffix;
|
||||
} else {
|
||||
return platform === 'darwin' ? '-mac' : '';
|
||||
}
|
||||
})();
|
||||
|
||||
describe('testing for client update', () => {
|
||||
const expectReleaseList = [
|
||||
{ buildType: 'stable', version: '0.16.3' },
|
||||
{ buildType: 'beta', version: '0.16.3-beta.2' },
|
||||
{ buildType: 'canary', version: '0.17.0-canary.7' },
|
||||
{ buildType: 'stable', version: '0.18.0' },
|
||||
];
|
||||
|
||||
const basicRequestHandlers = [
|
||||
@@ -64,7 +56,7 @@ describe('testing for client update', () => {
|
||||
expectReleaseList.map(({ version }) => {
|
||||
return [
|
||||
http.get(
|
||||
`https://github.com/toeverything/AFFiNE/releases/download/v${version}/latest${platformTail}.yml`,
|
||||
`https://github.com/toeverything/AFFiNE/releases/download/v${version}/latest.yml`,
|
||||
async req => {
|
||||
const buffer = await fs.readFile(
|
||||
path.join(
|
||||
@@ -83,6 +75,7 @@ describe('testing for client update', () => {
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
describe('release api request successfully', () => {
|
||||
const server = setupServer(...basicRequestHandlers);
|
||||
beforeAll(() => server.listen({ onUnhandledRequest: 'error' }));
|
||||
@@ -108,4 +101,46 @@ describe('testing for client update', () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('filter valid installer files', async () => {
|
||||
const platforms: NodeJS.Platform[] = ['darwin', 'win32', 'linux'];
|
||||
const arches: NodeJS.Architecture[] = ['x64', 'arm64'];
|
||||
|
||||
for (const platform of platforms) {
|
||||
for (const arch of arches) {
|
||||
if (platform === 'linux' && arch === 'arm64') {
|
||||
// not support arm64 on linux yet
|
||||
continue;
|
||||
}
|
||||
const data = await fs.readFile(
|
||||
path.join(__dirname, 'fixtures', 'releases', '0.18.0', `latest.yml`),
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
const files = parseUpdateInfo(
|
||||
data,
|
||||
'',
|
||||
new URL('https://affine.pro')
|
||||
).files.map(file => file.url);
|
||||
|
||||
it(`filter for platform [${platform}] arch [${arch}]`, () => {
|
||||
expect(
|
||||
files.filter(file =>
|
||||
availableForMyPlatformAndInstaller(file, platform, arch, false)
|
||||
)
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
if (platform === 'win32') {
|
||||
it(`filter for platform [${platform}] arch [${arch}] and is squirrel installer`, () => {
|
||||
expect(
|
||||
files.filter(file =>
|
||||
availableForMyPlatformAndInstaller(file, platform, arch, true)
|
||||
)
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user