X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fsrc%2Fdb%2Fbase.js;h=1f2d719067a73f8f5e67914c16acc38ae7ca4984;hb=8cd88ab4087a7fab2ccd6e231c64d7f0f1299f26;hp=18871f43e7dbcbb1b4c7da059e624026b37b4e41;hpb=9696c012e6b9a6c58904baa397ca0ebf78112316;p=websub-hub diff --git a/test/src/db/base.js b/test/src/db/base.js index 18871f4..1f2d719 100644 --- a/test/src/db/base.js +++ b/test/src/db/base.js @@ -1,8 +1,7 @@ -/* eslint-env mocha */ 'use strict'; -const assert = require('assert'); -const sinon = require('sinon'); // eslint-disable-line node/no-unpublished-require +const assert = require('node:assert'); +const sinon = require('sinon'); const stubDB = require('../../stub-db'); const stubLogger = require('../../stub-logger'); @@ -108,7 +107,7 @@ describe('DatabaseBase', function () { }); }); // _ensureTypes - describe('schemaCheck', function () { + describe('initialize', function () { let currentSchema; beforeEach(function () { currentSchema = { @@ -123,7 +122,7 @@ describe('DatabaseBase', function () { sinon.stub(db, '_currentSchema').resolves(currentSchema); }); it('covers success', async function () { - await db.schemaCheck(); + await db.initialize(); }); it('covers failure', async function() { db.schemaVersionsSupported = { @@ -139,13 +138,13 @@ describe('DatabaseBase', function () { }, }; try { - await db.schemaCheck(); + await db.initialize(); assert.fail('did not get expected exception'); } catch (e) { assert(e instanceof DBErrors.MigrationNeeded); } }); - }); // schemaCheck + }); // initialize describe('_topicDefaults', function () { let topic; @@ -173,13 +172,13 @@ describe('DatabaseBase', function () { db._topicSetDataValidate(data); }); it('covers invalid value', function () { - data.leaseSecondsPreferred = -100; - try { - db._topicSetDataValidate(data); - assert.fail('did not get expected exception'); - } catch (e) { - assert(e instanceof DBErrors.DataValidation); - } + data.leaseSecondsPreferred = -100; + try { + db._topicSetDataValidate(data); + assert.fail('did not get expected exception'); + } catch (e) { + assert(e instanceof DBErrors.DataValidation); + } }); it('covers invalid range', function () { data.leaseSecondsPreferred = 10000;