Files
30-seconds-of-code/test/initializeArrayWithValues.test.js
Angelos Chalaris 7f019cf3ed Additional tests
2018-11-01 14:47:28 +02:00

13 lines
512 B
JavaScript

const expect = require('expect');
const {initializeArrayWithValues} = require('./_30s.js');
test('initializeArrayWithValues is a Function', () => {
expect(initializeArrayWithValues).toBeInstanceOf(Function);
});
test('Initializes and fills an array with the specified values', () => {
expect(initializeArrayWithValues(5, 2)).toEqual([2, 2, 2, 2, 2]);
});
test('Initializes and fills an array with the specified values (no fill)', () => {
expect(initializeArrayWithValues(5)).toEqual([0, 0, 0, 0, 0]);
});