- should create a new Zocci store
store=new Zocci(__dirname+'/test-'+rnd()+'.json');
assert(store);
- should be empty
assert.equal(store.find('').length, 1);
- AssertionError: 0 == 1
- should set "port" (number)
store.set('port', 80);
- should get "port"
assert.equal(store.get('port'), 80);
- should set "names" (array)
store.set('names', ['test0', 'test1']);
- should get "names"
assert.json_equal(store.get('names'), ['test0', 'test1']);
- should get item in "names"
assert.equal(store.get('names.1'), 'test1');
- should set "path" (object)
store.set('path', {base:'/', test:'/test'});
- should get "path"
assert.json_equal(store.get('path'), {base:'/', test:'/test'});
- should get subkey of "path"
assert.equal(store.get('path.test'), '/test');
- should set subkey of "path"
store.set('path.lib', {js:'/lib/js', css:'/lib/css'});
- should get new subkey of "path"
assert.json_equal(store.get('path.lib'), {js:'/lib/js', css:'/lib/css'});
- should get new "path"
assert.json_equal(store.get('path'), {
base:'/', test:'/test', lib:{js:'/lib/js', css:'/lib/css'}
});
- should manipulate "path"
store.access('path.lib').fonts='/lib/fonts';
assert.json_equal(store.get('path.lib'), {
js:'/lib/js', css:'/lib/css', fonts:'/lib/fonts'
});
- should remove subkey of "path"
store.remove('path.lib', {js:'/lib/js', css:'/lib/css'});
assert.json_equal(store.get('path'), {base:'/', test:'/test'});
- should contain 3 items
assert.equal(store.find('').length, 3);
- should find 2 items starting with "p"
assert.equal(store.find('p').length, 2);
- should remove item
store.remove('path');
assert.equal(store.find('').length, 2);
- should unlink store
unlinkStore(store, done);