mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
test for await db.set in createAuthor
This commit is contained in:
parent
a001a13411
commit
20c512c8a9
1 changed files with 31 additions and 0 deletions
31
src/tests/backend/specs/regression-db.js
Normal file
31
src/tests/backend/specs/regression-db.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const AuthorManager = require('../../../node/db/AuthorManager');
|
||||||
|
const assert = require('assert').strict;
|
||||||
|
const common = require('../common');
|
||||||
|
const db = require('../../../node/db/DB');
|
||||||
|
|
||||||
|
describe(__filename, function () {
|
||||||
|
let setBackup;
|
||||||
|
|
||||||
|
before(async function () {
|
||||||
|
await common.init();
|
||||||
|
setBackup = db.set;
|
||||||
|
|
||||||
|
db.set = async (...args) => {
|
||||||
|
// delay db.set
|
||||||
|
await new Promise((resolve) => { setTimeout(() => resolve(), 500); });
|
||||||
|
return await setBackup.call(db, ...args);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
after(async function () {
|
||||||
|
db.set = setBackup;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('regression test for missing await in createAuthor (#5000)', async function () {
|
||||||
|
this.timeout(700);
|
||||||
|
const {authorID} = await AuthorManager.createAuthor(); // Should block until db.set() finishes.
|
||||||
|
assert(await AuthorManager.doesAuthorExist(authorID));
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue