* Allow to run service tests for remote shields instance * Allow to run service tests for remote shields instance - doc * Load testedServerUrl from env variable * Load 'skipIntercepted' flag from env variable
32 lines
687 B
JavaScript
32 lines
687 B
JavaScript
'use strict'
|
|
|
|
// based on https://github.com/paulmelnikow/icedfrisby-nock/blob/master/icedfrisby-nock.js
|
|
// can be used to wrap the original "icedfrisby-nock" to check if request was intercepred
|
|
const factory = superclass =>
|
|
class IcedFrisbyNock extends superclass {
|
|
constructor(message) {
|
|
super(message)
|
|
this.intercepted = false
|
|
}
|
|
|
|
intercept(setup) {
|
|
super.intercept(setup)
|
|
this.intercepted = true
|
|
return this
|
|
}
|
|
|
|
networkOff() {
|
|
super.networkOff()
|
|
this.intercepted = true
|
|
return this
|
|
}
|
|
|
|
networkOn() {
|
|
super.networkOn()
|
|
this.intercepted = true
|
|
return this
|
|
}
|
|
}
|
|
|
|
module.exports = factory
|