fix(fortune): scope s5s fortune markup (#1150)

* fix(markdown): scope fortune markup to fortune boards

* fix(fortune): store fortune output as bbcode

* fix(fortune): keep legacy fortune rendering

* fix(tests): resolve catalog button mock merge

* fix(fortune): validate hidden fortune length
This commit is contained in:
Tommaso Casaburi
2026-06-03 13:49:35 +07:00
committed by GitHub
parent 84f357cba1
commit d09d2d05d1
16 changed files with 439 additions and 93 deletions
@@ -177,6 +177,24 @@ describe('interaction stores', () => {
expect(useChallengesStore.getState().challenges).toEqual([]);
});
it('redacts generated fortune content before storing challenge publications', async () => {
const publishChallengeAnswers = vi.fn();
const publication = {
content: 'body[fortune color=#fd4d32]Excellent Luck[/fortune]',
publishChallengeAnswers,
};
useChallengesStore.getState().addChallenge([{ challenges: [] }, publication] as never);
const storedChallenge = useChallengesStore.getState().challenges[0]?.challenge as unknown[] | undefined;
const storedPublication = storedChallenge?.[1] as typeof publication | undefined;
expect(storedPublication?.content).toBe('body');
expect(storedPublication?.content).not.toContain('Excellent Luck');
await storedPublication?.publishChallengeAnswers(['4']);
expect(publishChallengeAnswers).toHaveBeenCalledWith(['4']);
});
it('shows the disclaimer modal until accepted, then navigates directly on later opens', () => {
const navigate = vi.fn();