Conversation
| import nock from "nock"; | ||
| import isEqual from "lodash.isequal"; | ||
|
|
||
| interface Response { |
There was a problem hiding this comment.
If we want, we could use the types built in to express (express.Request and express.Response). If not, we can add a property to each [key: string]: any to allow any extra properties to be set
There was a problem hiding this comment.
Isn't that a little weird, since this library has nothing to do with express?
hmm what kind of extra properties would we want to set on these? They're there to serve a pretty specific purpose.
There was a problem hiding this comment.
Just if the user wanted to add any additional properties to Request or Response, than the ones provided. Unless nobody would be providing anything else
There was a problem hiding this comment.
Yeah, no one should be doing that. maybe making these types at all is a mistake, I thought it would be easier but maybe not.
src/index.ts
Outdated
| } | ||
| } | ||
|
|
||
| export default function makeNockInspector(options: { |
There was a problem hiding this comment.
Instead of this, we can export the class declaration export default class NockInspector, then library consumers can just call new NockInspector
There was a problem hiding this comment.
maybe... but don't we want this to work with the code we already have?
There was a problem hiding this comment.
That's true, to match the current version we should have this same function exposed
| private numberedResponses: { [key: number]: Response } = {}; | ||
| private scope: nock; | ||
|
|
||
| constructor({ |
There was a problem hiding this comment.
I think it would be nicer if we just added regular parameters instead of using an object parameter, since typescript gives us the definitions. Then we can declare it like:
constructor(
basePath: string,
endpoint: string,
response: Response = { status: 200},
method: string = 'get'
)
There was a problem hiding this comment.
I think it's slightly more readable but either way works, really
No description provided.