Files
common/packages/trie-db-old/test/taskExecutor.spec.js
T
Jaco Greeff e1135a665b Re-implementation of Patricia-Merkle Trie (#203)
* Start of trie-db re-implementation

* WIP commit

* More WIP

* WIP, seems complete, untested

* Ported trie-db operational

* Add Ethereum trie tests

* Use u8aConcat to construct u8a

* Basic RocksDb interface

* Combine engines into DB, expand tests

* Update Trie with transaction wrapper

* LevelDb (sync) interface

* Remove unused (for now) package (compatibility)

* trie-d -> trie-db-old, trie-db-ext -> trie-db

* Version bump

* Skip old trie tests (package to be removed)

* Skip tests (fixed)

* Remove non-used RocksDb spec

* Skip FileFlat tests (deprecated?)
2018-09-01 22:17:57 +02:00

31 lines
808 B
JavaScript

// Copyright 2015-2018 authors & contributors of https://github.com/ethereumjs/merkle-patricia-tree
// Copyright 2017-2018 @polkadot/trie-db authors & contributors
// This software may be modified and distributed under the terms
// of the MPL-2.0 license. See the LICENSE file for details.
import taskExecutor from '../src/util/taskExecutor';
const executor = taskExecutor(2);
describe.skip('taskExecutor', () => {
it('executes in order', async () => {
var tasks = [1, 2, 3, 4, 5, 6, 7];
var executionOrder = [];
await Promise.all(
tasks.map((priority) =>
executor(priority, (cb) => {
executionOrder.push(priority);
setTimeout(cb, 50);
})
)
);
expect(
executionOrder
).toEqual(
[1, 2, 7, 6, 5, 4, 3]
);
});
});