1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/unit/api/basic_system.spec.js
Juan Picado @jotadeveloper 3639557118
feat: replaced element-react by Material-UI (#950) (#985)
* feat: added material-ui

refactor: replaced element-react by material-ui

refactor: updated snapshots

refactor: updated tests

* fix: modified validation.WIP

* refactor: modified tests.WIP

* test(fix): unit test for login and validat ecredentials

* chore(fix): e2e update css selectors

* test(fix): replace Object.values by supported syntax on node6
2018-09-06 21:26:54 +02:00

53 lines
1.2 KiB
JavaScript

import endPointAPI from '../../../src/api/index';
import {API_ERROR} from '../../../src/lib/constants';
import express from 'express';
import request from 'request';
import rimraf from 'rimraf';
import config from '../partials/config/index';
const app = express();
const server = require('http').createServer(app);
describe('basic system test', () => {
let port;
beforeAll(function(done) {
rimraf(__dirname + '/store/test-storage', done);
});
beforeAll(async function(done) {
app.use(await endPointAPI(config));
server.listen(0, function() {
port = server.address().port;
done();
});
});
afterAll((done) => {
server.close(done);
});
test('server should respond on /', done => {
request({
url: 'http://localhost:' + port + '/',
}, function(err, res, body) {
expect(err).toBeNull();
expect(body).toMatch(/Verdaccio/);
done();
});
});
test('server should respond on /whatever', done => {
request({
url: `http://localhost:${port}/whatever`,
}, function(err, res, body) {
expect(err).toBeNull();
expect(body).toMatch(API_ERROR.NO_PACKAGE);
done();
});
});
});