From 5570c76f16f8069f3a81044784842f6dbd1aaf66 Mon Sep 17 00:00:00 2001 From: Li Zhineng Date: Wed, 2 Jul 2025 20:57:59 +0800 Subject: stub eagle online handler --- server.test.mjs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'server.test.mjs') diff --git a/server.test.mjs b/server.test.mjs index 1e44083..619d29f 100644 --- a/server.test.mjs +++ b/server.test.mjs @@ -142,6 +142,19 @@ test('device registration endpoint returns not found if path is not supported', assert.strictEqual(res.status, 404) }) +test('device status endpoint', async () => { + const params = new URLSearchParams({ + source: 5, + reqid: '0000000000', + eagleId: 1, + path: 'eagle/GET/online', + params: '{}', + sig: '00000000000000000000000000000000' + }) + const res = await fetch(`${baseUrl}/eagle?${params.toString()}`) + assert.strictEqual(res.status, 200) +}) + test('exchange endpoint', async () => { const stubMacAddress = '0000000000' const stubKey = '00000000000000000000000000000000' -- cgit v1.2.3 From 72643a9424fc8e71d0360d710581c194fe6ba945 Mon Sep 17 00:00:00 2001 From: Li Zhineng Date: Wed, 2 Jul 2025 21:29:05 +0800 Subject: improve test --- server.test.mjs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'server.test.mjs') diff --git a/server.test.mjs b/server.test.mjs index 619d29f..24437b6 100644 --- a/server.test.mjs +++ b/server.test.mjs @@ -153,6 +153,9 @@ test('device status endpoint', async () => { }) const res = await fetch(`${baseUrl}/eagle?${params.toString()}`) assert.strictEqual(res.status, 200) + const data = await res.json() + assert.strictEqual(data.data.snow, 1) + assert.strictEqual(data.data.eagle, 1) }) test('exchange endpoint', async () => { -- cgit v1.2.3