Release ForgeFlow 0.8.8 Gitea asset route fix

This commit is contained in:
NuklearRabbit
2026-07-26 04:50:50 +02:00
parent 40d41f9a32
commit e888bd2c1c
11 changed files with 75 additions and 21 deletions
+19
View File
@@ -107,3 +107,22 @@ test('creates controlled pull requests and reads branch protection', async () =>
assert.deepEqual(create.options.body, { head: 'feature', base: 'main', title: 'Release feature', body: 'Summary' });
await assert.rejects(() => service.createPullRequest({ owner: 'owner', repo: 'app', head: 'main', base: 'main', title: 'Invalid' }), /different/);
});
test('downloads release assets through the release-scoped Gitea endpoint', async () => {
const service = new GiteaService(makeStore());
let requested = '';
service.downloadAuthenticated = async (pathname) => {
requested = pathname;
return Buffer.from('asset');
};
const asset = await service.downloadReleaseAsset('Jens', 'ForgeFlow', 107, 412);
assert.equal(asset.toString(), 'asset');
assert.equal(
requested,
'/api/v1/repos/Jens/ForgeFlow/releases/107/assets/412',
);
await assert.rejects(
() => service.downloadReleaseAsset('Jens', 'ForgeFlow', null, 412),
/invalid release ID/,
);
});
+6 -2
View File
@@ -336,6 +336,7 @@ test("packaged updater downloads only a published checksum-matched Windows asset
async getReleaseByTag(_owner, _repo, tag) {
if (tag !== "v0.8.2") return null;
return {
id: 82,
tag_name: tag,
draft: false,
prerelease: false,
@@ -353,7 +354,8 @@ test("packaged updater downloads only a published checksum-matched Windows asset
],
};
},
async downloadReleaseAsset(_owner, _repo, assetId) {
async downloadReleaseAsset(_owner, _repo, releaseId, assetId) {
assert.equal(releaseId, 82);
return assetId === 42 ? Buffer.from(`${sha256} ${assetName}\n`) : binary;
},
};
@@ -398,6 +400,7 @@ test("packaged updater rejects a binary whose checksum does not match", async ()
gitea: {
async getReleaseByTag() {
return {
id: 83,
tag_name: "v0.8.2",
assets: [
{
@@ -413,7 +416,8 @@ test("packaged updater rejects a binary whose checksum does not match", async ()
],
};
},
async downloadReleaseAsset(_owner, _repo, assetId) {
async downloadReleaseAsset(_owner, _repo, releaseId, assetId) {
assert.equal(releaseId, 83);
return assetId === 52
? Buffer.from(`${"0".repeat(64)} ${assetName}`)
: binary;