0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/unit/api/api.spec.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

import request from 'supertest';
import configDefault from '../partials/config';
import Config from '../../../src/lib/config';
import Storage from '../../../src/lib/storage';
import Auth from '../../../src/lib/auth';
import indexAPI from '../../../src/api/index';
require('../../../src/lib/logger').setup([]);
describe('endpoint unit test', () => {
let config;
let storage;
let auth;
let app;
beforeAll(function() {
config = new Config(configDefault);
storage = new Storage(config);
auth = new Auth(config);
app = indexAPI(config, auth, storage);
});
describe('ping unit test', () => {
test('test /-/ping', (done) => {
request(app)
.get('/-/ping')
.expect('Content-Type', /json/)
.expect(200, done)
});
});
describe('whoami unit test', () => {
test('test /-/whoami', (done) => {
request(app)
.get('/-/whoami')
.expect('Content-Type', /json/)
.expect(200, done)
});
test('test /whoami', (done) => {
request(app)
.get('/-/whoami')
.expect('Content-Type', /json/)
.expect(200, done)
});
});
});