forked from boos/BoosAPI
Preserve the active worktree snapshot on dev for follow-on integration
The root checkout already contained a large in-progress proxy, transformer, and settings refactor. This commit captures that exact work on a dedicated local dev branch without disturbing the original dirty worktree, so the changes can be continued or split from dev instead of living only as uncommitted state. Constraint: The source checkout was already dirty on another branch, so the move had to preserve that worktree while excluding local .idea and .omx residue from the commit Rejected: Switch the dirty root checkout directly to dev | risked disrupting the original branch and in-progress state Confidence: medium Scope-risk: broad Reversibility: clean Directive: Treat this as a transfer snapshot; fix the failing oauth/accountTokens/normalized/docs test regressions before merge or publication Tested: git diff --check; npm run typecheck; npm run repo:drift-check Not-tested: Clean test pass; npm test currently fails in oauth routes, accountTokens sync, shared normalized helpers, gemini route expectations, architecture-boundaries, and docs vitepress config
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
normalizeContributors,
|
||||
replaceContributorsSection,
|
||||
renderContributorsBlock,
|
||||
} from './update-readme-contributors.js';
|
||||
|
||||
describe('README contributors updater', () => {
|
||||
it('filters anonymous and bot contributors before rendering', () => {
|
||||
const contributors = normalizeContributors([
|
||||
{
|
||||
login: 'cita-777',
|
||||
html_url: 'https://github.com/cita-777',
|
||||
avatar_url: 'https://avatars.githubusercontent.com/u/177306803?v=4',
|
||||
contributions: 483,
|
||||
},
|
||||
{
|
||||
login: 'dependabot[bot]',
|
||||
html_url: 'https://github.com/apps/dependabot',
|
||||
avatar_url: 'https://avatars.githubusercontent.com/in/29110?v=4',
|
||||
contributions: 12,
|
||||
},
|
||||
{
|
||||
login: null,
|
||||
html_url: null,
|
||||
avatar_url: null,
|
||||
contributions: 22,
|
||||
},
|
||||
{
|
||||
login: 'Babylonehy',
|
||||
html_url: 'https://github.com/Babylonehy',
|
||||
avatar_url: 'https://avatars.githubusercontent.com/u/30937892?v=4',
|
||||
contributions: 3,
|
||||
},
|
||||
]);
|
||||
|
||||
expect(contributors).toEqual([
|
||||
{
|
||||
login: 'cita-777',
|
||||
htmlUrl: 'https://github.com/cita-777',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/177306803?v=4&s=48',
|
||||
},
|
||||
{
|
||||
login: 'Babylonehy',
|
||||
htmlUrl: 'https://github.com/Babylonehy',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/30937892?v=4&s=48',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('replaces the marked README section with an avatar wall', () => {
|
||||
const readme = [
|
||||
'# Metapi',
|
||||
'',
|
||||
'<!-- metapi-contributors:start -->',
|
||||
'old block',
|
||||
'<!-- metapi-contributors:end -->',
|
||||
'',
|
||||
'tail',
|
||||
].join('\n');
|
||||
|
||||
const next = replaceContributorsSection(readme, [
|
||||
{
|
||||
login: 'cita-777',
|
||||
htmlUrl: 'https://github.com/cita-777',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/177306803?v=4&s=48',
|
||||
},
|
||||
{
|
||||
login: 'Hureru',
|
||||
htmlUrl: 'https://github.com/Hureru',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/121702350?v=4&s=48',
|
||||
},
|
||||
{
|
||||
login: 'Babylonehy',
|
||||
htmlUrl: 'https://github.com/Babylonehy',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/30937892?v=4&s=48',
|
||||
},
|
||||
], 2);
|
||||
|
||||
expect(next).toContain('<p align="left">');
|
||||
expect(next).toContain('https://github.com/cita-777');
|
||||
expect(next).toContain('https://github.com/Hureru');
|
||||
expect(next).toContain('https://github.com/Babylonehy');
|
||||
expect(next).not.toContain('old block');
|
||||
expect(next).toContain('tail');
|
||||
});
|
||||
|
||||
it('renders contributors across multiple rows', () => {
|
||||
const html = renderContributorsBlock([
|
||||
{
|
||||
login: 'cita-777',
|
||||
htmlUrl: 'https://github.com/cita-777',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/177306803?v=4&s=48',
|
||||
},
|
||||
{
|
||||
login: 'Hureru',
|
||||
htmlUrl: 'https://github.com/Hureru',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/121702350?v=4&s=48',
|
||||
},
|
||||
{
|
||||
login: 'Babylonehy',
|
||||
htmlUrl: 'https://github.com/Babylonehy',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/30937892?v=4&s=48',
|
||||
},
|
||||
], 2);
|
||||
|
||||
expect(html).toContain('\n <a href="https://github.com/cita-777"');
|
||||
expect(html).toContain('\n <a href="https://github.com/Babylonehy"');
|
||||
expect((html.match(/\n <a href=/g) || []).length).toBe(2);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user