tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js in trackler-2.2.0.0 vs tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js in trackler-2.2.0.1
- old
+ new
@@ -1,13 +1,11 @@
import PerfectNumbers from './perfect-numbers';
describe('Exercise - Perfect Numbers', () => {
-
const perfectNumbers = new PerfectNumbers();
describe('Perfect Numbers', () => {
-
test('Smallest perfect number is classified correctly', () => {
expect(perfectNumbers.classify(6)).toEqual('perfect');
});
xtest('Medium perfect number is classified correctly', () => {
@@ -15,15 +13,13 @@
});
xtest('Large perfect number is classified correctly', () => {
expect(perfectNumbers.classify(33550336)).toEqual('perfect');
});
-
});
describe('Abundant Numbers', () => {
-
xtest('Smallest abundant number is classified correctly', () => {
expect(perfectNumbers.classify(12)).toEqual('abundant');
});
xtest('Medium abundant number is classified correctly', () => {
@@ -31,15 +27,13 @@
});
xtest('Large abundant number is classified correctly', () => {
expect(perfectNumbers.classify(33550335)).toEqual('abundant');
});
-
});
describe('Deficient Numbers', () => {
-
xtest('Smallest prime deficient number is classified correctly', () => {
expect(perfectNumbers.classify(2)).toEqual('deficient');
});
xtest('Smallest non-prime deficient number is classified correctly', () => {
@@ -55,23 +49,19 @@
});
xtest('Edge case (no factors other than itself) is classified correctly', () => {
expect(perfectNumbers.classify(1)).toEqual('deficient');
});
-
});
describe('Invalid Inputs', () => {
-
xtest('Zero is rejected (not a natural number)', () => {
expect(() => perfectNumbers.classify(0))
.toThrow('Classification is only possible for natural numbers.');
});
xtest('Negative integer is rejected (not a natural number)', () => {
expect(() => perfectNumbers.classify(-1))
.toThrow('Classification is only possible for natural numbers.');
});
-
});
-
});