Skip to content

Commit

Permalink
upgrade mobx
Browse files Browse the repository at this point in the history
  • Loading branch information
Cap32 committed Jul 23, 2018
1 parent b2d1f9f commit 18ec7d2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 40 deletions.
25 changes: 7 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "when react-router meets mobx: observable router and location",
"repository": "Cap32/react-router-mobx",
"scripts": {
"start": "yarn test --watchAll",
"watch": "yarn test --watchAll",
"test": "cross-env BABEL_ENV=cjs jest --coverage",
"coverage": "cat ./coverage/lcov.info | coveralls",
"format": "prettier-eslint --write \"src/**/*.js\"",
Expand All @@ -18,13 +18,7 @@
"build": "run-p build:*",
"preversion": "yarn test && yarn run build"
},
"files": [
"README.md",
"LICENSE.md",
"lib",
"es",
"dist"
],
"files": ["README.md", "LICENSE.md", "lib", "es", "dist"],
"main": "lib/index.js",
"module": "es/index.js",
"jsnext:main": "es/index.js",
Expand All @@ -46,7 +40,7 @@
"tiny-querystring": "^0.0.2"
},
"peerDependencies": {
"mobx": "^3.0.0 || ^4.0.0",
"mobx": "^3.0.0 || ^4.0.0 || ^5.0.0",
"react": "^0.14.0 || ^15.0.0 || ^16.0.0",
"react-router-dom": "^4.0.0"
},
Expand All @@ -70,8 +64,8 @@
"jest": "^22.0.4",
"lodash.camelcase": "^4.3.0",
"mkdirp": "^0.5.1",
"mobx": "^4.2.0",
"mobx-react": "^5.0.0",
"mobx": "^5.0.3",
"mobx-react": "^5.2.3",
"npm-run-all": "^4.0.2",
"prettier-eslint-cli": "^4.7.0",
"qs": "^6.5.1",
Expand All @@ -82,12 +76,7 @@
"webpack": "^3.1.0"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.js"
],
"modulePathIgnorePatterns": [
"node_modules",
"lib"
]
"collectCoverageFrom": ["src/**/*.js"],
"modulePathIgnorePatterns": ["node_modules", "lib"]
}
}
24 changes: 12 additions & 12 deletions src/__tests__/RouterStore.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@ describe('RouterStore', () => {
});

test('should routerStore.location.hash work', () => {
expect(history.push.mock.calls.length).toBe(0);
expect(history.push).toHaveBeenCalledTimes(0);
routerStore.location.hash = '#hello';
expect(routerStore.location.hash).toBe('#hello');
expect(history.push.mock.calls.length).toBe(1);
expect(history.push).toHaveBeenCalledTimes(1);
});

test('should routerStore.location.search work', () => {
expect(history.push.mock.calls.length).toBe(0);
expect(history.push).toHaveBeenCalledTimes(0);
routerStore.location.search = '?foo=bar';
expect(routerStore.location.search).toBe('?foo=bar');
expect(history.push.mock.calls.length).toBe(1);
expect(history.push).toHaveBeenCalledTimes(1);
});

test('should routerStore.location.pathname work', () => {
expect(history.push.mock.calls.length).toBe(0);
expect(history.push).toHaveBeenCalledTimes(0);
routerStore.location.pathname = '/hello';
expect(routerStore.location.pathname).toBe('/hello');
expect(history.push.mock.calls.length).toBe(1);
expect(history.push).toHaveBeenCalledTimes(1);
});

test('should routerStore.location.query work', () => {
expect(history.push.mock.calls.length).toBe(0);
expect(history.push).toHaveBeenCalledTimes(0);
routerStore.location.query = {
...routerStore.location.query,
foo: 'bar',
Expand All @@ -79,21 +79,21 @@ describe('RouterStore', () => {
foo: 'bar',
hello: 'world',
});
expect(history.push.mock.calls.length).toBe(1);
expect(history.push).toHaveBeenCalledTimes(1);
});

test('should update routerStore.location work', () => {
expect(history.push.mock.calls.length).toBe(0);
expect(history.push).toHaveBeenCalledTimes(0);
routerStore.location = '/a';
expect(routerStore.location.pathname).toBe('/a');
expect(history.push.mock.calls.length).toBe(1);
expect(history.push).toHaveBeenCalledTimes(1);
});

test('should push work', () => {
expect(history.push.mock.calls.length).toBe(0);
expect(history.push).toHaveBeenCalledTimes(0);
routerStore.push({ query: { hello: 'world' } });
expect(routerStore.location.query).toEqual({ hello: 'world' });
expect(history.push.mock.calls.length).toBe(1);
expect(history.push).toHaveBeenCalledTimes(1);
});

test('should replace work', () => {
Expand Down
25 changes: 15 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2792,9 +2792,9 @@ hoist-non-react-statics@^2.3.0:
version "2.3.0"
resolved "http://registry.npm.taobao.org/hoist-non-react-statics/download/hoist-non-react-statics-2.3.0.tgz#ede16318c2ff1f9fe3a025396ba06fd4c44608bb"

hoist-non-react-statics@^2.3.1:
version "2.5.0"
resolved "http://registry.npm.taobao.org/hoist-non-react-statics/download/hoist-non-react-statics-2.5.0.tgz#d2ca2dfc19c5a91c5a6615ce8e564ef0347e2a40"
hoist-non-react-statics@^2.5.0:
version "2.5.5"
resolved "http://registry.npm.taobao.org/hoist-non-react-statics/download/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47"

home-or-tmp@^2.0.0:
version "2.0.0"
Expand Down Expand Up @@ -3838,15 +3838,16 @@ minimist@1.2.0, minimist@^1.1.1, minimist@^1.2.0:
dependencies:
minimist "0.0.8"

mobx-react@^5.0.0:
version "5.0.0"
resolved "http://registry.npm.taobao.org/mobx-react/download/mobx-react-5.0.0.tgz#8d5a33be376fa22b184a6f555d40a6a3a8459a16"
mobx-react@^5.2.3:
version "5.2.3"
resolved "http://registry.npm.taobao.org/mobx-react/download/mobx-react-5.2.3.tgz#cdf6141c2fe63377c5813cbd254e8ce0d4676631"
dependencies:
hoist-non-react-statics "^2.3.1"
hoist-non-react-statics "^2.5.0"
react-lifecycles-compat "^3.0.2"

mobx@^4.2.0:
version "4.2.0"
resolved "http://registry.npm.taobao.org/mobx/download/mobx-4.2.0.tgz#ee0b0a4f3da2f4776225046ab208ac329a4841d4"
mobx@^5.0.3:
version "5.0.3"
resolved "http://registry.npm.taobao.org/mobx/download/mobx-5.0.3.tgz#53b97f2a0f9b0dd7774c96249f81bf2d513d8e1c"

ms@0.7.1:
version "0.7.1"
Expand Down Expand Up @@ -4542,6 +4543,10 @@ react-dom@^16.2.0:
object-assign "^4.1.1"
prop-types "^15.6.0"

react-lifecycles-compat@^3.0.2:
version "3.0.4"
resolved "http://registry.npm.taobao.org/react-lifecycles-compat/download/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"

react-reconciler@^0.7.0:
version "0.7.0"
resolved "http://registry.npm.taobao.org/react-reconciler/download/react-reconciler-0.7.0.tgz#9614894103e5f138deeeb5eabaf3ee80eb1d026d"
Expand Down

0 comments on commit 18ec7d2

Please sign in to comment.