Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var storage = require('node-persist')
// Will blow away:
// - watch_list saved repos
// - saved ('read') issues
storage.initSync();
storage.clearSync();
const MockConfig = require('./mock_objects/mock_config.js');
const persistence = require('./../core/persistence.js');
const Storage = require('node-persist');
const MsgNoPerms = new MockMessage('channel1', 'user1', 'Username', ['Server Admin'], []);
const MsgIsServerAdmin = new MockMessage('channel1', 'user1', 'Username', ['Server Admin'], ['Server Admin']);
const MsgIsBotAdmin = new MockMessage('channel1', 'bot-admin-id', 'Username');
const MsgIsBotAndServerAdmin = new MockMessage('channel1', 'bot-admin-id', 'Username', ['Server Admin'], ['Server Admin']);
const MsgDM = new MockMessage('channel1', 'bot-admin-id', 'Username');
const config = new MockConfig('Server Admin', ['bot-admin-id']);
if (!persistence.initialized_) {
persistence.init({dir: './test/persistence'});
}
Storage.clearSync();
const commandDataNoAliases = {
commandAliases: [],
action(bot, msg, suffix) { },
};
const commandDataUndefinedAliases = {
action(bot, msg, suffix) { },
};
const commandDataBlankAlias = {
commandAliases: ['alias1', ''],
action(bot, msg, suffix) { },
};
const commandDataNonStringAliases = {
const assert = require('assert');
const Storage = require('node-persist');
const persistence = require('./../core/persistence.js');
if (!persistence.initialized_) {
persistence.init({dir: './test/persistence'});
}
Storage.clearSync();
function createNextEdit(index) {
persistence.editGlobalData((data) => {
if (index < 100) {
createNextEdit(index + 1);
}
data[index.toString()] = index;
return data;
});
}
describe('Persistence', function() {
it('Does not allow edits to collide', function(done) {
createNextEdit(0);
setTimeout(() => {
clear: function() {
storage.clearSync();
}
};
exports.clear = function() {
storage.clearSync()
}