add test for mapPromise, rm unused command
MODIFY
package.json
package.json
"prepublishOnly": "npm run deploy",
"lint": "eslint --ext .ts src",
"lint:fix": "eslint --ext .ts src --fix",
- "test": "mochapack --webpack-config test/webpack.config.test.js --colors ./test/**/*.spec.js",
- "test:promise": "mochapack --webpack-config test/webpack.config.test.js --colors ./test/map_promise.spec.js",
- "test:watch": "mocha --require @babel/register --colors -w ./test/**/*.spec.js",
- "bridgetest": "mocha --timeout 40000 -r ts-node/register --exit ./test/bridgeTest.ts",
+ "test": "npm run build:pack && cd test && npm run install:lib:test",
"testrpc": "ganache-cli --mnemonic 'clock radar mass judge dismiss just intact mind resemble fringe diary casino' --gasLimit 13000000"
},
"repository": {

MODIFY
src/index.ts
src/index.ts
@@ -7,6 +7,7 @@ import Registry from './root/Registry'
import RootChain from './root/RootChain'
import WithdrawManager from './root/WithdrawManager'
import { address, MaticClientInitializationOptions, order, SendOptions } from './types/Common'
+import { mapPromise } from './common/MapPromise'
export class MaticPOSClient extends SDKClient {
private rootChain: RootChain
@@ -348,6 +349,7 @@ export default class Matic extends SDKClient {
public registry: Registry
public utils: Utils
public static MaticPOSClient = MaticPOSClient // workaround for web compatibility
+ public static mapPromise = mapPromise // workaround for web compatibility
constructor(options: MaticClientInitializationOptions = {}) {
const network = SDKClient.initializeNetwork(options.network, options.version)

MODIFY
src/tsconfig.json
src/tsconfig.json
"lib": ["es2015", "dom"],
"target": "es5",
"rootDir": "../src",
- "outDir": "dist/ts",
+ "outDir": "../dist/ts",
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",

MODIFY
test/package-lock.json
test/package-lock.json
},
"@maticnetwork/maticjs": {
"version": "file:../maticnetwork-maticjs-2.0.43.tgz",
- "integrity": "sha512-t4WdPICYq9SSJl/9jxMKjGrbUbdp4uFQjGVTsMRdI8psUoJzweeS8i3ruDDYjG1iFMuqIv2IcnHURtpk2meuLA==",
+ "integrity": "sha512-F9ffOnLUrl6uYjw6DFYE/y2R9Yz++BcobaS92BSheq/q19VfOitty/FNYmnOuomZjOxuyQStdcq6VXBSgdt0aQ==",
"requires": {
"@maticnetwork/meta": "^2.4.13",
"axios": "^0.21.1",

MODIFY
test/package.json
test/package.json
"main": "index.spec.js",
"scripts": {
"install:lib": "node install_lib.js",
- "test:browser": "cross-env-file -p ./config.json cross-env NODE_ENV=test karma start karma.conf.js",
- "test": "cross-env-file -p ./config.json cross-env NODE_ENV=test mochapack --webpack-config ./webpack.config.test.js --colors ./specs/index.ts"
+ "install:lib:test": "npm run install:lib && npm run test",
+ "un:lib": "npm un @maticnetwork/maticjs",
+ "test": "cross-env-file -p ./config.json cross-env NODE_ENV=test karma start karma.conf.js",
+ "test:mocha": "cross-env-file -p ./config.json cross-env NODE_ENV=test mochapack --webpack-config ./webpack.config.test.js --colors ./specs/index.ts"
},
"author": "",
"license": "ISC",

RENAME
test/specs/index.spec.js
test/specs/index.spec.ts
-/* global describe, it, beforeEach */
-
-import chai from 'chai'
-
-import Matic from '../src'
-
-// set up chai
-chai.should()
-const expect = chai.expect
+import Matic from '@maticnetwork/maticjs'
+import { expect } from 'chai'
describe('Matic SDK', () => {
it('should throw error for no required options', () => {

MODIFY
test/specs/index.ts
test/specs/index.ts
+import './map_promise.spec'
import './plasma_bridge'
import './pos_bridge'

RENAME
test/specs/map_promise.spec.js
test/specs/map_promise.spec.ts
import { expect } from 'chai'
-import { mapPromise } from '../src/common/MapPromise'
+import { mapPromise } from '@maticnetwork/maticjs'
+
describe('Map promise', () => {
it('map promise without concurrent', async () => {
const result = await mapPromise([1, 2, 3, 4, 5], val => {

add test for mapPromise, rm unused command