Skip to content

Commit 35f9957

Browse files
docs: add github issue templates and rephrase README (#1)
* docs: add github issue templates and rephrase README * fix: add test to release command
1 parent f809010 commit 35f9957

File tree

5 files changed

+50
-11
lines changed

5 files changed

+50
-11
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Bug Report
3+
about: Report an issue with existing features
4+
title: ""
5+
labels: ""
6+
assignees: ""
7+
---
8+
9+
# Bug Report
10+
11+
<!-- Summary of the issue -->
12+
13+
## Steps to Reproduce
14+
15+
<!-- Detailed steps for reproducing the problem, preferably with code samples that can be copied and run -->
16+
17+
## Actual behavior
18+
19+
<!-- What happened, and why it was wrong -->
20+
21+
## Expected behavior
22+
23+
<!-- What you expected to happen instead, and why -->

.github/ISSUE_TEMPLATE/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new feature
4+
title: ""
5+
labels: ""
6+
assignees: ""
7+
---
8+
9+
# Feature Request
10+
11+
<!-- Summary of the feature -->
12+
13+
## Use cases
14+
15+
<!-- What do you want this for and why would it be useful to add -->

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030
## About
3131

32-
Have you ever needed to mock something that has hundreds or thousands of nested properties and functions? You don't need all of those to be implemented, just exist so the code doesn't crash. This is the solution.
32+
Have you ever wanted to mock something that has lots of nested properties and functions? You don't need all of those to be implemented. You just want them to exist so the code doesn't crash. This is the solution.
3333

34-
Recursive Proxy Mock is a [JavaScript Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) that can handle literally anything. This is best explained with examples, read on!
34+
Recursive Proxy Mock is a [JavaScript Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) that can handle literally anything. This is best explained with examples. Read on!
3535

3636
## Examples
3737

@@ -136,10 +136,10 @@ if (hasPathBeenCalledWith(mock, ["a", "b", "c", ProxySymbol.APPLY], ["hi", true,
136136
Main function to create the recursive proxy mock object.
137137

138138
- `overrides` - _\[optional]_ - an array of objects that contain `path` and `value`.
139-
- `path` - see the [ProxyPath section](#ProxyPath) for more details.
139+
- `path` - see the [ProxyPath section](#proxypath) for more details.
140140
- `value` - the value to return instead of another recursive proxy. This needs to match the type of the path. So if your path ends in `ProxySymbol.APPLY` this value must be a function which will be called with whatever arguments the proxy was called with.
141141

142-
See [Example Above](#Override-the-default-proxy-behavior-with-custom-values) for more details.
142+
See [Example Above](#override-the-default-proxy-behavior-with-custom-values) for more details.
143143

144144
#### TypeScript Support
145145

@@ -174,15 +174,15 @@ These symbols are used to construct paths for the following functions:
174174
Function to check if a certain path was ever visited. Useful in conjunction with test assertions.
175175

176176
- `proxy` - the root proxy object that was returned from `recursiveProxyMock`
177-
- `path` - see the [ProxyPath section](#ProxyPath) for more details.
177+
- `path` - see the [ProxyPath section](#proxypath) for more details.
178178
- Returns: `true` if the specified path has ever been visited on the proxy object, `false` if not.
179179

180180
### `hasPathBeenCalledWith(proxy, path, args) => boolean`
181181

182182
Function to check if a certain path was ever called (as a function or class constructor). Useful in conjunction with test assertions. Very similar to `hasPathBeenVisited` but specific for method calls and designed to be easier to use than parsing `getVisitedPathData` yourself.
183183

184184
- `proxy` - the root proxy object that was returned from `recursiveProxyMock`
185-
- `path` - see the [ProxyPath section](#ProxyPath) for more details. The path must end in `ProxySymbol.APPLY` or `ProxySymbol.CONSTRUCT`.
185+
- `path` - see the [ProxyPath section](#proxypath) for more details. The path must end in `ProxySymbol.APPLY` or `ProxySymbol.CONSTRUCT`.
186186
- `args` - an array of arguments that should have been passed to the specified path
187187
- Returns: `true` if the specified path has ever been called on the proxy object, `false` if not.
188188

@@ -191,7 +191,7 @@ Function to check if a certain path was ever called (as a function or class cons
191191
Function to get details about every time a path was visited. Useful in conjunction with test assertions to get the number of visits, arguments passed, etc.
192192

193193
- `proxy` - the root proxy object that was returned from `recursiveProxyMock`
194-
- `path` - see the [ProxyPath section](#ProxyPath) for more details.
194+
- `path` - see the [ProxyPath section](#proxypath) for more details.
195195
- Returns: Array of `ProxyData` objects, one for each time the path was visited on the proxy object. `null` if it was never visited.
196196

197197
#### ProxyData
@@ -213,16 +213,16 @@ A `ProxyData` object contains any relevant details about the operation. For exam
213213

214214
### `listAllProxyOperations(proxy) => ProxyData[]`
215215

216-
A debug function which lists the raw "proxy stack" of every operation that was performed on the mock. This is an array of [ProxyData](#ProxyData) objects which have metadata that is used to power all of the other functions. For example, every object has a `parent` property which contains a number. This number will be the same as some other object's `self` property. Using those two values you can construct a tree containing every path that was accessed on the object.
216+
A debug function which lists the raw "proxy stack" of every operation that was performed on the mock. This is an array of [ProxyData](#proxydata) objects which have metadata that is used to power all of the other functions. For example, every object has a `parent` property which contains a number. This number will be the same as some other object's `self` property. Using those two values you can construct a tree containing every path that was accessed on the object.
217217

218218
This is exposed primarily for debugging or curiosity and shouldn't be relied on. If you find yourself needing to use the data here, [create an Issue](https://github.com/CreativeTechGuy/recursive-proxy-mock/issues/new/choose) explaining your use-case and we may add a function to support that directly.
219219

220220
- `proxy` - the root proxy object that was returned from `recursiveProxyMock`
221-
- Returns: Array of [ProxyData](#ProxyData) objects for every operation that was performed on the mock.
221+
- Returns: Array of [ProxyData](#proxydata) objects for every operation that was performed on the mock.
222222

223223
### ProxyPath
224224

225-
Whenever a method accepts a `path` it is an array of properties and symbols to define a request path on the mock object. (See [ProxySymbol](#ProxySymbol) for more details.)
225+
Whenever a method accepts a `path` it is an array of properties and symbols to define a request path on the mock object. (See [ProxySymbol](#proxysymbol) for more details.)
226226

227227
- Examples:
228228
- `mock.test.abc` => `["test", "abc"]`

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"node": ">=12"
3333
},
3434
"scripts": {
35-
"release": "npm run lint && npm run format:check && npm run spellcheck && npm run build",
35+
"release": "npm run lint && npm run format:check && npm run spellcheck && npm run test && npm run build",
3636
"build": "rm -rf dist && rollup -c",
3737
"lint": "eslint . --max-warnings 0",
3838
"lint:fix": "npm run lint -- --fix",

0 commit comments

Comments
 (0)