chore(flags): derive flag-test coords from board-flags source (#1165)

* feat(board-header): show subtitle on /all view

Add all_subtitle copy and render it in the board header when browsing
the aggregated all-directories feed.

* chore(flags): derive flag-test coords from board-flags source

comment-flags.test.ts hard-coded the pol/pony sprite x/y, duplicating the literals already pinned in board-flags.test.ts. A recent sprite remap updated one file and not the other, leaving master red. Derive the coords from getBoardFlagDefinition (the same source the runtime uses) so the assertion can't drift; labels stay literal as readable pins, and board-flags.test.ts remains the single place pinning the actual values.
This commit is contained in:
Tommaso Casaburi
2026-06-08 22:47:04 +07:00
committed by GitHub
parent 182ff0eadc
commit 075b917c36
38 changed files with 82 additions and 40 deletions
+8 -2
View File
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest';
import { getCommentFlagFlairs, getAuthorFlagFlairs, getAuthorFlagViewModels, TOR_AUTHOR_FLAG_LABEL_KEY } from '../comment-flags';
import { getBoardFlagDefinition } from '../board-flags';
describe('comment-flags', () => {
it('parses the pkc-js challenge flair example for country flags', () => {
@@ -21,8 +22,13 @@ describe('comment-flags', () => {
const flags = getAuthorFlagViewModels([{ text: 'flag:country:DE' }, { text: 'flag:pol:AC' }, { text: 'flag:pony:AJ' }], 1000);
expect(flags.map((flag) => flag.key)).toEqual(['country:de', 'pol:AC', 'pony:AJ']);
expect(flags[1]).toMatchObject({ label: 'Anarcho-Capitalist', x: 0, y: 0 });
expect(flags[2]).toMatchObject({ label: 'Applejack', x: 48, y: 0 });
// Pin the human-readable labels here, but derive the sprite coords from the board-flags source of
// truth so this test can't drift when the sheet is remapped (board-flags.test.ts pins the values).
const politicalFlag = getBoardFlagDefinition('pol', 'AC');
const ponyFlag = getBoardFlagDefinition('pony', 'AJ');
expect(flags[1]).toMatchObject({ label: 'Anarcho-Capitalist', x: politicalFlag?.x, y: politicalFlag?.y });
expect(flags[2]).toMatchObject({ label: 'Applejack', x: ponyFlag?.x, y: ponyFlag?.y });
});
it('labels the xx country flag as Tor traffic', () => {