Files
forge/web_src/js/features/repo-actions.test.ts
zeekayandHanzo Dev b8db2962cd Remove the upstream name from tooling, dashboards and issue templates
The Grafana mixin queried gitea_* while modules/metrics/collector.go emits
hanzogit_*, so every stat panel rendered empty with no error. All twelve
queried names now match names the collector registers.

Issue templates sent security reports to [email protected] and help requests
to upstream's Discord and forum, which SECURITY.md explicitly tells people not
to do; both now point at [email protected] and our docs, and the issue search
points at this repository. FUNDING.yml routed sponsorship to upstream's Open
Collective, so it is gone.

The VS Code build task wrote ./gitea. The Makefile, the README beside it and
.gitignore all say gitd.

Frontend: initGiteaFomantic, initGiteaAPIViewer and isGiteaError renamed for
what they do; the Fomantic hard-fork markers read FORGE-PATCH; base.css named
:gitea: as a CUSTOM_EMOJIS example, but the defaults are git, gitlab and github.

Container paths are deliberately untouched. /data/gitea is GIT_WORK_DIR's
default in docker/root/usr/local/bin/gitd, the deployment does not set
GIT_WORK_DIR, and SSH_SERVER_HOST_KEYS is a relative path -- moving the work
directory regenerates the host keys and every existing clone reports a changed
host identity. /var/lib/gitea, /etc/gitea, gitea.db and
gitea-trusted-user-ca-keys.pem keep their names because the matching defaults
live in modules/setting, and a path renamed on one side only is a server that
starts and then cannot find its own files.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-08 19:55:51 -07:00

31 lines
1.7 KiB
TypeScript

import {updateWorkflowBadgeFields} from './repo-actions.ts';
test('updateWorkflowBadgeFields updates badge snippets for selected branch', () => {
document.body.innerHTML = `
<div
data-badge-url="https://forge.example.com/user1/repo1/actions/workflows/build/test%20workflow.yml/badge.svg?branch=main"
data-workflow-url="https://forge.example.com/user1/repo1/actions?workflow=build%2Ftest+workflow.yml"
data-workflow-display-name="CI [prod]\\build &quot;fast&quot; &lt;ok&gt;"
>
<img data-workflow-badge-image src="">
<input id="workflow-badge-url" readonly>
<textarea id="workflow-badge-markdown" readonly></textarea>
<textarea id="workflow-badge-html" readonly></textarea>
</div>
`;
const form = document.querySelector<HTMLElement>('[data-badge-url]')!;
updateWorkflowBadgeFields(form, 'release/1.0 & hotfix');
const badgeURL = 'https://forge.example.com/user1/repo1/actions/workflows/build/test%20workflow.yml/badge.svg?branch=release%2F1.0+%26+hotfix';
expect(form.querySelector<HTMLImageElement>('[data-workflow-badge-image]')!.src).toBe(badgeURL);
expect(form.querySelector<HTMLInputElement>('#workflow-badge-url')!.value).toBe(badgeURL);
expect(form.querySelector<HTMLTextAreaElement>('#workflow-badge-markdown')!.value).toBe(
`[![CI \\[prod\\]\\\\build "fast" <ok>](${badgeURL})](https://forge.example.com/user1/repo1/actions?workflow=build%2Ftest+workflow.yml)`,
);
expect(form.querySelector<HTMLTextAreaElement>('#workflow-badge-html')!.value).toBe(
`<a href="https://forge.example.com/user1/repo1/actions?workflow=build%2Ftest+workflow.yml"><img src="${badgeURL}" alt="CI [prod]\\build &quot;fast&quot; &lt;ok&gt;"></a>`,
);
});