Fix jwt-token
This commit is contained in:
@@ -254,10 +254,10 @@ describe('Device Routes', () => {
|
|||||||
const token = generateTestToken(admin, tenant);
|
const token = generateTestToken(admin, tenant);
|
||||||
|
|
||||||
const invalidPayloads = [
|
const invalidPayloads = [
|
||||||
{}, // Missing all fields
|
{}, // Missing device ID (required)
|
||||||
{ name: 'No ID Device' }, // Missing device ID
|
{ id: 'not-a-number' }, // Invalid ID type
|
||||||
{ id: 123 }, // Missing name
|
{ id: 0 }, // ID too small
|
||||||
{ id: 123, name: 'No Location' } // Missing coordinates
|
{ id: 1000000000 } // ID too large
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const payload of invalidPayloads) {
|
for (const payload of invalidPayloads) {
|
||||||
@@ -514,6 +514,17 @@ describe('Device Routes', () => {
|
|||||||
drone_type: 2
|
drone_type: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Simulate heartbeat
|
||||||
|
await models.Heartbeat.create({
|
||||||
|
device_id: device.id,
|
||||||
|
timestamp: new Date(),
|
||||||
|
battery_level: 85,
|
||||||
|
signal_strength: -45
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update device last_heartbeat
|
||||||
|
await device.update({ last_heartbeat: new Date() });
|
||||||
|
|
||||||
const response = await request(app)
|
const response = await request(app)
|
||||||
.get(`/devices/${device.id}`)
|
.get(`/devices/${device.id}`)
|
||||||
.set('Authorization', `Bearer ${token}`);
|
.set('Authorization', `Bearer ${token}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user