From 7ec581b6276b26fa9515145ac0dcaf6ced6f3f9a Mon Sep 17 00:00:00 2001 From: Preston Doman Date: Tue, 5 Mar 2019 16:20:06 -0800 Subject: [PATCH] Finish displayListOfReports tests --- front/static/js/testObjects.js | 4 +++- front/static/tests/qunit_tests.html | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/front/static/js/testObjects.js b/front/static/js/testObjects.js index 0278d85..d9284d0 100644 --- a/front/static/js/testObjects.js +++ b/front/static/js/testObjects.js @@ -39,4 +39,6 @@ const typeEditExpectedHTML = ``; -const displayReportsTwoReportsExpected = `
TitleDate CreatedDate SubmittedAction
TEST13/5/2019TBD
TEST23/5/2019TBD
`; \ No newline at end of file +const displayReportsTwoReportsExpected = `
TitleDate CreatedDate SubmittedAction
TEST13/5/2019TBD
TEST23/5/2019TBD
`; + +const displayReportsOneViewableExpected = `
TitleDate CreatedDate SubmittedAction
TEST23/5/20193/5/2019
`; diff --git a/front/static/tests/qunit_tests.html b/front/static/tests/qunit_tests.html index ecd21d9..d8db4b5 100644 --- a/front/static/tests/qunit_tests.html +++ b/front/static/tests/qunit_tests.html @@ -422,7 +422,7 @@ assert.deepEqual(cardBody.outerHTML.replace(/>\s+<"), expectedHTML, "card body and expectedHTML are identical"); }); - QUnit.test("one report", function(assert) { + QUnit.test("one editable report", function(assert) { let parsedData = {"reports": [{"date_created": "2019-03-05T08:00:00Z", "title": "TEST1", "reference_number": "1234", "date_submitted": "2019-03-05T08:00:00Z", "user_id": 2, "submitted": false, "report_pk": 4}]}; let expectedHTML = displayReportsOneReportExpected; displayListOfReports(parsedData); @@ -431,13 +431,21 @@ }); - QUnit.test("two reports", function(assert) { + QUnit.test("two editable reports", function(assert) { let parsedData = {"reports": [{"date_created": "2019-03-05T08:00:00Z", "title": "TEST1", "reference_number": "1234", "date_submitted": "2019-03-05T08:00:00Z", "user_id": 2, "submitted": false, "report_pk": 4}, {"date_created": "2019-03-05T08:00:00Z", "title": "TEST2", "reference_number": "12345", "date_submitted": "2019-03-05T08:00:00Z", "user_id": 2, "submitted": false, "report_pk": 5}]}; let expectedHTML = displayReportsTwoReportsExpected; displayListOfReports(parsedData); let cardBody = document.querySelector(".card-body"); assert.deepEqual(cardBody.outerHTML.replace(/>\s+<"), expectedHTML, "card body and expectedHTML are identical"); }); + + QUnit.test("one viewable report", function(assert) { + let parsedData = {"reports": [{"date_created": "2019-03-05T08:00:00Z", "title": "TEST2", "reference_number": "12345", "date_submitted": "2019-03-05T08:00:00Z", "user_id": 2, "submitted": true, "report_pk": 5}]}; + let expectedHTML = displayReportsOneViewableExpected; + displayListOfReports(parsedData); + let cardBody = document.querySelector(".card-body"); + assert.deepEqual(cardBody.outerHTML.replace(/>\s+<"), expectedHTML, "card body and expectedHTML are identical"); + });