Fix jwt-token
This commit is contained in:
@@ -271,6 +271,12 @@ describe('Detectors Routes', () => {
|
||||
|
||||
describe('POST /detectors - Heartbeat Data', () => {
|
||||
it('should accept valid heartbeat', async () => {
|
||||
const device = await createTestDevice({
|
||||
id: 123,
|
||||
is_approved: true,
|
||||
is_active: true
|
||||
});
|
||||
|
||||
const heartbeatData = {
|
||||
type: 'heartbeat',
|
||||
key: 'device_123_key',
|
||||
@@ -304,9 +310,16 @@ describe('Detectors Routes', () => {
|
||||
});
|
||||
|
||||
it('should handle heartbeat with minimal data', async () => {
|
||||
// For numeric key, route will convert to integer, so create device with numeric ID
|
||||
const device = await createTestDevice({
|
||||
id: 123,
|
||||
is_approved: true,
|
||||
is_active: true
|
||||
});
|
||||
|
||||
const heartbeatData = {
|
||||
type: 'heartbeat',
|
||||
key: 'device_123_key'
|
||||
key: '123' // Numeric string that will be converted to 123
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
@@ -334,6 +347,12 @@ describe('Detectors Routes', () => {
|
||||
it('should store heartbeat when debug enabled', async () => {
|
||||
process.env.STORE_HEARTBEATS = 'true';
|
||||
|
||||
const device = await createTestDevice({
|
||||
id: 123,
|
||||
is_approved: true,
|
||||
is_active: true
|
||||
});
|
||||
|
||||
const heartbeatData = {
|
||||
type: 'heartbeat',
|
||||
key: 'device_123_key',
|
||||
|
||||
Reference in New Issue
Block a user