Skip to content

Include initializing the supertest Test hash in README examples#4

Open
loucadufault wants to merge 1 commit into
rodrigowirth:masterfrom
loucadufault:patch-docs
Open

Include initializing the supertest Test hash in README examples#4
loucadufault wants to merge 1 commit into
rodrigowirth:masterfrom
loucadufault:patch-docs

Conversation

@loucadufault

Copy link
Copy Markdown

Previously, the # Usage examples referenced the default exported supertest function of shape (app): SuperagentImplementorFunc (see * Appendix) as if it was the produced function implementing the superagent interface itself (resulting from calling superagent's default export with the initialization app or url).

import request from 'supertest';

// not a valid usage
await request
  .get('/cars') // Becomes /api/cars
  ...

Also, in the example usage with superagent-defaults, the supertest import is unused and the created defaults context does not rely on supertest as illustrated in their docs: https://github.com/camshaft/superagent-defaults#usage .

import supertest from 'supertest';
import defaults from 'superagent-defaults';

...

// Create a defaults context
var request = defaults();

* Appendix

type SuperagentImplementorFunc = {
  [method: string]: (url: string) => superagent.Test
}

in the case of supertest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant