Fix jwt-token
This commit is contained in:
@@ -254,10 +254,10 @@ describe('Device Routes', () => {
|
||||
const token = generateTestToken(admin, tenant);
|
||||
|
||||
const invalidPayloads = [
|
||||
{}, // Missing all fields
|
||||
{ name: 'No ID Device' }, // Missing device ID
|
||||
{ id: 123 }, // Missing name
|
||||
{ id: 123, name: 'No Location' } // Missing coordinates
|
||||
{}, // Missing device ID (required)
|
||||
{ id: 'not-a-number' }, // Invalid ID type
|
||||
{ id: 0 }, // ID too small
|
||||
{ id: 1000000000 } // ID too large
|
||||
];
|
||||
|
||||
for (const payload of invalidPayloads) {
|
||||
@@ -514,6 +514,17 @@ describe('Device Routes', () => {
|
||||
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)
|
||||
.get(`/devices/${device.id}`)
|
||||
.set('Authorization', `Bearer ${token}`);
|
||||
|
||||
Reference in New Issue
Block a user