Final fixes, all tests running

This commit is contained in:
Angelos Chalaris
2018-06-18 20:41:57 +03:00
parent 977adb1198
commit e9594e6355
49 changed files with 2189 additions and 1198 deletions

View File

@ -4,30 +4,30 @@ const words = require('./words.js');
test('words is a Function', () => {
expect(words).toBeInstanceOf(Function);
});
test('words('I love javaScript!!') returns [I, love, javaScript]', () => {
test('words(\'I love javaScript!!\') returns [I, love, javaScript]', () => {
expect(words('I love javaScript!!')).toEqual(["I", "love", "javaScript"]);
});
test('words('python, javaScript & coffee') returns [python, javaScript, coffee]', () => {
test('words(\'python, javaScript & coffee\') returns [python, javaScript, coffee]', () => {
expect(words('python, javaScript & coffee')).toEqual(["python", "javaScript", "coffee"]);
});
test('words(I love javaScript!!) returns an array', () => {
expect(Array.isArray(words('I love javaScript!!'))).toBeTruthy();
});
test('words() throws an error', () => {
expect(words()).toThrow();
expect(() => { words(); }).toThrow();
});
test('words(null) throws an error', () => {
expect(words(null)).toThrow();
expect(() => { words(null); }).toThrow();
});
test('words(undefined) throws an error', () => {
expect(words(undefined)).toThrow();
expect(() => { words(undefined); }).toThrow();
});
test('words({}) throws an error', () => {
expect(words({})).toThrow();
expect(() => { words({}); }).toThrow();
});
test('words([]) throws an error', () => {
expect(words([])).toThrow();
expect(() => { words([]); }).toThrow();
});
test('words(1234) throws an error', () => {
expect(words(1234)).toThrow();
expect(() => { words(1234); }).toThrow();
});