fix: support GitPeji tags and interactive helper auth
APT build checks / build-checks (push) Has been cancelled
APT build checks / build-checks (push) Has been cancelled
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const test = require('node:test');
|
||||
const { EventEmitter } = require('node:events');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const {
|
||||
LATEST_RELEASE_URL,
|
||||
@@ -30,6 +32,24 @@ async function rejectsWithCode(promise, code) {
|
||||
});
|
||||
}
|
||||
|
||||
test('accepts a live-shape GitPeji v-tag and normalizes it to bare semver', async () => {
|
||||
const fixture = fs.readFileSync(
|
||||
path.join(__dirname, 'fixtures', 'gitpeji-latest-release.json'),
|
||||
'utf8',
|
||||
);
|
||||
|
||||
const result = await checkForUpdate({
|
||||
currentVersion: '0.9.0',
|
||||
request: async () => response(fixture),
|
||||
platform: 'win32',
|
||||
arch: 'x64',
|
||||
});
|
||||
|
||||
assert.equal(result.status, 'update-available');
|
||||
assert.equal(result.latestVersion, '1.0.0');
|
||||
assert.equal(result.releaseName, 'Alta Proxy Tool v1.0.0');
|
||||
});
|
||||
|
||||
test('valid update returns only sanitized, check-only metadata', async () => {
|
||||
let requestOptions;
|
||||
const request = async (options) => {
|
||||
@@ -148,7 +168,20 @@ test('redirects and response host drift are rejected', async () => {
|
||||
});
|
||||
|
||||
test('invalid or non-strict semver fails closed', async () => {
|
||||
const invalidVersions = ['v1.2.3', '1.2', '01.2.3', '1.2.3.4', 'latest'];
|
||||
const invalidVersions = [
|
||||
'V1.2.3',
|
||||
'vv1.2.3',
|
||||
' v1.2.3',
|
||||
'v1.2.3 ',
|
||||
'v1.2',
|
||||
'v01.2.3',
|
||||
'v1.2.3.4',
|
||||
'vlatest',
|
||||
'1.2',
|
||||
'01.2.3',
|
||||
'1.2.3.4',
|
||||
'latest',
|
||||
];
|
||||
|
||||
for (const tag_name of invalidVersions) {
|
||||
await rejectsWithCode(
|
||||
|
||||
Reference in New Issue
Block a user