fix: add teardown for unit test

This commit is contained in:
Juan Picado @jotadeveloper 2018-03-11 19:25:13 +01:00
parent 547da379e9
commit 036120b777
No known key found for this signature in database
GPG Key ID: 18AC54485952D158
1 changed files with 14 additions and 3 deletions

View File

@ -18,7 +18,7 @@ describe('api with no limited access configuration', () => {
let app;
beforeAll(function(done) {
const store = path.join(__dirname, '../partials/store/access-storage');
const store = path.join(__dirname, './partials/store/access-storage');
rimraf(store, () => {
const configForTest = _.clone(configDefault);
configForTest.auth = {
@ -35,6 +35,17 @@ describe('api with no limited access configuration', () => {
});
});
afterAll(function(done) {
const store = path.join(__dirname, './partials/store/access-storage');
rimraf(store, (err) => {
if (err) {
return done(err);
}
return done();
});
});
describe('test proxy packages partially restricted', () => {
test('should test fails on fetch endpoint /-/jquery', (done) => {
@ -51,9 +62,9 @@ describe('api with no limited access configuration', () => {
});
});
test('should success on fetch endpoint /-/react', (done) => {
test('should success on fetch endpoint /-/vue', (done) => {
request(app)
.get('/react')
.get('/vue')
.set('content-type', 'application/json; charset=utf-8')
.expect('Content-Type', /json/)
.expect(200)