const {assert} = require('@ciscospark/test-helper-chai'); function add(a, b){ return a + b; } //Test if add is called with arguments 4 and 5 add(4, 5); assert.calledWith(add, 4, 5);
const {assert} = require('@ciscospark/test-helper-chai'); function add(a, b){ return a + b; } describe('Addition tests', function(){ it('should return the sum of two numbers', function(){ assert.equal(add(4, 5), 9); }); it('should add negative numbers correctly', function(){ assert.equal(add(-4, -5), -9); }); });In the above example, we use the 'describe' method to group two related tests that check the behavior of the 'add' function. The first test checks if the function correctly adds two positive numbers, while the second test checks if it correctly adds two negative numbers. In conclusion, the '@ciscospark/test-helper-chai' package library provides useful assertion functions such as 'assert.calledWith' and 'describe' for testing Cisco Spark applications.