adding some simple non-stored logic to test the interface

This commit is contained in:
El RIDO
2020-06-28 13:05:47 +02:00
parent daae0d0dca
commit c4830044f7
4 changed files with 57 additions and 5 deletions

View File

@@ -1,7 +1,37 @@
'use strict';
require('../common');
const common = require('../common');
describe('Memory', function () {
describe('add & refreshList', function () {
this.timeout(30000);
jsc.property(
'allows adding valid paste URLs',
common.jscSchemas(),
jsc.nearray(common.jscA2zString()),
jsc.array(common.jscQueryString()),
'string',
function (schema, address, query, fragment) {
const expected = schema + '://' + address.join('') + '/?' +
encodeURI(
query.join('').replace(/^&+|&+$/gm,'') + '#' + fragment
),
clean = jsdom();
$('body').html(
'<main><div id="sidebar-wrapper"><table><tbody>' +
'</tbody></table></div></main>'
);
// clear cache, then the first cell will match what we add
$.PrivateBin.Memory.init();
$.PrivateBin.Memory.add(expected);
$.PrivateBin.Memory.refreshList();
const result = $('#sidebar-wrapper table tbody tr td')[0].textContent;
clean();
return result === expected;
}
);
});
describe('init', function () {
it(
'enables toggling the memory sidebar',