From 24e2d3d3400dcdc84cd4659d2710e83e97a5700c Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Tue, 23 Jun 2026 16:15:48 +0000
Subject: [PATCH] adding route /api/ping
---
test/testApiPing.js | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/test/testApiPing.js b/test/testApiPing.js
new file mode 100644
index 0000000..21c4dca
--- /dev/null
+++ b/test/testApiPing.js
@@ -0,0 +1,40 @@
+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")
+ })
+
+ })
+
+})
+
+/////////////////////////////////////////////////////////////////////////
+
--
Gitblit v1.8.0