Xero Interview Question

Explain why need to write test in this code