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 POST /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: "POST", body: JSON.stringify({}), headers: { 'Content-Type': 'application/json', // Indicate JSON data }, }) // console.log(res) 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") }) }) }) /////////////////////////////////////////////////////////////////////////