khcanvas_test.js 989 Bytes
//@ts-check
//https://github.com/gatoona/AWS-Selenium

const canvas = require('../khcanvas')
const rd = require('readline')
const mocha = require('mocha')
const process = require('node:process')
const util = require('util')
const assert = require('assert')

mocha.describe('khcanvas', () => {
    mocha.it('get schedule', async () => {
        const rl = rd.createInterface({
            input: process.stdin,
            output: process.stdout
        })

        const question = util.promisify(rl.question).bind(rl);

        const fs = require('fs');
        const tokens = JSON.parse(fs.readFileSync("setting.json"))
        const a = tokens.id
        const b = tokens.pw

        return await canvas.get_schedule(a, b, new Date())
            .then(it => { 
                console.log("log at: ")
                console.log(it)
             })
            .catch(it => {
                console.log("log at (2): " + it)
                assert.rejects(it)
            })
    })
});