mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
Merge branch 'development' of github.com:Stremio/stremio-web into development
This commit is contained in:
commit
281ec63f15
4 changed files with 201 additions and 4 deletions
|
|
@ -42,6 +42,8 @@
|
|||
"@storybook/addon-console": "1.2.1",
|
||||
"@storybook/addons": "5.2.8",
|
||||
"@storybook/react": "5.2.8",
|
||||
"@testing-library/react": "9.4.0",
|
||||
"@testing-library/react-hooks": "3.2.1",
|
||||
"babel-loader": "8.0.6",
|
||||
"clean-webpack-plugin": "3.0.0",
|
||||
"copy-webpack-plugin": "5.1.1",
|
||||
|
|
@ -56,6 +58,7 @@
|
|||
"less-loader": "5.0.0",
|
||||
"mini-css-extract-plugin": "0.8.0",
|
||||
"postcss-loader": "3.0.0",
|
||||
"react-test-renderer": "16.12.0",
|
||||
"storybook-addon-jsx": "7.1.13",
|
||||
"terser-webpack-plugin": "2.3.0",
|
||||
"webpack": "4.41.3",
|
||||
|
|
|
|||
50
tests/hooks.spec.js
Normal file
50
tests/hooks.spec.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
const { renderHook, act } = require('@testing-library/react-hooks');
|
||||
const useSelectableSeasons = require('../src/routes/MetaDetails/VideosList/useSelectableSeasons');
|
||||
|
||||
const videos = [{ 'season': 4 }, { 'season': 5 }, { 'season': 4 }, { 'season': 7 }];
|
||||
|
||||
describe('hooks tests', () => {
|
||||
describe('useSelectableSeasons hook', () => {
|
||||
it('match 4', async () => {
|
||||
const { result } = renderHook(() => useSelectableSeasons(videos));
|
||||
const [, selectedSeason] = result.current;
|
||||
expect(selectedSeason).toBe(4);
|
||||
});
|
||||
|
||||
it('match 5', async () => {
|
||||
const { result } = renderHook(() => useSelectableSeasons(videos));
|
||||
|
||||
act(() => {
|
||||
const [, , , selectSeason] = result.current;
|
||||
selectSeason(5);
|
||||
});
|
||||
|
||||
const [, selectedSeason] = result.current;
|
||||
expect(selectedSeason).toBe(5);
|
||||
});
|
||||
|
||||
it('not match 6', async () => {
|
||||
const { result } = renderHook(() => useSelectableSeasons(videos));
|
||||
|
||||
act(() => {
|
||||
const [, , , selectSeason] = result.current;
|
||||
selectSeason(6);
|
||||
});
|
||||
|
||||
const [, selectedSeason] = result.current;
|
||||
expect(selectedSeason).toBe(undefined);
|
||||
});
|
||||
|
||||
it('not match $', async () => {
|
||||
const { result } = renderHook(() => useSelectableSeasons(videos));
|
||||
|
||||
act(() => {
|
||||
const [, , , selectSeason] = result.current;
|
||||
selectSeason('$');
|
||||
});
|
||||
|
||||
const [, selectedSeason] = result.current;
|
||||
expect(selectedSeason).toBe(undefined);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -112,7 +112,52 @@ describe('routesRegexp', () => {
|
|||
});
|
||||
});
|
||||
|
||||
//TODO library route regexp
|
||||
describe('library route regexp', () => {
|
||||
it('match /library', async () => {
|
||||
expect(Array.from('/library'.match(routesRegexp.library.regexp)))
|
||||
.toEqual(['/library', undefined, undefined]);
|
||||
});
|
||||
|
||||
it('match /library//', async () => {
|
||||
expect(Array.from('/library//'.match(routesRegexp.library.regexp)))
|
||||
.toEqual(['/library//', '', '']);
|
||||
});
|
||||
|
||||
it('match /library/1/', async () => {
|
||||
expect(Array.from('/library/1/'.match(routesRegexp.library.regexp)))
|
||||
.toEqual(['/library/1/', '1', '']);
|
||||
});
|
||||
|
||||
it('match /library//2', async () => {
|
||||
expect(Array.from('/library//2'.match(routesRegexp.library.regexp)))
|
||||
.toEqual(['/library//2', '', '2']);
|
||||
});
|
||||
|
||||
it('match /library/1/2', async () => {
|
||||
expect(Array.from('/library/1/2'.match(routesRegexp.library.regexp)))
|
||||
.toEqual(['/library/1/2', '1', '2']);
|
||||
});
|
||||
|
||||
it('not match /library/', async () => {
|
||||
expect('/library/'.match(routesRegexp.library.regexp))
|
||||
.toBe(null);
|
||||
});
|
||||
|
||||
it('not match /library///', async () => {
|
||||
expect('/library///'.match(routesRegexp.library.regexp))
|
||||
.toBe(null);
|
||||
});
|
||||
|
||||
it('not match /library/1', async () => {
|
||||
expect('/library/1'.match(routesRegexp.library.regexp))
|
||||
.toBe(null);
|
||||
});
|
||||
|
||||
it('not match /library/1/2/', async () => {
|
||||
expect('/library/1/2/'.match(routesRegexp.library.regexp))
|
||||
.toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('search route regexp', () => {
|
||||
it('match /search', async () => {
|
||||
|
|
|
|||
105
yarn.lock
105
yarn.lock
|
|
@ -1232,6 +1232,11 @@
|
|||
react-lifecycles-compat "^3.0.4"
|
||||
warning "^3.0.0"
|
||||
|
||||
"@sheerun/mutationobserver-shim@^0.3.2":
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.2.tgz#8013f2af54a2b7d735f71560ff360d3a8176a87b"
|
||||
integrity sha512-vTCdPp/T/Q3oSqwHmZ5Kpa9oI7iLtGl3RQaA/NyLHikvcrPxACkkKVr/XzkSPJWXHRhKGzVvb0urJsbMlRxi1Q==
|
||||
|
||||
"@storybook/addon-actions@5.2.8":
|
||||
version "5.2.8"
|
||||
resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.2.8.tgz#f63c6e1afb59e94ca1ebc776b7cad9b815e7419e"
|
||||
|
|
@ -1660,6 +1665,35 @@
|
|||
"@svgr/plugin-svgo" "^4.3.1"
|
||||
loader-utils "^1.2.3"
|
||||
|
||||
"@testing-library/dom@^6.11.0":
|
||||
version "6.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-6.11.0.tgz#962a38f1a721fdb7c9e35e7579e33ff13a00eda4"
|
||||
integrity sha512-Pkx9LMIGshyNbfmecjt18rrAp/ayMqGH674jYER0SXj0iG9xZc+zWRjk2Pg9JgPBDvwI//xGrI/oOQkAi4YEew==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.2"
|
||||
"@sheerun/mutationobserver-shim" "^0.3.2"
|
||||
"@types/testing-library__dom" "^6.0.0"
|
||||
aria-query "3.0.0"
|
||||
pretty-format "^24.9.0"
|
||||
wait-for-expect "^3.0.0"
|
||||
|
||||
"@testing-library/react-hooks@3.2.1":
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-3.2.1.tgz#19b6caa048ef15faa69d439c469033873ea01294"
|
||||
integrity sha512-1OB6Ksvlk6BCJA1xpj8/WWz0XVd1qRcgqdaFAq+xeC6l61Ucj0P6QpA5u+Db/x9gU4DCX8ziR5b66Mlfg0M2RA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.5.4"
|
||||
"@types/testing-library__react-hooks" "^3.0.0"
|
||||
|
||||
"@testing-library/react@9.4.0":
|
||||
version "9.4.0"
|
||||
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-9.4.0.tgz#b021ac8cb987c8dc54c6841875f745bf9b2e88e5"
|
||||
integrity sha512-XdhDWkI4GktUPsz0AYyeQ8M9qS/JFie06kcSnUVcpgOwFjAu9vhwR83qBl+lw9yZWkbECjL8Hd+n5hH6C0oWqg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.7.6"
|
||||
"@testing-library/dom" "^6.11.0"
|
||||
"@types/testing-library__react" "^9.1.2"
|
||||
|
||||
"@types/anymatch@*":
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a"
|
||||
|
|
@ -1775,6 +1809,13 @@
|
|||
"@types/history" "*"
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react-dom@*":
|
||||
version "16.9.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.4.tgz#0b58df09a60961dcb77f62d4f1832427513420df"
|
||||
integrity sha512-fya9xteU/n90tda0s+FtN5Ym4tbgxpq/hb/Af24dvs6uYnYn+fspaxw5USlw0R8apDNwxsqumdRoCoKitckQqw==
|
||||
dependencies:
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react-syntax-highlighter@10.1.0":
|
||||
version "10.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-10.1.0.tgz#9c534e29bbe05dba9beae1234f3ae944836685d4"
|
||||
|
|
@ -1782,6 +1823,13 @@
|
|||
dependencies:
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react-test-renderer@*":
|
||||
version "16.9.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-16.9.1.tgz#9d432c46c515ebe50c45fa92c6fb5acdc22e39c4"
|
||||
integrity sha512-nCXQokZN1jp+QkoDNmDZwoWpKY8HDczqevIDO4Uv9/s9rbGPbSpy8Uaxa5ixHKkcm/Wt0Y9C3wCxZivh4Al+rQ==
|
||||
dependencies:
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react-textarea-autosize@^4.3.3":
|
||||
version "4.3.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-textarea-autosize/-/react-textarea-autosize-4.3.5.tgz#6c4d2753fa1864c98c0b2b517f67bb1f6e4c46de"
|
||||
|
|
@ -1812,6 +1860,29 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370"
|
||||
integrity sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ==
|
||||
|
||||
"@types/testing-library__dom@*", "@types/testing-library__dom@^6.0.0":
|
||||
version "6.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/testing-library__dom/-/testing-library__dom-6.11.0.tgz#777e3ef44cb48f2430e3fad6a2053ec39004a5d3"
|
||||
integrity sha512-qUmnGl6H0wajUaO3VCJJoAeN/bQwpUzCqE/hk96NiGjIh5H4b8LfmQTOj4cHfS/9hCwO0DJytC6osHYDYiouyA==
|
||||
dependencies:
|
||||
pretty-format "^24.3.0"
|
||||
|
||||
"@types/testing-library__react-hooks@^3.0.0":
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/testing-library__react-hooks/-/testing-library__react-hooks-3.1.0.tgz#04d174ce767fbcce3ccb5021d7f156e1b06008a9"
|
||||
integrity sha512-QJc1sgH9DD6jbfybzugnP0sY8wPzzIq8sHDBuThzCr2ZEbyHIaAvN9ytx/tHzcWL5MqmeZJqiUm/GsythaGx3g==
|
||||
dependencies:
|
||||
"@types/react" "*"
|
||||
"@types/react-test-renderer" "*"
|
||||
|
||||
"@types/testing-library__react@^9.1.2":
|
||||
version "9.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/testing-library__react/-/testing-library__react-9.1.2.tgz#e33af9124c60a010fc03a34eff8f8a34a75c4351"
|
||||
integrity sha512-CYaMqrswQ+cJACy268jsLAw355DZtPZGt3Jwmmotlcu8O/tkoXBI6AeZ84oZBJsIsesozPKzWzmv/0TIU+1E9Q==
|
||||
dependencies:
|
||||
"@types/react-dom" "*"
|
||||
"@types/testing-library__dom" "*"
|
||||
|
||||
"@types/uglify-js@*":
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.4.tgz#96beae23df6f561862a830b4288a49e86baac082"
|
||||
|
|
@ -2233,6 +2304,14 @@ argparse@^1.0.7:
|
|||
dependencies:
|
||||
sprintf-js "~1.0.2"
|
||||
|
||||
aria-query@3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc"
|
||||
integrity sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w=
|
||||
dependencies:
|
||||
ast-types-flow "0.0.7"
|
||||
commander "^2.11.0"
|
||||
|
||||
arr-diff@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
|
||||
|
|
@ -2359,6 +2438,11 @@ assign-symbols@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
|
||||
integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=
|
||||
|
||||
ast-types-flow@0.0.7:
|
||||
version "0.0.7"
|
||||
resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad"
|
||||
integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0=
|
||||
|
||||
ast-types@0.11.3:
|
||||
version "0.11.3"
|
||||
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.3.tgz#c20757fe72ee71278ea0ff3d87e5c2ca30d9edf8"
|
||||
|
|
@ -3483,7 +3567,7 @@ commander@2.17.x:
|
|||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
|
||||
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
|
||||
|
||||
commander@^2.19.0, commander@^2.20.0, commander@~2.20.3:
|
||||
commander@^2.11.0, commander@^2.19.0, commander@^2.20.0, commander@~2.20.3:
|
||||
version "2.20.3"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
|
||||
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
|
||||
|
|
@ -8932,7 +9016,7 @@ pretty-error@^2.0.2, pretty-error@^2.1.1:
|
|||
renderkid "^2.0.1"
|
||||
utila "~0.4"
|
||||
|
||||
pretty-format@^24.9.0:
|
||||
pretty-format@^24.3.0, pretty-format@^24.9.0:
|
||||
version "24.9.0"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9"
|
||||
integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==
|
||||
|
|
@ -9342,7 +9426,7 @@ react-inspector@^3.0.2:
|
|||
is-dom "^1.0.9"
|
||||
prop-types "^15.6.1"
|
||||
|
||||
react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4:
|
||||
react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6:
|
||||
version "16.12.0"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c"
|
||||
integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==
|
||||
|
|
@ -9394,6 +9478,16 @@ react-syntax-highlighter@^8.0.1:
|
|||
prismjs "^1.8.4"
|
||||
refractor "^2.4.1"
|
||||
|
||||
react-test-renderer@16.12.0:
|
||||
version "16.12.0"
|
||||
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.12.0.tgz#11417ffda579306d4e841a794d32140f3da1b43f"
|
||||
integrity sha512-Vj/teSqt2oayaWxkbhQ6gKis+t5JrknXfPVo+aIJ8QwYAqMPH77uptOdrlphyxl8eQI/rtkOYg86i/UWkpFu0w==
|
||||
dependencies:
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.2"
|
||||
react-is "^16.8.6"
|
||||
scheduler "^0.18.0"
|
||||
|
||||
react-textarea-autosize@^7.1.0:
|
||||
version "7.1.2"
|
||||
resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-7.1.2.tgz#70fdb333ef86bcca72717e25e623e90c336e2cda"
|
||||
|
|
@ -11193,6 +11287,11 @@ w3c-hr-time@^1.0.1:
|
|||
dependencies:
|
||||
browser-process-hrtime "^0.1.2"
|
||||
|
||||
wait-for-expect@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/wait-for-expect/-/wait-for-expect-3.0.1.tgz#ec204a76b0038f17711e575720aaf28505ac7185"
|
||||
integrity sha512-3Ha7lu+zshEG/CeHdcpmQsZnnZpPj/UsG3DuKO8FskjuDbkx3jE3845H+CuwZjA2YWYDfKMU2KhnCaXMLd3wVw==
|
||||
|
||||
walker@^1.0.7, walker@~1.0.5:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb"
|
||||
|
|
|
|||
Loading…
Reference in a new issue