Create a React user profile form in TypeScript. Keep API logic outside the component, handle loading and error states, and include tests for one success path and one validation failure path.
