From cb5a2bf3d2880c3aa0213bfd7f24b8f0e7aacc26 Mon Sep 17 00:00:00 2001 From: CLearERR Date: Wed, 3 May 2017 18:46:48 +0500 Subject: [PATCH 1/3] =?UTF-8?q?=D0=97=D0=B0=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B0=20=D0=B4?= =?UTF-8?q?=D0=B0=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- formatDate.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/formatDate.js b/formatDate.js index da8c1c3..d5ba90e 100644 --- a/formatDate.js +++ b/formatDate.js @@ -1,5 +1,9 @@ +const MONTHLIST = ['января', 'февраля', 'марта', 'апреля', 'мая','июня', 'июля', + 'августа', 'сентября','октября', 'ноября', 'декабря'] + function formatDate(date) { - // Напишите код форматирования даты в этом месте + if(!(arguments.length == 1)) + throw new Error('Некорректное число аргументов функции'); } module.exports = formatDate; From a6fbcd8772d9a87b35f2feb035d685c0c1e26832 Mon Sep 17 00:00:00 2001 From: CLearERR Date: Wed, 3 May 2017 18:47:20 +0500 Subject: [PATCH 2/3] =?UTF-8?q?=D0=97=D0=B0=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BC=D0=B5=D1=85=D0=B0=D0=BD=D0=B8=D0=B7=D0=BC=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20twe?= =?UTF-8?q?et=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- showTweets.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/showTweets.js b/showTweets.js index 7257166..d9117e0 100644 --- a/showTweets.js +++ b/showTweets.js @@ -1,8 +1,16 @@ const formatDate = require('./formatDate'); - +const request = require('request'); + function showTweets() { - // Здесь будет код, который получает твиты и - // выводит их на консоль + request('https://api.twitter.com/1.1/search/tweets.json?q=%23urfu-testing-2016', (err, resp, body) => { + if ((resp.statusCode !== 200) | err) { + console.error("Status: " + resp.statusCode + " Error: " + err) + return; + } + + body = JSON.parse(body); + console.log(body); + }); } - + module.exports = showTweets; From 553d1172edaac6e179398b6edd4a35972fe69b07 Mon Sep 17 00:00:00 2001 From: CLearERR Date: Wed, 3 May 2017 18:47:34 +0500 Subject: [PATCH 3/3] =?UTF-8?q?=D0=97=D0=B0=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/formatDate_tests.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/formatDate_tests.js diff --git a/tests/formatDate_tests.js b/tests/formatDate_tests.js new file mode 100644 index 0000000..146cb4e --- /dev/null +++ b/tests/formatDate_tests.js @@ -0,0 +1,11 @@ +const assert = require('assert'); +const formatDate = require('../formatDate'); + +it('should throw error `Некорректное число аргументов функции`', () => { + try { + formatDate('42', 'Сорок два'); + throw new Error('`formatDate` should throw error') + } catch (error) { + assert.equal(error.message, 'Некорректное число аргументов функции'); + } +});