This commit is contained in:
2024-05-17 18:02:49 +08:00
parent 8407d51fb6
commit b5264dc222
4056 changed files with 308094 additions and 41932 deletions

14
node_modules/store/tests/bugs/all.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
test.group('bugs', function() {
test('gh-215: "Expire plugin doesn\'t factor custom namespaces"', function() {
require('./gh-215')
})
test('gh-235: "Expire and Events plugins conflict with each other"', function() {
require('./gh-235')
})
test('gh-236: "No supported storage has been added"', function() {
require('./gh-236')
})
test('gh-239: "No supported storage has been added! Add one"', function() {
require('./gh-239')
})
})

26
node_modules/store/tests/bugs/gh-215.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
/* eslint semi: "off", indent: "off" */
// https://github.com/marcuswestin/store.js/issues/215
var engine = require('../../src/store-engine');
var storages = [require('../../storages/memoryStorage')];
var plugins = [require('../../plugins/expire')];
const store1 = engine.createStore(storages, plugins, '');
const store2 = store1.namespace('store2')
const store3 = store1.namespace('store3')
var time = Math.floor(new Date().getTime() / 10) * 10
var expiration1 = time + 1001
var expiration2 = null
var expiration3 = time + 3003
var key = 'foo'
var val = 'bar'
store1.set(key, val, expiration1)
store2.set(key, val, expiration2)
store3.set(key, val, expiration3)
assert(store1.getExpiration(key) == expiration1)
assert(store2.getExpiration(key) == expiration2)
assert(store3.getExpiration(key) == expiration3)

14
node_modules/store/tests/bugs/gh-235.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/* eslint semi: "off", indent: "off" */
// https://github.com/marcuswestin/store.js/issues/235
var engine = require('../../src/store-engine');
const store = engine.createStore(
[ require('../../storages/localStorage'), require('../../storages/memoryStorage') ],
[ require('../../plugins/expire'), require('../../plugins/events') ]
);
store.set('foo', 'bar', new Date().getTime() - 1);
store.set('foo', 'bar');
store.set('foo', 'bar');

5
node_modules/store/tests/bugs/gh-236.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/* eslint semi: "off", no-unused-vars: "off" */
var store = require('../..');
const token = store.get('token'); // or set ...

5
node_modules/store/tests/bugs/gh-239.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/* eslint semi: "off", no-unused-vars: "off" */
var store = require('../..');
const set = (key, value) => store.set(key, value);
const get = key => store.get(key);