Skip to content

Instantly share code, notes, and snippets.

@mlevkovsky
Last active February 25, 2020 01:04
Show Gist options
  • Save mlevkovsky/8d7ff4e9a0016423034ea1b3c3d5698f to your computer and use it in GitHub Desktop.
Save mlevkovsky/8d7ff4e9a0016423034ea1b3c3d5698f to your computer and use it in GitHub Desktop.
export class Calculator {
public add(firstAddend: number, secondAddend: number): number {
return firstAddend + secondAddend;
}
public subtract(minuend: number, subtrahend: number): number {
return minuend + subtrahend;
}
public multiply(firstFactor: number, secondFactor: number): number {
return firstFactor * secondFactor;
}
}
// ✅test passes, we're all happy
describe('Calculator', () => {
it('sums up two numbers properly', () => {
calculator = new Calculator();
expect(calculator.add(2,2)).to.equal(4);
});
it('subtracts two numbers properly', () => {
calculator = new Calculator();
expect(calculator.subtract(0,0)).to.equal(0);
});
it('multiplies two numbers properly', () => {
calculator = new Calculator();
expect(calculator.subtract(2,2)).to.equal(4);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment