Skip to content

Commit

Permalink
fix: update polkadot deps, util-crypto, api, wasm-crypto (#878)
Browse files Browse the repository at this point in the history
* fix: update polkadot deps, util-crypto, api, wasm-crypto

* update apps-config, and dedupe

* jest detectOpenHandles

* Mock WsProvider

Co-authored-by: Jose Ramirez <jarcodallo@gmail.com>
  • Loading branch information
TarikGul and 0xslipk committed Mar 22, 2022
1 parent a2daf75 commit db74ab4
Show file tree
Hide file tree
Showing 3 changed files with 290 additions and 285 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"start": "yarn run main",
"start:log-rpc": "yarn run build && NODE_ENV=test yarn run main ",
"dev": "tsc-watch --onSuccess \"yarn run main\"",
"test": "substrate-exec-jest",
"test": "NODE_ENV=test substrate-exec-jest --detectOpenHandles",
"test:watch": "substrate-exec-jest --watch",
"test:cov": "substrate-exec-jest --coverage",
"test:cov": "NODE_ENV=test substrate-exec-jest --detectOpenHandles --coverage",
"lint:e2e-tests": "cd e2e-tests && substrate-dev-run-lint",
"build:e2e-tests": "(cd e2e-tests && substrate-exec-tsc)",
"test:e2e-tests": "yarn build:e2e-tests && node ./e2e-tests/build/index.js --config=./e2e-tests/jest.config.js",
Expand All @@ -53,9 +53,9 @@
"test:test-release": "yarn start:test-release"
},
"dependencies": {
"@polkadot/api": "^7.12.1",
"@polkadot/apps-config": "^0.109.1",
"@polkadot/util-crypto": "^8.5.1",
"@polkadot/api": "^7.13.1",
"@polkadot/apps-config": "^0.110.1",
"@polkadot/util-crypto": "^8.6.1",
"@substrate/calc": "^0.2.8",
"argparse": "^2.0.1",
"confmgr": "1.0.7",
Expand All @@ -78,14 +78,14 @@
"tsc-watch": "^4.4.0"
},
"resolutions": {
"@polkadot/api": "7.12.1",
"@polkadot/keyring": "8.5.1",
"@polkadot/networks": "8.5.1",
"@polkadot/types": "7.12.1",
"@polkadot/types-known": "7.12.1",
"@polkadot/util": "8.5.1",
"@polkadot/util-crypto": "8.5.1",
"@polkadot/wasm-crypto": "4.6.1",
"@polkadot/api": "7.13.1",
"@polkadot/keyring": "8.6.1",
"@polkadot/networks": "8.6.1",
"@polkadot/types": "7.13.1",
"@polkadot/types-known": "7.13.1",
"@polkadot/util": "8.6.1",
"@polkadot/util-crypto": "8.6.1",
"@polkadot/wasm-crypto": "5.0.1",
"bn.js": "5.2.0",
"node-fetch": "2.6.7",
"prismjs": ">=1.23.0",
Expand Down
9 changes: 7 additions & 2 deletions src/test-helpers/typeFactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApiPromise, WsProvider } from '@polkadot/api';
import { ApiPromise } from '@polkadot/api';
import { StorageEntryBase } from '@polkadot/api/types';
import { WsProvider } from '@polkadot/rpc-provider/ws';
import { Metadata } from '@polkadot/types';
import { Option, StorageKey, Tuple, TypeRegistry, Vec } from '@polkadot/types';
import {
Expand All @@ -10,6 +11,8 @@ import {
} from '@polkadot/types/types';
import { Observable } from 'rxjs';

jest.mock('@polkadot/rpc-provider/ws'); // WsProvider is now a mock constructor

/**
* Type to fulfill StorageEntryBase regarding storage keys
*/
Expand All @@ -29,11 +32,13 @@ export function createApiWithAugmentations(
): ApiPromise {
const registry = new TypeRegistry();
const expandedMetadata = new Metadata(registry, metadata);
const WsProviderMock = WsProvider as jest.MockedClass<typeof WsProvider>;
const provider = new WsProviderMock();

registry.setMetadata(expandedMetadata);

const api = new ApiPromise({
provider: new WsProvider('ws://', false),
provider,
registry,
});

Expand Down
Loading

0 comments on commit db74ab4

Please sign in to comment.