Object/Trait

io.scalajs.npm.nock

Nock

Related Docs: trait Nock | package nock

Permalink

object Nock extends Object with Nock

Nock Singleton

Annotations
@native() @JSImport( "nock" , JSImport.Namespace )
Linear Supertypes
Nock, Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Nock
  2. Nock
  3. Object
  4. Any
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def activeMocks(): Array[String]

    Permalink

    You can see every mock that is currently active (i.e.

    You can see every mock that is currently active (i.e. might potentially reply to requests) in a scope using scope.activeMocks(). A mock is active if it is pending, optional but not yet completed, or persisted. Mocks that have intercepted their requests and are no longer doing anything are the only mocks which won't appear here. You probably don't need to use this - it mainly exists as a mechanism to recreate the previous (now-changed) behavior of pendingMocks().

    returns

    the array of active mocks

    Definition Classes
    Nock
  5. def apply(url: Any, options: |[NockOptions, Any] = js.native): Nock

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def basicAuth(options: |[NockBasicAuth, Any]): Nock.this.type

    Permalink

    Basic authentication can be specified

    Basic authentication can be specified

    options

    the basic authentication options

    Definition Classes
    Nock
  8. def cleanAll(): Nock.this.type

    Permalink

    You can cleanup all the prepared mocks (could be useful to cleanup some state after a failed test)

    You can cleanup all the prepared mocks (could be useful to cleanup some state after a failed test)

    Definition Classes
    Nock
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def delay(options: |[NockDelayBody, Any]): Nock.this.type

    Permalink

    You are able to specify the number of milliseconds that the response body should be delayed.

    You are able to specify the number of milliseconds that the response body should be delayed. Response header will be replied immediately. delayBody(1000) is equivalent to delay({body: 1000}).

    options

    an object containing the delay in milliseconds

    Definition Classes
    Nock
  11. def delayBody(millis: Int): Nock.this.type

    Permalink

    You are able to specify the number of milliseconds that the response body should be delayed.

    You are able to specify the number of milliseconds that the response body should be delayed. Response header will be replied immediately. delayBody(1000) is equivalent to delay({body: 1000}).

    millis

    the given delay in milliseconds

    Definition Classes
    Nock
  12. def delete(uri: Any): Nock.this.type

    Permalink

    HTTP DELETE

    HTTP DELETE

    uri

    the given url

    Definition Classes
    Nock
  13. def disableNetConnect(host: Any = js.native): Nock.this.type

    Permalink

    By default, any requests made to a host that is not mocked will be executed normally.

    By default, any requests made to a host that is not mocked will be executed normally. If you want to block these requests, nock allows you to do so.

    For disabling real http requests.

    Definition Classes
    Nock
  14. def enableNetConnect(host: Any = js.native): Nock.this.type

    Permalink

    For enabling real HTTP requests (the default behaviour).

    For enabling real HTTP requests (the default behaviour).

    Definition Classes
    Nock
  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def get(uri: Any): Nock.this.type

    Permalink

    HTTP GET

    HTTP GET

    uri

    the given url

    Definition Classes
    Nock
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  21. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  22. def head(uri: Any): Nock.this.type

    Permalink

    HTTP HEAD

    HTTP HEAD

    uri

    the given url

    Definition Classes
    Nock
  23. def isDone(): Boolean

    Permalink

    You can call isDone() on a single expectation to determine if the expectation was met

    You can call isDone() on a single expectation to determine if the expectation was met

    returns

    true, if the expectation was met

    Definition Classes
    Nock
  24. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  25. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  26. def load(pathToJson: String): Object

    Permalink

    If you save this as a JSON file, you can load them directly through nock.load(path).

    If you save this as a JSON file, you can load them directly through nock.load(path). Then you can post-process them before using them in the tests for example to add them request body filtering (shown here fixing timestamps to match the ones captured during recording)

    pathToJson

    the path to the JSON file

    returns

    the loaded object

    Definition Classes
    Nock
  27. def log(logger: Any): Nock.this.type

    Permalink

    Nock can log matches if you pass in a log function

    Nock can log matches if you pass in a log function

    logger

    the given logger function

    Definition Classes
    Nock
    Example:
    1. Nock.log(console.log)
  28. def matchHeader(key: String, value: Any): Nock.this.type

    Permalink
    Definition Classes
    Nock
  29. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  30. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. def once(): Nock.this.type

    Permalink
    Definition Classes
    Nock
  33. def optionally(): Nock.this.type

    Permalink
    Definition Classes
    Nock
  34. def patch(uri: String, body: Any = js.native): Nock.this.type

    Permalink

    HTTP PATCH

    HTTP PATCH

    uri

    the given url

    Definition Classes
    Nock
  35. def pendingMocks(): Array[String]

    Permalink

    You can inspect the scope to infer which ones are still pending

    You can inspect the scope to infer which ones are still pending

    returns

    the array of pending mocks

    Definition Classes
    Nock
  36. def persist(): Nock.this.type

    Permalink

    You can make all the interceptors for a scope persist by calling .persist() on it

    You can make all the interceptors for a scope persist by calling .persist() on it

    returns

    self

    Definition Classes
    Nock
  37. def post(uri: String, body: Any = js.native): Nock.this.type

    Permalink

    HTTP POST

    HTTP POST

    uri

    the given url

    Definition Classes
    Nock
  38. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  39. def query(params: Any): Nock.this.type

    Permalink
    Definition Classes
    Nock
  40. def recorder: NockRecorder

    Permalink

    This is a cool feature: Guessing what the HTTP calls are is a mess, specially if you are introducing nock on your already-coded tests.

    This is a cool feature: Guessing what the HTTP calls are is a mess, specially if you are introducing nock on your already-coded tests. For these cases where you want to mock an existing live system you can record and playback the HTTP calls like this:

    returns

    the recorder instance

    Definition Classes
    Nock
  41. def removeInterceptor(options: |[NockInterceptorOptions, Any] = js.native): Nock.this.type

    Permalink
    Definition Classes
    Nock
  42. def reply(statusCode: Int, response: Any = js.native): Nock.this.type

    Permalink
    Definition Classes
    Nock
  43. def replyWithError(error: Any): Nock.this.type

    Permalink
    Definition Classes
    Nock
  44. def restore(): Nock.this.type

    Permalink

    You can restore the HTTP interceptor to the normal unmocked behaviour

    You can restore the HTTP interceptor to the normal unmocked behaviour

    Definition Classes
    Nock
  45. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  46. def thrice(): Nock.this.type

    Permalink
    Definition Classes
    Nock
  47. def times(count: Int): Nock.this.type

    Permalink
    Definition Classes
    Nock
  48. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  49. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  50. def twice(): Nock.this.type

    Permalink
    Definition Classes
    Nock
  51. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  52. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  53. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Nock

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped