@agoric/swing-store-simple
Advanced tools
Comparing version 0.2.3 to 0.2.4
/* global module */ | ||
module.exports = { | ||
// parser: "babel-eslint", | ||
extends: ['airbnb-base', 'plugin:prettier/recommended'], | ||
@@ -13,4 +12,9 @@ env: { | ||
strict: 'off', | ||
'prefer-destructuring': 'off', | ||
'no-else-return': 'off', | ||
'no-console': 'off', | ||
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }], | ||
'no-unused-vars': ['error', { | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
}], | ||
'no-return-assign': 'off', | ||
@@ -21,4 +25,5 @@ 'no-param-reassign': 'off', | ||
'no-loop-func': 'off', | ||
'import/prefer-default-export': 'off', // contrary to Agoric standard | ||
'no-inner-declarations': 'off', | ||
'import/prefer-default-export': 'off', | ||
}, | ||
}; |
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.2.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.3...@agoric/swing-store-simple@0.2.4) (2020-08-31) | ||
### Bug Fixes | ||
* reduce inconsistency among our linting rules ([#1492](https://github.com/Agoric/agoric-sdk/issues/1492)) ([b6b675e](https://github.com/Agoric/agoric-sdk/commit/b6b675e2de110e2af19cad784a66220cab21dacf)) | ||
## [0.2.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/swing-store-simple@0.2.2...@agoric/swing-store-simple@0.2.3) (2020-06-30) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@agoric/swing-store-simple", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Persistent storage for SwingSet, based on a Map, optionally backed by a simple JSON file", | ||
@@ -11,3 +11,3 @@ "main": "simpleSwingStore.js", | ||
"build": "exit 0", | ||
"test": "tape -r esm 'test/**/test*.js' | tap-spec", | ||
"test": "ava", | ||
"lint-fix": "eslint --fix '**/*.js'", | ||
@@ -20,6 +20,4 @@ "lint-check": "eslint '**/*.js'" | ||
"devDependencies": { | ||
"esm": "^3.2.25", | ||
"tap-spec": "^5.0.0", | ||
"tape": "^4.10.2", | ||
"tape-promise": "^4.0.0" | ||
"ava": "^3.11.1", | ||
"esm": "^3.2.25" | ||
}, | ||
@@ -29,3 +27,12 @@ "publishConfig": { | ||
}, | ||
"gitHead": "d74ea289800c2fc52c005674a55b2412385f57d9" | ||
"ava": { | ||
"files": [ | ||
"test/**/test-*.js" | ||
], | ||
"require": [ | ||
"esm" | ||
], | ||
"timeout": "2m" | ||
}, | ||
"gitHead": "709048cc133b0b2b26a9774315c18c5e828ea6ab" | ||
} |
import fs from 'fs'; | ||
import path from 'path'; | ||
import { test } from 'tape-promise/tape'; | ||
import test from 'ava'; | ||
import { | ||
@@ -13,8 +13,8 @@ initSwingStore, | ||
function testStorage(t, storage) { | ||
t.notOk(storage.has('missing')); | ||
t.equal(storage.get('missing'), undefined); | ||
t.falsy(storage.has('missing')); | ||
t.is(storage.get('missing'), undefined); | ||
storage.set('foo', 'f'); | ||
t.ok(storage.has('foo')); | ||
t.equal(storage.get('foo'), 'f'); | ||
t.truthy(storage.has('foo')); | ||
t.is(storage.get('foo'), 'f'); | ||
@@ -32,4 +32,4 @@ storage.set('foo2', 'f2'); | ||
storage.delete('foo2'); | ||
t.notOk(storage.has('foo2')); | ||
t.equal(storage.get('foo2'), undefined); | ||
t.falsy(storage.has('foo2')); | ||
t.is(storage.get('foo2'), undefined); | ||
t.deepEqual(Array.from(storage.getKeys('foo1', 'foo4')), ['foo1', 'foo3']); | ||
@@ -48,9 +48,10 @@ | ||
testStorage(t, storage); | ||
t.end(); | ||
}); | ||
test('storageInFile', t => { | ||
fs.rmdirSync('testdb', { recursive: true }); | ||
t.equal(isSwingStore('testdb'), false); | ||
const { storage, commit, close } = initSwingStore('testdb'); | ||
const dbDir = 'testdb'; | ||
t.teardown(() => fs.rmdirSync(dbDir, { recursive: true })); | ||
fs.rmdirSync(dbDir, { recursive: true }); | ||
t.is(isSwingStore(dbDir), false); | ||
const { storage, commit, close } = initSwingStore(dbDir); | ||
testStorage(t, storage); | ||
@@ -60,8 +61,7 @@ commit(); | ||
close(); | ||
t.equal(isSwingStore('testdb'), true); | ||
t.is(isSwingStore(dbDir), true); | ||
const { storage: after } = openSwingStore('testdb'); | ||
const { storage: after } = openSwingStore(dbDir); | ||
t.deepEqual(getAllState(after), before, 'check state after reread'); | ||
t.equal(isSwingStore('testdb'), true); | ||
t.end(); | ||
t.is(isSwingStore(dbDir), true); | ||
}); | ||
@@ -71,10 +71,7 @@ | ||
const notSimpleDir = 'testdb-lmdb'; | ||
t.teardown(() => fs.rmdirSync(notSimpleDir, { recursive: true })); | ||
fs.mkdirSync(notSimpleDir, { recursive: true }); | ||
fs.writeFileSync(path.resolve(notSimpleDir, 'data.mdb'), 'some data\n'); | ||
fs.writeFileSync(path.resolve(notSimpleDir, 'lock.mdb'), 'lock stuff\n'); | ||
t.equal(isSwingStore(notSimpleDir), false); | ||
t.end(); | ||
t.is(isSwingStore(notSimpleDir), false); | ||
}); | ||
test.onFinish(() => fs.rmdirSync('testdb', { recursive: true })); | ||
test.onFinish(() => fs.rmdirSync('testdb-lmdb', { recursive: true })); |
26879
2
394