mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
8f43bf17df
* refactor: improve node-api * chore: add test for run server
21 lines
693 B
TypeScript
21 lines
693 B
TypeScript
import request from 'supertest';
|
|
import { runServer } from '../src';
|
|
describe('startServer via API', () => {
|
|
test('should provide all HTTP server data', async () => {
|
|
const webServer = await runServer();
|
|
expect(webServer).toBeDefined();
|
|
await request(webServer).get('/').expect(200);
|
|
});
|
|
|
|
test('should fail on start with empty configuration', async () => {
|
|
// @ts-expect-error
|
|
await expect(runServer({})).rejects.toThrow(
|
|
'AssertionError [ERR_ASSERTION]: CONFIG: storage path not defined'
|
|
);
|
|
});
|
|
|
|
test('should fail on start with null as entry', async () => {
|
|
await expect(runServer(null)).rejects.toThrow('config file must be an object');
|
|
});
|
|
});
|