Fix jwt-token
This commit is contained in:
@@ -65,7 +65,7 @@ describe('Device Routes', () => {
|
||||
expect(response.body.data).to.have.length(2);
|
||||
|
||||
const deviceIds = response.body.data.map(d => d.id);
|
||||
expect(deviceIds).to.include.members([123, 124]);
|
||||
expect(deviceIds).to.include.members(['123', '124']);
|
||||
});
|
||||
|
||||
it('should only return devices for user tenant', async () => {
|
||||
@@ -85,7 +85,7 @@ describe('Device Routes', () => {
|
||||
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body.data).to.have.length(1);
|
||||
expect(response.body.data[0].id).to.equal(111);
|
||||
expect(response.body.data[0].id).to.equal('111');
|
||||
});
|
||||
|
||||
it('should require authentication', async () => {
|
||||
@@ -155,7 +155,7 @@ describe('Device Routes', () => {
|
||||
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body.success).to.be.true;
|
||||
expect(response.body.data.id).to.equal(12345);
|
||||
expect(response.body.data.id).to.equal('12345');
|
||||
expect(response.body.data.name).to.equal('Specific Device');
|
||||
expect(response.body.data.location_description).to.equal('Test Location');
|
||||
});
|
||||
@@ -570,18 +570,20 @@ describe('Device Routes', () => {
|
||||
});
|
||||
|
||||
const response = await request(app)
|
||||
.get('/devices')
|
||||
.get('/devices?include_stats=true')
|
||||
.set('Authorization', `Bearer ${token}`);
|
||||
|
||||
expect(response.status).to.equal(200);
|
||||
const devices = response.body.data;
|
||||
|
||||
const online = devices.find(d => d.id === onlineDevice.id);
|
||||
const offline = devices.find(d => d.id === offlineDevice.id);
|
||||
const online = devices.find(d => d.id === String(onlineDevice.id));
|
||||
const offline = devices.find(d => d.id === String(offlineDevice.id));
|
||||
|
||||
// These assertions depend on your business logic for determining online status
|
||||
expect(online).to.exist;
|
||||
expect(online.stats).to.exist;
|
||||
expect(offline).to.exist;
|
||||
expect(offline.stats).to.exist;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user