Files
ECC/tests/lib/github-origin.test.js
haelyra 28e53a0bc1 feat(install): add guided multi-harness installer (#2649)
* feat(install): add guided Claude plugin setup

* fix: support Claude command shims on Windows

* feat: support safe Claude plugin scope migration

* fix(install): preserve interactive setup terminal

* fix(install): auto-migrate setup scope changes

* feat(install): add guided multi-harness installer

* fix(install): sync Yarn binary metadata

* fix(install): handle wizard EOF on Node 18

* ci: allow installer matrix tests to finish

* test(install): allow slower PowerShell delegation

* fix(install): harden guided provider reconciliation

* test(install): harden packaged and local compatibility

* chore: prepare guided installer release 2.2.0

* fix(install): report refreshed Codex marketplace state

* fix(install): verify managed content provenance

* test(install): allow empty Yarn smoke fixture

* test(install): invoke Windows package shims safely

* fix(install): close cross-platform release gaps

* fix(install): require trusted GitHub origins

* fix(install): preserve hook profile precedence

* refactor(install): centralize trusted GitHub origins

* ci: retrigger workflow run after merge of main

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
2026-08-06 15:39:49 -04:00

56 lines
1.4 KiB
JavaScript

'use strict';
const assert = require('assert');
const {
normalizeGitHubGitOrigin,
} = require('../../scripts/lib/github-origin');
let passed = 0;
let failed = 0;
function test(name, fn) {
try {
fn();
console.log(`${name}`);
return true;
} catch (error) {
console.log(`${name}`);
console.log(` Error: ${error.message}`);
return false;
}
}
console.log('\nGitHub origin normalization');
if (test('accepts only authenticated or TLS GitHub origins', () => {
assert.strictEqual(
normalizeGitHubGitOrigin('https://github.com/affaan-m/ECC.git'),
'affaan-m/ecc'
);
assert.strictEqual(
normalizeGitHubGitOrigin('ssh://[email protected]/affaan-m/ECC/'),
'affaan-m/ecc'
);
assert.strictEqual(
normalizeGitHubGitOrigin('[email protected]:affaan-m/ECC.git'),
'affaan-m/ecc'
);
})) passed++; else failed++;
if (test('rejects shorthand and insecure or unrelated origins', () => {
assert.strictEqual(normalizeGitHubGitOrigin('affaan-m/ECC'), null);
assert.strictEqual(
normalizeGitHubGitOrigin('http://github.com/affaan-m/ECC.git'),
null
);
assert.strictEqual(
normalizeGitHubGitOrigin('https://example.com/affaan-m/ECC.git'),
null
);
assert.strictEqual(normalizeGitHubGitOrigin(null), null);
})) passed++; else failed++;
console.log(`\nPassed: ${passed}`);
console.log(`Failed: ${failed}`);
process.exit(failed > 0 ? 1 : 0);