Skip to content

Instantly share code, notes, and snippets.

@hatelove
Last active October 10, 2022 20:59
Show Gist options
  • Save hatelove/f529ecc87391be44abea4e457034e90e to your computer and use it in GitHub Desktop.
Save hatelove/f529ecc87391be44abea4e457034e90e to your computer and use it in GitHub Desktop.
jest installation
yarn add --dev babel-jest @babel/core @babel/preset-env
module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
],
};
class Calculator {
sum(first, second) {
return first+second;
}
}
describe('calculator add', function () {
it('positive add positive', () => {
let calculator = new Calculator();
let sum = calculator.sum(1,2);
expect(sum).toBe(3);
});
});
yarn add --dev jest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment