Always Follow AAA Pattern When Writing Tests
Following is a very simple unit test which verifies if the add() function works correctly. While the test works, but it does not follow the AAA(Arrange, Act, Assert) pattern. import {it, expect} from 'vitest'; import { add } from './math'; it('should summarize all number values in an array', ()=>{ const result = add([1,2,3]) expect(result).toBe(6) }); Question: What is AAA (Arrange, Act, Assert) pattern in testing? AAA pattern allows you to write unit tests which are more readable and maintainable in long term....