Last active
February 25, 2020 01:06
-
-
Save mlevkovsky/7067ed036eb9854cc7f039a886209b50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} | |
describe('Calculator', () => { | |
it('sums up two numbers properly', () => { | |
calculator = new Calculator(); | |
expect(calculator.add(2,2)).to.equal(4); | |
}); | |
// ✅test passes, bug is fixed, PM and stakeholders celebrate your genius | |
it('subtracts two numbers properly', () => { | |
calculator = new Calculator(); | |
expect(calculator.subtract(4,2)).to.equal(2); | |
expect(calculator.subtract(10,3)).to.equal(7); | |
expect(calculator.subtract(-4,2)).to.equal(-6); | |
expect(calculator.subtract(-4,-2)).to.equal(-2); | |
}); | |
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