Gitea-Client herausgelöst, Konfiguration für Organisation und System-Konto, Test-Nachbauten

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-09-30 10:21:34 +00:00
1 parent ea71b3f1c3
commit 531ee2a02b
6 files changed
+824 -47

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import { test, before, after } from 'node:test'
import assert from 'node:assert/strict'
import { startFakeGitea } from './helpers/fakeGitea.js'
let fake
let giteaFetch
let config
before(async () => {
fake = await startFakeGitea({ repos: [{ full_name: 'JUSN/D-ner-Nation' }] })
Object.assign(process.env, {
GITEA_BASE_URL: fake.baseUrl,
GITEA_API_TOKEN: 'test-token',
})
// config.js liest die Umgebung beim Import
;({ giteaFetch } = await import('../server/services/giteaClient.js'))
;({ config } = await import('../server/config.js'))
})
after(async () => {
await fake.close()
})
test('sendet den Token', async () => {
await giteaFetch('/repos/JUSN/D-ner-Nation')
assert.equal(fake.calls.at(-1).headers.authorization, 'token test-token')
})
test('404 hat status', async () => {
await assert.rejects(giteaFetch('/repos/x/y'), (e) => e.status === 404)
})
test('Voreinstellungen der Konfiguration', () => {
assert.equal(config.gitea.org, 'WEBklar')
assert.equal(config.gitea.systemUser, 'webklar-system')
assert.equal(config.gitea.backfillDays, 30)
assert.ok(config.gitea.keepInPlace.includes('JUSN/tickte-system'))
assert.equal(config.gitea.keepInPlace.length, 6)
})