mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-28 17:48:52 +00:00
988a1c9e9a
This updates balena lint to the latest version to enable eslint support and unblock Typescript updates. This is a huge number of changes as the linting rules are much more strict now, requiring modifiying most files in the codebase. This commit also bumps the test dependency `rewire` as that was interfering with the update of balena-lint Change-type: patch
30 lines
749 B
TypeScript
30 lines
749 B
TypeScript
import type * as express from 'express';
|
|
import * as request from 'supertest';
|
|
|
|
import * as deviceApi from '~/src/device-api';
|
|
|
|
describe('device-api/index', () => {
|
|
let api: express.Application;
|
|
|
|
before(async () => {
|
|
api = new deviceApi.SupervisorAPI({
|
|
routers: [],
|
|
healthchecks: [],
|
|
// @ts-expect-error extract private variable for testing
|
|
}).api;
|
|
// Express app set in SupervisorAPI is private here
|
|
// but we need to access it for supertest
|
|
});
|
|
|
|
describe('/ping', () => {
|
|
it('responds with 200 regardless of auth', async () => {
|
|
await request(api).get('/ping').expect(200);
|
|
|
|
await request(api)
|
|
.get('/ping')
|
|
.set('Authorization', `Bearer ${await deviceApi.getGlobalApiKey()}`)
|
|
.expect(200);
|
|
});
|
|
});
|
|
});
|