Fix jwt-token

This commit is contained in:
2025-09-15 20:49:46 +02:00
parent 3345510ccc
commit 2d18212f62
12 changed files with 19 additions and 73 deletions

View File

@@ -552,10 +552,7 @@ describe('Models', () => {
const heartbeatData = {
device_key: 'device_123_key',
device_id: device.id,
signal_strength: -50,
battery_level: 85,
temperature: 22.5
device_id: device.id
};
console.log('DEBUG Creating heartbeat with data:', heartbeatData);
@@ -566,7 +563,6 @@ describe('Models', () => {
id: heartbeat.id,
device_key: heartbeat.device_key,
device_id: heartbeat.device_id,
battery_level: heartbeat.battery_level,
allFields: Object.keys(heartbeat.dataValues)
});
@@ -593,7 +589,7 @@ describe('Models', () => {
expect(heartbeat.created_at).to.be.a('date');
});
it('should validate battery level range', async () => {
it('should validate device_key field', async () => {
const tenant = await createTestTenant();
const device = await models.Device.create({
id: 123,
@@ -601,14 +597,12 @@ describe('Models', () => {
tenant_id: tenant.id
});
// SQLite doesn't enforce range validation, so test valid creation
const heartbeat = await models.Heartbeat.create({
device_key: 'device_123_key',
device_id: device.id,
battery_level: 85 // Valid range
device_key: 'test-device-key-123',
device_id: device.id
});
expect(heartbeat.battery_level).to.equal(85);
expect(heartbeat.device_key).to.equal('test-device-key-123');
});
});