Fix jwt-token
This commit is contained in:
@@ -177,7 +177,6 @@ async function createTestDevice(deviceData = {}) {
|
||||
}
|
||||
|
||||
const defaultDeviceData = {
|
||||
id: Math.floor(Math.random() * 1000000000),
|
||||
name: 'Test Device',
|
||||
geo_lat: 59.3293,
|
||||
geo_lon: 18.0686,
|
||||
@@ -188,8 +187,18 @@ async function createTestDevice(deviceData = {}) {
|
||||
...deviceData
|
||||
};
|
||||
|
||||
// If a specific ID is provided, use upsert to ensure it's respected
|
||||
if (deviceData.id) {
|
||||
const [device, created] = await Device.upsert(defaultDeviceData, {
|
||||
returning: true
|
||||
});
|
||||
return device;
|
||||
} else {
|
||||
// Auto-generate ID when none provided
|
||||
defaultDeviceData.id = Math.floor(Math.random() * 1000000000);
|
||||
return await Device.create(defaultDeviceData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create test detection data
|
||||
|
||||
Reference in New Issue
Block a user