refactor: parameterize configureApp function (inject db list)

Reason: easier testing (mocking) and better readability

Note: did additional refactoring
This commit is contained in:
Jovan Krunić
2020-10-23 10:31:25 +02:00
committed by Rainer Killinger
parent f3b86f0f0d
commit fe7dd09d7e
5 changed files with 58 additions and 38 deletions

View File

@@ -15,7 +15,7 @@
*/
import {SCThingUpdateRoute} from '@openstapps/core';
import chaiAsPromised from 'chai-as-promised';
import {bulkStorage, DEFAULT_TEST_TIMEOUT} from '../common';
import {bulkStorageMock, DEFAULT_TEST_TIMEOUT} from '../common';
import {expect, use} from 'chai';
import {instance as book} from '@openstapps/core/test/resources/Book.1.json';
import {testApp} from '../tests-setup';
@@ -38,6 +38,6 @@ describe('Thing update route', async function () {
.send(book);
expect(status).to.equal(thingUpdateRoute.statusCodeSuccess);
expect(bulkStorage.database.get(book.uid)).to.eventually.be.deep.equal(book);
expect(bulkStorageMock.database.get(book.uid)).to.eventually.be.deep.equal(book);
});
});