From d6daa45e6c3ae18838bb5a7a4bda01a3236d56d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= <raimund.schluessler@mailbox.org> Date: Thu, 14 Nov 2019 20:47:34 +0100 Subject: [PATCH] Adjust storeHelper test to use actual Tasks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org> --- .../javascript/unit/store/storeHelper.spec.js | 74 ++++++++++++++----- 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/tests/javascript/unit/store/storeHelper.spec.js b/tests/javascript/unit/store/storeHelper.spec.js index af0ccfdf..e4a05061 100644 --- a/tests/javascript/unit/store/storeHelper.spec.js +++ b/tests/javascript/unit/store/storeHelper.spec.js @@ -1,24 +1,61 @@ import { sort } from '../../../../src/store/storeHelper' +import Task from '../../../../src/models/task' -const tasks = [ - { - id: 1, - due: '20191119T183901' - }, - { - id: 2, - due: '20181119T183901' - }, - { - id: 3, - due: null - }, - { - id: 4, - due: '20151119T183901' - }, +const vCalendars = [` +BEGIN:VCALENDAR\n +VERSION:2.0\n +PRODID:-//Nextcloud Tasks 0.11.3\n +BEGIN:VTODO\n +CREATED:20170101T180000\n +DTSTAMP:20180101T180000\n +LAST-MODIFIED:20180101T180000\n +UID:task01\n +SUMMARY:Test 1\n +DUE:20191119T183901\n +END:VTODO\n +END:VCALENDAR`, +` +BEGIN:VCALENDAR\n +VERSION:2.0\n +PRODID:-//Nextcloud Tasks 0.11.3\n +BEGIN:VTODO\n +CREATED:20170101T180000\n +DTSTAMP:20180101T180000\n +LAST-MODIFIED:20180101T180000\n +UID:task02\n +SUMMARY:Test 1\n +DUE:20181119T183901\n +END:VTODO\n +END:VCALENDAR`, +` +BEGIN:VCALENDAR\n +VERSION:2.0\n +PRODID:-//Nextcloud Tasks 0.11.3\n +BEGIN:VTODO\n +CREATED:20170101T180000\n +DTSTAMP:20180101T180000\n +LAST-MODIFIED:20180101T180000\n +UID:task03\n +SUMMARY:Test 1\n +END:VTODO\n +END:VCALENDAR`, +` +BEGIN:VCALENDAR\n +VERSION:2.0\n +PRODID:-//Nextcloud Tasks 0.11.3\n +BEGIN:VTODO\n +CREATED:20170101T180000\n +DTSTAMP:20180101T180000\n +LAST-MODIFIED:20180101T180000\n +UID:task04\n +SUMMARY:Test 1\n +DUE:20151119T183901\n +END:VTODO\n +END:VCALENDAR`, ] +const tasks = vCalendars.map((vCalendar) => {new Task(vCalendar) }) + describe('storeHelper', () => { 'use strict' @@ -35,7 +72,4 @@ describe('storeHelper', () => { const receivedTasks = sort(clonedTasks, 'due', 1) expect(receivedTasks).toEqual(expectedTasks) }) - - it("Tests if correct tasks are found for the 'current' collection.", () => { - }) })