This commit is contained in:
Alvin-Zilverstand committed 2026-11-10 13:54:19 +01:00
1 parent 76a4db6a9e
commit 783c95b797
21 files changed
+1245 -46

No files matched your search

+15 -4
View File
@@ -14,10 +14,11 @@ test('Evidence mappings use real process IDs and complete translations', () => {
for (const e of p.evidence) {
assert.ok(e.codes.every(c => ids.has(c)), e.path);
assert.ok(e.label.length === 2 && e.label.every(Boolean));
const url = new URL(source(e.path, e.directory));
assert.equal(url.hostname, 'github.com');
assert.ok(url.pathname.includes(revision));
assert.equal(decodeURIComponent(url.pathname.split(`${revision}/`)[1]), e.path);
const url = new URL(source(e.path, e.directory, p));
const pin = p.repository?.revision || revision;
assert.equal(url.hostname, p.repository ? new URL(p.repository.url).hostname : 'github.com');
assert.ok(url.pathname.includes(pin));
assert.equal(decodeURIComponent(url.pathname.split(`${pin}/`)[1]), e.path);
}
}
});
@@ -26,3 +27,13 @@ test('Collaboration gaps remain explicit rather than claiming unsupported eviden
assert.ok(!projects.some(p => p.evidence.some(e => e.codes.includes(code))));
}
});
test('Repository links distinguish GitHub and Gitea and encode paths', () => {
const revision = 'a'.repeat(40);
const github = { repository: { url: 'https://github.com/example/repo', revision, forge: 'github' } };
const gitea = { repository: { url: 'https://codealvin.xyz/example/repo', revision, forge: 'gitea' } };
assert.equal(source('a b/test.md', false, github), github.repository.url + '/blob/' + revision + '/a%20b/test.md');
assert.equal(source('', true, github), github.repository.url + '/tree/' + revision);
assert.equal(source('src', true, gitea), gitea.repository.url + '/src/commit/' + revision + '/src');
assert.equal(source('a b.md', false, gitea), gitea.repository.url + '/src/commit/' + revision + '/a%20b.md');
});