3 files modified
1 files added
| | |
| | | }) |
| | | }) |
| | | |
| | | |
| | | /////// USER //////////////////////////////////////////////////////////////// |
| | | |
| | | fastify |
| | |
| | | } |
| | | }) |
| | | |
| | | /////// system //////////////////////////////////////////////////////////////// |
| | | |
| | | .get("/api/ping", async function (req, res) { |
| | | try { |
| | | const res2 = await libIlias.ping() |
| | | return res.send(res2) |
| | | } catch (err) { |
| | | console.error(err) |
| | | return res.code(500).send({status: "error", error: err.toString()}) |
| | | } |
| | | }) |
| | | |
| | | |
| | | /////// STATIC / SPA //////////////////////////////////////////////////////////////// |
| | |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | describe("the function anmelden", function () { |
| | | describe.skip("the function anmelden", function () { |
| | | |
| | | const kurs = testData.kurs // TODO |
| | | const user = testData.user |
| | |
| | | beforeEach(async function () { |
| | | // const {usr_id:userId} = await libIlias.importIliasUser(user) |
| | | const userRes = await libIlias.importIliasUser(user) |
| | | const kursRes = await libIlias. |
| | | // const kursRes = await libIlias. |
| | | console.log(data) |
| | | }) |
| | | |
| | | afterEach(async function () { |
| | | // await libIlias.deleteUser(userId) |
| | | await libIlias.deleteUser(userId) |
| | | // TODO delete kurs |
| | | }) |
| | | |
| | |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | describe("the function anmelden", function () { |
| | | describe.skip("the function anmelden", function () { |
| | | |
| | | const kurs = testData.kurs // TODO |
| | | const user = testData.user |
| New file |
| | |
| | | const expect = require("chai").expect |
| | | |
| | | const settings = require("../settings") |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | function getUrl(ref_id) { |
| | | return `http://localhost:${settings.port}/api/ping?token=${settings.authtoken}` |
| | | } |
| | | |
| | | const ref_id = 595 |
| | | |
| | | describe("using the API", function () { |
| | | |
| | | describe("the Route GET /api/ping", function () { |
| | | |
| | | it("should return an answer from php component", async function () { |
| | | const url = getUrl(ref_id) |
| | | console.log(url) |
| | | const res = await fetch(url, { |
| | | method: "GET", |
| | | // body: JSON.stringify({}), |
| | | headers: { |
| | | 'Content-Type': 'application/json', // Indicate JSON data |
| | | }, |
| | | }) |
| | | const data = await res.json() |
| | | // console.log(data) |
| | | |
| | | expect(data).to.be.a("object") |
| | | expect(data.status).to.equal("ok") |
| | | expect(data.msg).to.equal("pong") |
| | | }) |
| | | |
| | | }) |
| | | |
| | | }) |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |