Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: fix for windows #11

Merged
merged 2 commits into from
Apr 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions test/bdb-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
const assert = require('bsert');
const bdb = require('../');
const vectors = require('./data/vectors.json');
const os = require('os');
const path = require('path');

describe('BDB', function() {
const num = (Math.random() * 0x100000000) >>> 0;
const dbpath = `/tmp/bdb-test-${num}.db`;
const dbpath = path.join(os.tmpdir(), `bdb-test-${num}.db`);
const tkey = bdb.key('t', ['hash160', 'uint32']);
const prefix = bdb.key('r');

Expand Down Expand Up @@ -190,21 +192,20 @@ describe('BDB', function() {
await batch.write();
break;
}

} catch (e) {
err = e;
}

assert(err);
assert.equal(err.message, message);
await new Promise((r) => setTimeout(r, 200));
await new Promise(r => setTimeout(r, 200));
}

const methods = {
'clear': 'Unsafe batch clear.',
'put': 'Unsafe batch put.',
'del': 'Unsafe batch del.',
'write': 'Unsafe batch write.',
'write': 'Unsafe batch write.'
};

for (const [method, message] of Object.entries(methods)) {
Expand Down