Skip to content

Instantly share code, notes, and snippets.

@rahulmalhotra
Created October 4, 2020 05:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulmalhotra/25e7e777265f9f0aa90d532e5deecccd to your computer and use it in GitHub Desktop.
Save rahulmalhotra/25e7e777265f9f0aa90d532e5deecccd to your computer and use it in GitHub Desktop.
This code snippet is used in Testing JavaScript Code using Jasmine JavaScript Tutorial on SFDC Stop
describe('Testing Calculator...', function() {
// * Positive Test Cases
it('Testing Add Function Positive', function() {
expect(add(2, 2)).toBe(4);
});
it('Testing Sub Function Positive', function() {
expect(sub(2, 2)).toBe(0);
});
it('Testing Mul Function Positive', function() {
expect(mul(2, 2)).toBe(4);
});
it('Testing Div Function Positive', function() {
expect(div(2, 2)).toBe(1);
});
// * Negative Test Cases
it('Testing Add Function Negative', function() {
expect(add(2, 2)).not.toBe(0);
});
it('Testing Sub Function Negative', function() {
expect(sub(2, 2)).not.toBe(4);
});
it('Testing Mul Function Negative', function() {
expect(mul(2, 2)).not.toBe(1);
});
it('Testing Div Function Negative', function() {
expect(div(2, 2)).not.toBe(4);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment