You are given a small React + TypeScript project with a Mocha test runner (and an autograder). The task is a practical front-end mini-project (not algorithm-heavy).
Implement a React component (and any helper utilities you need) to retrieve and display a hidden flag.
Support both retrieval modes:
data-flag="..."
(attribute contains the full flag string), OR
id="flag"
whose
textContent
is the flag.
display:none
,
hidden
, etc.). You must still find it.
GET <flagUrl>
returns either:
{ "flag": "FLAG{...}" }
, or
FLAG{...}
Once the flag is obtained, display it character-by-character in the UI.
<div data-testid="flag-output">...</div>
Even if the component re-renders (state/props changes), the typewriter animation must not restart once it has completed.
document
may not exist in some tests).
Write Mocha tests (or structure your code so it passes an autograder) to validate:
data-flag
and
#flag
cases.
FlagViewer
) and helper functions.
Login required