mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
ExportEtherpad: Support custom subkeys
This commit is contained in:
parent
4b2e2dd9f2
commit
88c0ab8255
4 changed files with 30 additions and 5 deletions
|
@ -30,24 +30,38 @@ describe(__filename, function () {
|
|||
it('exports custom records', async function () {
|
||||
const pad = await padManager.getPad(padId);
|
||||
await pad.db.set(`custom:${padId}`, 'a');
|
||||
await pad.db.set(`custom:${padId}:`, 'b');
|
||||
await pad.db.set(`custom:${padId}:foo`, 'c');
|
||||
const data = await exportEtherpad.getPadRaw(pad.id, null);
|
||||
assert.equal(data[`custom:${padId}`], 'a');
|
||||
assert.equal(data[`custom:${padId}:`], 'b');
|
||||
assert.equal(data[`custom:${padId}:foo`], 'c');
|
||||
});
|
||||
|
||||
it('export from read-only pad uses read-only ID', async function () {
|
||||
const pad = await padManager.getPad(padId);
|
||||
const readOnlyId = await readOnlyManager.getReadOnlyId(padId);
|
||||
await pad.db.set(`custom:${padId}`, 'a');
|
||||
await pad.db.set(`custom:${padId}:`, 'b');
|
||||
await pad.db.set(`custom:${padId}:foo`, 'c');
|
||||
const data = await exportEtherpad.getPadRaw(padId, readOnlyId);
|
||||
assert.equal(data[`custom:${readOnlyId}`], 'a');
|
||||
assert.equal(data[`custom:${readOnlyId}:`], 'b');
|
||||
assert.equal(data[`custom:${readOnlyId}:foo`], 'c');
|
||||
assert(!(`custom:${padId}` in data));
|
||||
assert(!(`custom:${padId}:` in data));
|
||||
assert(!(`custom:${padId}:foo` in data));
|
||||
});
|
||||
|
||||
it('does not export records from pad with similar ID', async function () {
|
||||
const pad = await padManager.getPad(padId);
|
||||
await pad.db.set(`custom:${padId}x`, 'a');
|
||||
await pad.db.set(`custom:${padId}x:`, 'b');
|
||||
await pad.db.set(`custom:${padId}x:foo`, 'c');
|
||||
const data = await exportEtherpad.getPadRaw(pad.id, null);
|
||||
assert(!(`custom:${padId}x` in data));
|
||||
assert(!(`custom:${padId}x:` in data));
|
||||
assert(!(`custom:${padId}x:foo` in data));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue