mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
refactor: parameterize configureApp function (inject db list)
Reason: easier testing (mocking) and better readability Note: did additional refactoring
This commit is contained in:
committed by
Rainer Killinger
parent
f3b86f0f0d
commit
fe7dd09d7e
@@ -19,32 +19,21 @@ import {
|
||||
SCBulkRequest,
|
||||
SCBulkRoute,
|
||||
SCNotFoundErrorResponse,
|
||||
SCThingType
|
||||
} from '@openstapps/core';
|
||||
import {Bulk} from '../../src/storage/bulk-storage';
|
||||
import {expect} from 'chai';
|
||||
import {instance as book} from '@openstapps/core/test/resources/Book.1.json';
|
||||
import moment from 'moment';
|
||||
import {DEFAULT_TEST_TIMEOUT} from '../common';
|
||||
import {bulk, DEFAULT_TEST_TIMEOUT} from '../common';
|
||||
import {testApp} from '../tests-setup';
|
||||
|
||||
describe('Bulk routes', async function () {
|
||||
// increase timeout for the suite
|
||||
this.timeout(DEFAULT_TEST_TIMEOUT);
|
||||
|
||||
const bulkObj: Bulk = {
|
||||
expiration: moment().add(3600, 'seconds')
|
||||
.format(),
|
||||
source: 'some_source',
|
||||
state: 'in progress',
|
||||
type: SCThingType.Book,
|
||||
uid: ''
|
||||
};
|
||||
const request: SCBulkRequest = {
|
||||
expiration: bulkObj.expiration,
|
||||
source: bulkObj.source,
|
||||
type: bulkObj.type,
|
||||
};
|
||||
expiration: bulk.expiration,
|
||||
source: bulk.source,
|
||||
type: bulk.type,
|
||||
};
|
||||
const bulkRoute = new SCBulkRoute();
|
||||
const bulkAddRoute = new SCBulkAddRoute();
|
||||
const bulkDoneRoute = new SCBulkDoneRoute();
|
||||
@@ -62,7 +51,7 @@ describe('Bulk routes', async function () {
|
||||
expect(status).to.be.equal(bulkRoute.statusCodeSuccess);
|
||||
expect(error).to.be.equal(false);
|
||||
expect(body.uid).to.be.a('string');
|
||||
expect(body).to.deep.equal({...bulkObj, uid: body.uid});
|
||||
expect(body).to.deep.equal({...bulk, uid: body.uid});
|
||||
});
|
||||
|
||||
it('should return (throw) error if a bulk with the provided UID cannot be found when adding to a bulk', async function () {
|
||||
|
||||
Reference in New Issue
Block a user