2 /* eslint-disable capitalized-comments */
6 const assert
= require('assert');
7 const sinon
= require('sinon');
8 const BaseDatabase
= require('../../../src/db/base');
9 const DBErrors
= require('../../../src/db/errors');
11 const noExpectedException
= 'did not get expected exception';
13 describe('BaseDatabase', function () {
16 beforeEach(function () {
17 logger
= { error: () => {} };
19 db
= new BaseDatabase(logger
);
22 afterEach(function () {
26 describe('_camelfy', function () {
27 it('empty arg', function () {
28 const result
= BaseDatabase
._camelfy();
29 assert
.strictEqual(result
, undefined);
31 it('no change', function () {
32 const str
= 'camelCase';
33 const result
= BaseDatabase
._camelfy(str
);
34 assert
.strictEqual(result
, str
);
36 it('does expected', function () {
37 const str
= 'snake_case_thing';
38 const result
= BaseDatabase
._camelfy(str
);
39 assert
.strictEqual(result
, 'snakeCaseThing');
43 describe('interface', function () {
44 it('covers methods', async
function () {
57 const invokedMethods
= methods
.map(async (m
) => {
59 // eslint-disable-next-line security/detect-object-injection
61 assert
.fail(noExpectedException
);
63 assert(e
instanceof DBErrors
.NotImplemented
);
66 await Promise
.all(invokedMethods
);