diff --git a/package.json b/package.json index 721b0c2..badd9e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wildcard-mock-link", - "version": "2.0.3", + "version": "2.0.4", "description": "apollo client mocking", "author": "insidewhy ", "license": "ISC", @@ -44,7 +44,7 @@ "fast-json-stable-stringify": "^2.1.0" }, "devDependencies": { - "@apollo/client": "3.3.21", + "@apollo/client": "3.5.10", "@testing-library/react": "12.0.0", "@testing-library/react-hooks": "7.0.1", "@types/jest": "26.0.24", @@ -57,8 +57,8 @@ "eslint-plugin-import": "2.23.4", "eslint-plugin-react": "7.24.0", "eslint-plugin-react-hooks": "4.2.0", - "graphql": "15.5.1", - "graphql-tag": "2.12.5", + "graphql": "16.8.0", + "graphql-tag": "2.12.6", "husky": "7.0.1", "jest": "27.0.6", "prettier": "2.4.1", @@ -67,11 +67,12 @@ "react-dom": "17.0.2", "react-test-renderer": "17.0.2", "rimraf": "3.0.2", - "typescript": "4.3.5" + "typescript": "4.3.5", + "zen-observable-ts": "1.2.5" }, "peerDependencies": { "@apollo/client": "^3.3.15", - "graphql": "^14.5.8 || ^15.0.0" + "graphql": "^14.5.8 || ^15.0.0 || ^16.0.0" }, "resolutions": { "@types/react": "17.0.15" diff --git a/src/index.spec.tsx b/src/index.spec.tsx index cecc746..a2bd9cc 100644 --- a/src/index.spec.tsx +++ b/src/index.spec.tsx @@ -484,7 +484,7 @@ describe('WildcardMockLink', () => { const { result } = renderHook(useThreeQueries, { wrapper, }) - await link.waitForAllResponsesRecursively() + await link.waitForAllResponsesRecursively(10) expect(result.current).toEqual( catNames.map((catName) => ({ qualities: { diff --git a/src/index.ts b/src/index.ts index c509b3d..7fec7b2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,7 @@ import { OperationDefinitionNode, DefinitionNode, } from 'graphql' +import ZenObservable from 'zen-observable-ts' export { withApolloMocks, @@ -530,7 +531,7 @@ export class WildcardMockLink extends ApolloLink { ): void { if (observable) { const responsePromise = new Promise((resolve) => { - const resolvePromise = () => { + const resolvePromise = (): void => { resolve() this.pendingResponses.delete(responsePromise) } diff --git a/yarn.lock b/yarn.lock index cf5d838..12b839b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,24 +2,23 @@ # yarn lockfile v1 -"@apollo/client@3.3.21": - version "3.3.21" - resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.3.21.tgz#2862baa4e1ced8c5e89ebe6fc52877fc64a726aa" - integrity sha512-RAmZReFuKCKx0Rs5C0nVJwKomAHUHn+gGP/YvbEsXQWu0sXoncEUZa71UqlfCPVXa/0MkYOIbCXSQdOcuRrHgw== +"@apollo/client@3.5.10": + version "3.5.10" + resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.5.10.tgz#43463108a6e07ae602cca0afc420805a19339a71" + integrity sha512-tL3iSpFe9Oldq7gYikZK1dcYxp1c01nlSwtsMz75382HcI6fvQXyFXUCJTTK3wgO2/ckaBvRGw7VqjFREdVoRw== dependencies: "@graphql-typed-document-node/core" "^3.0.0" - "@types/zen-observable" "^0.8.0" "@wry/context" "^0.6.0" "@wry/equality" "^0.5.0" - fast-json-stable-stringify "^2.0.0" - graphql-tag "^2.12.0" + "@wry/trie" "^0.3.0" + graphql-tag "^2.12.3" hoist-non-react-statics "^3.3.2" - optimism "^0.16.0" + optimism "^0.16.1" prop-types "^15.7.2" symbol-observable "^4.0.0" - ts-invariant "^0.8.0" - tslib "^1.10.0" - zen-observable "^0.8.14" + ts-invariant "^0.9.4" + tslib "^2.3.0" + zen-observable-ts "^1.2.0" "@babel/code-frame@7.12.11": version "7.12.11" @@ -574,9 +573,9 @@ strip-json-comments "^3.1.1" "@graphql-typed-document-node/core@^3.0.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.0.tgz#0eee6373e11418bfe0b5638f654df7a4ca6a3950" - integrity sha512-wYn6r8zVZyQJ6rQaALBEln5B1pzxb9shV5Ef97kTvn6yVGrqyXVnDqnU24MXnFubR+rZjBY9NWuxX3FB2sTsjg== + version "3.2.0" + resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" + integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== "@humanwhocodes/config-array@^0.5.0": version "0.5.0" @@ -1031,11 +1030,6 @@ dependencies: "@types/yargs-parser" "*" -"@types/zen-observable@^0.8.0": - version "0.8.0" - resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d" - integrity sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg== - "@typescript-eslint/eslint-plugin@4.28.4": version "4.28.4" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.4.tgz#e73c8cabbf3f08dee0e1bda65ed4e622ae8f8921" @@ -1112,6 +1106,13 @@ dependencies: tslib "^2.1.0" +"@wry/context@^0.7.0": + version "0.7.3" + resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.7.3.tgz#240f6dfd4db5ef54f81f6597f6714e58d4f476a1" + integrity sha512-Nl8WTesHp89RF803Se9X3IiHjdmLBrIvPMaJkl+rKVJAYyPsz1TEUbu89943HpvujtSJgDUx9W4vZw3K1Mr3sA== + dependencies: + tslib "^2.3.0" + "@wry/equality@^0.5.0": version "0.5.1" resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.5.1.tgz#b22e4e1674d7bf1439f8ccdccfd6a785f6de68b0" @@ -2337,24 +2338,17 @@ graceful-fs@^4.2.4: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== -graphql-tag@2.12.5: - version "2.12.5" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.5.tgz#5cff974a67b417747d05c8d9f5f3cb4495d0db8f" - integrity sha512-5xNhP4063d16Pz3HBtKprutsPrmHZi5IdUGOWRxA2B6VF7BIRGOHZ5WQvDmJXZuPcBg7rYwaFxvQYjqkSdR3TQ== - dependencies: - tslib "^2.1.0" - -graphql-tag@^2.12.0: - version "2.12.3" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.3.tgz#ac47bf9d51c67c68ada8a33fd527143ed15bb647" - integrity sha512-5wJMjSvj30yzdciEuk9dPuUBUR56AqDi3xncoYQl1i42pGdSqOJrJsdb/rz5BDoy+qoGvQwABcBeF0xXY3TrKw== +graphql-tag@2.12.6, graphql-tag@^2.12.3: + version "2.12.6" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" + integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg== dependencies: tslib "^2.1.0" -graphql@15.5.1: - version "15.5.1" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.5.1.tgz#f2f84415d8985e7b84731e7f3536f8bb9d383aad" - integrity sha512-FeTRX67T3LoE3LWAxxOlW2K3Bz+rMYAC18rRguK4wgXaTZMiJwSUwDmPFo3UadAKbzirKIg5Qy+sNJXbpPRnQw== +graphql@16.8.0: + version "16.8.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.0.tgz#374478b7f27b2dc6153c8f42c1b80157f79d79d4" + integrity sha512-0oKGaR+y3qcS5mCu1vb7KG+a89vjn06C7Ihq/dDl3jA+A8B3TKomvi3CiEcVLJQGalbu8F52LxkOym7U5sSfbg== has-bigints@^1.0.1: version "1.0.1" @@ -3562,12 +3556,12 @@ onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" -optimism@^0.16.0: - version "0.16.1" - resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.16.1.tgz#7c8efc1f3179f18307b887e18c15c5b7133f6e7d" - integrity sha512-64i+Uw3otrndfq5kaoGNoY7pvOhSsjFEN4bdEFh80MWVk/dbgJfMv7VFDeCT8LxNAlEVhQmdVEbfE7X2nWNIIg== +optimism@^0.16.1: + version "0.16.2" + resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.16.2.tgz#519b0c78b3b30954baed0defe5143de7776bf081" + integrity sha512-zWNbgWj+3vLEjZNIh/okkY2EUfX+vB9TJopzIZwT1xxaMqC5hRLLraePod4c5n4He08xuXNH+zhKFFCu390wiQ== dependencies: - "@wry/context" "^0.6.0" + "@wry/context" "^0.7.0" "@wry/trie" "^0.3.0" optionator@^0.8.1: @@ -4377,10 +4371,10 @@ tree-kill@^1.2.2: resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== -ts-invariant@^0.8.0: - version "0.8.2" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.8.2.tgz#62af654ebfb8b1eeb55bc9adc2f40c6b93b0ff7e" - integrity sha512-VI1ZSMW8soizP5dU8DsMbj/TncHf7bIUqavuE7FTeYeQat454HHurJ8wbfCnVWcDOMkyiBUWOW2ytew3xUxlRw== +ts-invariant@^0.9.4: + version "0.9.4" + resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.9.4.tgz#42ac6c791aade267dd9dc65276549df5c5d71cac" + integrity sha512-63jtX/ZSwnUNi/WhXjnK8kz4cHHpYS60AnmA6ixz17l7E12a5puCWFlNpkne5Rl0J8TBPVHpGjsj4fxs8ObVLQ== dependencies: tslib "^2.1.0" @@ -4394,11 +4388,6 @@ tsconfig-paths@^3.9.0: minimist "^1.2.0" strip-bom "^3.0.0" -tslib@^1.10.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - tslib@^1.8.1, tslib@^1.9.0: version "1.11.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" @@ -4409,6 +4398,11 @@ tslib@^2.1.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c" integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w== +tslib@^2.3.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" @@ -4657,7 +4651,14 @@ yargs@^16.0.3, yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" -zen-observable@^0.8.14: +zen-observable-ts@1.2.5, zen-observable-ts@^1.2.0: + version "1.2.5" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz#6c6d9ea3d3a842812c6e9519209365a122ba8b58" + integrity sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg== + dependencies: + zen-observable "0.8.15" + +zen-observable@0.8.15: version "0.8.15" resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==