import { createGitBackend } from '../../server/fork/git/index.js'; import { configureGitHooks } from '../../server/fork/git/hooks.js'; const KEY = Buffer.alloc(32, 7).toString('base64'); const boot = (env)=>{ const logger = { warn: jest.fn(), info: jest.fn(), error: jest.fn() }; createGitBackend({ getStorage: ()=>({}), api: {}, splitTextStyleAndMetadata: ()=>({}), env, logger }); configureGitHooks(undefined); return logger; }; describe('Git-Backend: Startlog (FLW-258)', ()=>{ test('ohne Schlüssel: Warnung, keine Info-Zeile', ()=>{ const l = boot({}); expect(l.warn).toHaveBeenCalledWith(expect.stringMatching(/deaktiviert.*HB_GIT_TOKEN_KEY/)); expect(l.info).not.toHaveBeenCalled(); }); test('mit Schlüssel: Info mit kid und Allowlist, ohne Secrets', ()=>{ const l = boot({ HB_GIT_TOKEN_KEY: KEY, HB_GIT_ALLOWED_HOSTS: 'git.example.org' }); expect(l.warn).not.toHaveBeenCalled(); const line = l.info.mock.calls[0][0]; expect(line).toMatch(/aktiv \(kid=[0-9a-f]{8}.*Host-Allowlist: ja/); expect(line).not.toContain(KEY); }); test('ohne Allowlist: „nein“', ()=>{ expect(boot({ HB_GIT_TOKEN_KEY: KEY }).info.mock.calls[0][0]).toMatch(/Host-Allowlist: nein/); }); });