feat(flags): add comment flags (#1140)

* feat(flags): add comment flags

* fix(flags): address review feedback

* fix(flags): clear stale flag publish data
This commit is contained in:
Tommaso Casaburi
2026-05-24 23:14:36 +07:00
committed by GitHub
parent 804c14fc35
commit f74b33f43b
66 changed files with 1293 additions and 74 deletions
+38
View File
@@ -0,0 +1,38 @@
import { describe, expect, it } from 'vitest';
import { getBoardFlagDefinition, normalizeBoardFlagKind } from '../board-flags';
describe('board-flags', () => {
it('normalizes board flag kind aliases', () => {
expect(normalizeBoardFlagKind('pol')).toBe('pol');
expect(normalizeBoardFlagKind('memeflags')).toBe('pol');
expect(normalizeBoardFlagKind('mlp')).toBe('pony');
expect(normalizeBoardFlagKind('unknown')).toBeUndefined();
});
it('maps political flags to the flags-2 sprite grid', () => {
expect(getBoardFlagDefinition('pol', 'AC')).toMatchObject({
code: 'AC',
label: 'Anarcho-Capitalist',
spritePath: 'assets/icons/flags-2.png',
width: 16,
height: 12,
x: 0,
y: 0,
});
expect(getBoardFlagDefinition('pol', 'WP')).toMatchObject({ code: 'WP', x: 64, y: 48 });
});
it('maps pony flags to the flags-pony sprite grid', () => {
expect(getBoardFlagDefinition('pony', '4CC')).toMatchObject({
code: '4CC',
label: '4cc /mlp/',
spritePath: 'assets/icons/flags-pony.png',
width: 16,
height: 16,
x: 0,
y: 0,
});
expect(getBoardFlagDefinition('pony', 'AJ')).toMatchObject({ code: 'AJ', label: 'Applejack', x: 80, y: 0 });
expect(getBoardFlagDefinition('pony', 'ZS')).toMatchObject({ code: 'ZS', label: 'Zipp Storm', x: 16, y: 144 });
});
});