Skip to content

Commit

Permalink
08_calculator:Add more test cases for subtract and power (TheOdinProj…
Browse files Browse the repository at this point in the history
  • Loading branch information
damon314159 authored Sep 23, 2024
1 parent 7ff69d8 commit a12f311
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 08_calculator/calculator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ describe('subtract', () => {
test.skip('subtracts numbers', () => {
expect(calculator.subtract(10, 4)).toBe(6);
});

test.skip('subtracts negative numbers', () => {
expect(calculator.subtract(-10, -4)).toBe(-6);
});

test.skip('subtracts numbers of mixed parity', () => {
expect(calculator.subtract(-8, 7)).toBe(-15);
});
});

describe('sum', () => {
Expand Down Expand Up @@ -52,6 +60,10 @@ describe('power', () => {
test.skip('raises one number to the power of another number', () => {
expect(calculator.power(4, 3)).toBe(64); // 4 to third power is 64
});

test.skip('raises one number to the power of a large number', () => {
expect(calculator.power(3, 10)).toBe(59049); // 3 to tenth power is 59049
});
});

describe('factorial', () => {
Expand Down
12 changes: 12 additions & 0 deletions 08_calculator/solution/calculator-solution.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ describe('subtract', () => {
test('subtracts numbers', () => {
expect(calculator.subtract(10, 4)).toBe(6);
});

test('subtracts negative numbers', () => {
expect(calculator.subtract(-10, -4)).toBe(-6);
});

test('subtracts numbers of mixed parity', () => {
expect(calculator.subtract(-8, 7)).toBe(-15);
});
});

describe('sum', () => {
Expand Down Expand Up @@ -52,6 +60,10 @@ describe('power', () => {
test('raises one number to the power of another number', () => {
expect(calculator.power(4, 3)).toBe(64); // 4 to third power is 64
});

test('raises one number to the power of a large number', () => {
expect(calculator.power(3, 10)).toBe(59049); // 3 to tenth power is 59049
});
});

describe('factorial', () => {
Expand Down

0 comments on commit a12f311

Please sign in to comment.