From 380654ba6c16488cd5902eac165e30327422f051 Mon Sep 17 00:00:00 2001 From: Sj3rd <33723199+Sj3rd@users.noreply.github.com> Date: Mon, 25 Mar 2019 20:59:37 +0100 Subject: [PATCH] Update test.js to use authCode Cant login without ;) --- test/test.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index f6194ce..004c121 100644 --- a/test/test.js +++ b/test/test.js @@ -12,23 +12,26 @@ const options = { school: {}, username: undefined, password: undefined, + authCode: undefined } try { const parsed = require('./options.json') const isParent = parsed.parent != null - const { school, username, password } = parsed[isParent ? 'parent' : 'child'] + const { school, username, password, authCode } = parsed[isParent ? 'parent' : 'child'] options.isParent = isParent options.school = school options.username = username options.password = password + options.authCode = authCode } catch (e) { // For Travis CI we use environment variables. options.isParent = process.env.TEST_ISPARENT options.school.url = process.env.TEST_SCHOOLURL options.username = process.env.TEST_USERNAME options.password = process.env.TEST_PASSWORD + options.authCode = process.env.TEST_AUTHCODE } -if (!options.school.url || !options.username || !options.password) { +if (!options.school.url || !options.username || !options.password || !options.authCode) { throw new Error('No login information found.') } @@ -173,6 +176,21 @@ describe('Magister', function() { }) }) + describe('absence', function () { + it('should fetch absences', function () { + return m.absences(new Date()).then(r => { + expect(r).to.be.an('array') + + for (const absence of r) { + expect(absence).to.be.an.instanceof(magisterjs.AbsenceInfo) + expect(absence.appointment).to.be.a('object') + } + + return [] + }) + }) + }) + describe('activity', function () { // TODO: add test for `ActivityElement#signup`