Add tests for some archive snippets
This commit is contained in:
@ -4,3 +4,9 @@ const {isArmstrongNumber} = require('./_30s.js');
|
||||
test('isArmstrongNumber is a Function', () => {
|
||||
expect(isArmstrongNumber).toBeInstanceOf(Function);
|
||||
});
|
||||
test('isArmstrongNumber returns true', () => {
|
||||
expect(isArmstrongNumber(1634)).toBeTruthy();
|
||||
});
|
||||
test('isArmstrongNumber returns false', () => {
|
||||
expect(isArmstrongNumber(56)).toBeFalsy();
|
||||
});
|
||||
|
||||
@ -4,3 +4,9 @@ const {isSimilar} = require('./_30s.js');
|
||||
test('isSimilar is a Function', () => {
|
||||
expect(isSimilar).toBeInstanceOf(Function);
|
||||
});
|
||||
test('isSimilar returns true', () => {
|
||||
expect(isSimilar('rt', 'Rohit')).toBeTruthy();
|
||||
});
|
||||
test('isSimilar returns false', () => {
|
||||
expect(isSimilar('tr', 'Rohit')).toBeFalsy();
|
||||
});
|
||||
|
||||
@ -4,3 +4,9 @@ const {solveRPN} = require('./_30s.js');
|
||||
test('solveRPN is a Function', () => {
|
||||
expect(solveRPN).toBeInstanceOf(Function);
|
||||
});
|
||||
test('solveRPN returns the correct result', () => {
|
||||
expect(solveRPN('15 7 1 1 + - / 3 * 2 1 1 + + -')).toBe(5);
|
||||
});
|
||||
test('solveRPN returns the correct result', () => {
|
||||
expect(solveRPN('2 3 ^')).toBe(8);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user