Skip to content

Nock Testing .get() quirk #27

Description

@tspeed90

I was practising writing a test using nock and discovered an odd thing about the .get() part. It seems that for my test to pass, I had to end the API url portion of the line with a slash, but also had to begin the .get() part with one as well. I thought if the url part ended with a slash, you wouldn't start the 'get' with one, but somehow that's what it wants? @eliasCodes' example had neither a slash at the end nor a slash at the beginning, so I tried that also, but my tests still failed. So not entirely sure how it all works, but thought I would pass this along.

Example of the bit that passed:
nock-test

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions