Problem Statement
How do you write and run tests using Mocha?
Explanation
Mocha is a JavaScript test framework that runs in Node.js and browsers. Tests are written using describe/it blocks and assertions from Chai or Assert. Run with `npx mocha` or configure in npm scripts.
Code Solution
SolutionRead Only
const assert=require('assert');
describe('Array',()=>{
it('should return -1 when value not found',()=>{
assert.equal([1,2,3].indexOf(4),-1);
});
});