From 174bd99957fa0566aa1f4ef3e122c7dcf484392f Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sun, 17 Apr 2011 10:03:45 +0200 Subject: Make logger.timeSheetRecordsPrinter testeable and add unit test. --- tests/test-logger.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/test-logger.js (limited to 'tests') diff --git a/tests/test-logger.js b/tests/test-logger.js new file mode 100644 index 0000000..2b087f8 --- /dev/null +++ b/tests/test-logger.js @@ -0,0 +1,39 @@ +/*global exports: false, require: false */ +/*jslint plusplus: false */ +"use strict"; +var xrpc = require("xmlrpc"); +var logMod = require("logger"); +var selfMod = require("self"); + +var testGenerateTimeSheetDataLogs = { + "2010-07-27+bugzilla.redhat.com+533567": { + "date": "2010-07-27T21:28:47.103Z", + "url": "https://bugzilla.redhat.com/show_bug.cgi?id=533567", + "title": "KMS:RS480:X200M - GPU lockup (screen goes black)", + "comment": "removing filled in chip type for Guadec" + }, + "2010-07-27+bugzilla.redhat.com+618769": { + "date": "2010-07-27T21:30:18.845Z", + "url": "https://bugzilla.redhat.com/show_bug.cgi?id=618769", + "title": "gdm and display unstable with ATI FirePro V3700 graphics card", + "comment": "asking for logs" + } +}; +var testGenerateTimeSheetResultStr = "\n\n"+ + "TimeSheet-2011-04-17\n\n\n

TimeSheet

\n"+ + "

2010-07-27

\n

"+ + "Bug RH/533567: "+ + "KMS:RS480:X200M - GPU lockup (screen goes black) \n
removing filled "+ + "in chip type for Guadec

\n

Bug RH/618769: "+ + "gdm and display unstable with ATI FirePro V3700 graphics card \n"+ + "
asking for logs

\n"; + +exports.ensureTimeSheetRecordsPrinter = function (test) { + logMod.initialize(JSON.parse(selfMod.data.load( + "bugzillalabelAbbreviations.json"))) + test.assertEqual(logMod.timeSheetRecordsPrinter(testGenerateTimeSheetDataLogs, + new Date("2011-04-17")), testGenerateTimeSheetResultStr, + "Generates correct log report from given data."); +}; + -- cgit