Unit testing tests individual units of code to ensure they function as expected, functional testing tests slices of application functionality, and tests should be written before, during, and after development for planning, debugging, and verifying functionality. Mocha and Chai are popular JavaScript testing frameworks that allow writing tests using describe and it blocks, with Chai providing assertion syntax, and Sinon can be used to spy on and stub functions to isolate code for testing.