Additional tests

This commit is contained in:
Angelos Chalaris
2018-11-01 14:35:17 +02:00
parent e861766bd5
commit a097c3de36
3 changed files with 28 additions and 0 deletions

View File

@ -4,3 +4,7 @@ const {getColonTimeFromDate} = require('./_30s.js');
test('getColonTimeFromDate is a Function', () => {
expect(getColonTimeFromDate).toBeInstanceOf(Function);
});
test('Gets the time in the proper format.', () => {
let date = new Date();
expect(getColonTimeFromDate(date)).toEqual(date.toTimeString().slice(0, 8));
});

View File

@ -4,3 +4,18 @@ const {getMeridiemSuffixOfInteger} = require('./_30s.js');
test('getMeridiemSuffixOfInteger is a Function', () => {
expect(getMeridiemSuffixOfInteger).toBeInstanceOf(Function);
});
test('Gets the correct meridiem suffix.', () => {
expect(getMeridiemSuffixOfInteger(0)).toEqual('12am');
});
test('Gets the correct meridiem suffix.', () => {
expect(getMeridiemSuffixOfInteger(11)).toEqual('11am');
});
test('Gets the correct meridiem suffix.', () => {
expect(getMeridiemSuffixOfInteger(12)).toEqual('12pm');
});
test('Gets the correct meridiem suffix.', () => {
expect(getMeridiemSuffixOfInteger(13)).toEqual('1pm');
});
test('Gets the correct meridiem suffix.', () => {
expect(getMeridiemSuffixOfInteger(25)).toEqual('1pm');
});

View File

@ -4,3 +4,12 @@ const {initializeArrayWithRangeRight} = require('./_30s.js');
test('initializeArrayWithRangeRight is a Function', () => {
expect(initializeArrayWithRangeRight).toBeInstanceOf(Function);
});
test('Initializes an array containing the numbers in the specified range (witout start value)', () => {
expect(initializeArrayWithRangeRight(5)).toEqual([5, 4, 3, 2, 1, 0]);
});
test('Initializes an array containing the numbers in the specified range', () => {
expect(initializeArrayWithRangeRight(7, 3)).toEqual([7, 6, 5, 4, 3]);
});
test('Initializes an array containing the numbers in the specified range (with step)', () => {
expect(initializeArrayWithRangeRight(9, 0, 2)).toEqual([8, 6, 4, 2, 0]);
});