Title: Object destructuring + rest doesn't work · Issue #129 · ffMathy/FluffySpoon.JavaScript.Testing.Faking · GitHub
Open Graph Title: Object destructuring + rest doesn't work · Issue #129 · ffMathy/FluffySpoon.JavaScript.Testing.Faking
X Title: Object destructuring + rest doesn't work · Issue #129 · ffMathy/FluffySpoon.JavaScript.Testing.Faking
Description: Describe the bug I cant use a Substitute mock for code that uses object destructuring + rest To Reproduce import Substitute from "@fluffy-spoon/substitute"; type Entity = { id: number; name: string; lastName: string }; const copyEntity =...
Open Graph Description: Describe the bug I cant use a Substitute mock for code that uses object destructuring + rest To Reproduce import Substitute from "@fluffy-spoon/substitute"; type Entity = { id: number; name: string...
X Description: Describe the bug I cant use a Substitute mock for code that uses object destructuring + rest To Reproduce import Substitute from "@fluffy-spoon/substitute"; type Entity = { id: number; na...
Opengraph URL: https://github.com/ffMathy/FluffySpoon.JavaScript.Testing.Faking/issues/129
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Object destructuring + rest doesn't work","articleBody":"**Describe the bug**\r\nI cant use a Substitute mock for code that uses object destructuring + rest\r\n\r\n**To Reproduce**\r\n```typescript\r\nimport Substitute from \"@fluffy-spoon/substitute\";\r\n\r\ntype Entity = { id: number; name: string; lastName: string };\r\n\r\nconst copyEntity = (entity: Entity) =\u003e {\r\n const { id, ...params } = entity;\r\n console.log(params);\r\n};\r\n\r\nconst mockEntity = Substitute.for\u003cEntity\u003e();\r\nmockEntity.id.returns!(1);\r\nmockEntity.name.returns!('test name');\r\nmockEntity.lastName.returns!('test last name');\r\n\r\ncopyEntity(mockEntity); // empty object\r\ncopyEntity({id:1, name: 'test name', lastName: 'test last name'}) // {name: 'test name', lastName: 'test last name'}\r\n\r\n```\r\nCodesandbox:\r\nhttps://codesandbox.io/s/flamboyant-sea-o5zf4?file=/src/index.ts:0-469\r\n\r\n**Expected behavior**\r\nI should be able to test functions using destructuring with the rest pattern\r\n\r\n**Environment**\r\n- Typescript version: `3.9.3 `\r\n- substitute.js version: `1.145.0 `\r\n- Node version: `12 `\r\n\r\n\r\n","author":{"url":"https://github.com/0xjocke","@type":"Person","name":"0xjocke"},"datePublished":"2020-09-17T05:38:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/129/FluffySpoon.JavaScript.Testing.Faking/issues/129"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7ada4a71-ee9a-20b2-9b81-4b31cc37e412 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D934:938B4:1516B63:1B2EC93:697FA500 |
| html-safe-nonce | 7b89847f52d43e84581d2e10c6a7893be98ff65c76d7b4022ffbe7adbd20a462 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTM0OjkzOEI0OjE1MTZCNjM6MUIyRUM5Mzo2OTdGQTUwMCIsInZpc2l0b3JfaWQiOiI3MDQ5NTQ3Nzg5OTkwMDc3Njk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | dc46b6dc31f3d13f748c4d244556a2b5a8149fcdcc3d4f2f5d2d16c0308125f9 |
| hovercard-subject-tag | issue:703282976 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ffMathy/FluffySpoon.JavaScript.Testing.Faking/129/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4bdbebb9e91200c983425a6e01bfd86803419c242c2078870965a76c3ee9fe91/ffMathy/FluffySpoon.JavaScript.Testing.Faking/issues/129 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4bdbebb9e91200c983425a6e01bfd86803419c242c2078870965a76c3ee9fe91/ffMathy/FluffySpoon.JavaScript.Testing.Faking/issues/129 |
| og:image:alt | Describe the bug I cant use a Substitute mock for code that uses object destructuring + rest To Reproduce import Substitute from "@fluffy-spoon/substitute"; type Entity = { id: number; name: string... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 0xjocke |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/ffMathy/FluffySpoon.JavaScript.Testing.Faking git https://github.com/ffMathy/FluffySpoon.JavaScript.Testing.Faking.git |
| octolytics-dimension-user_id | 2824010 |
| octolytics-dimension-user_login | ffMathy |
| octolytics-dimension-repository_id | 139153585 |
| octolytics-dimension-repository_nwo | ffMathy/FluffySpoon.JavaScript.Testing.Faking |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 139153585 |
| octolytics-dimension-repository_network_root_nwo | ffMathy/FluffySpoon.JavaScript.Testing.Faking |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width