diff --git a/test/webrequest-on-before-redirect.spec.js b/test/webrequest-on-before-redirect.spec.js index 07ae656..cf4d718 100644 --- a/test/webrequest-on-before-redirect.spec.js +++ b/test/webrequest-on-before-redirect.spec.js @@ -78,10 +78,7 @@ describe('onBeforeRedirect', function () { }) afterEach(function * () { - nightmare.child.removeAllListeners('onBeforeRequest') nightmare.onBeforeRequest(null) - - nightmare.child.removeAllListeners('onBeforeRedirect') nightmare.onBeforeRedirect(null) yield nightmare.end() diff --git a/test/webrequest-on-before-request.spec.js b/test/webrequest-on-before-request.spec.js index 4739080..a86d466 100644 --- a/test/webrequest-on-before-request.spec.js +++ b/test/webrequest-on-before-request.spec.js @@ -174,10 +174,10 @@ describe('onBeforeRequest', function () { result.url.should.equal(result.url, 'http://localhost:7500/') result.method.should.equal(result.method, 'POST') result.resourceType.should.equal(result.resourceType, 'xhr') - qs.parse(new Buffer(result.uploadData[0].bytes.data).toString()).should.deep.equals({ - name: 'post test', + + JSON.stringify(qs.parse(new Buffer(result.uploadData[0].bytes.data).toString())).should.equals(JSON.stringify({ name: 'post test', type: 'string' - }) + })) }) it('can redirect the request', function * () { @@ -216,7 +216,6 @@ describe('onBeforeRequest', function () { }) afterEach(function * () { - nightmare.child.removeAllListeners('onBeforeRequest') nightmare.onBeforeRequest(null) yield nightmare.end() diff --git a/test/webrequest-on-before-send-headers.spec.js b/test/webrequest-on-before-send-headers.spec.js index 611f8a6..7d9994e 100644 --- a/test/webrequest-on-before-send-headers.spec.js +++ b/test/webrequest-on-before-send-headers.spec.js @@ -143,10 +143,7 @@ describe('onBeforeSendHeaders', function () { }) afterEach(function * () { - nightmare.child.removeAllListeners('onBeforeSendHeaders') nightmare.onBeforeSendHeaders(null) - - nightmare.child.removeAllListeners('onSendHeaders') nightmare.onSendHeaders(null) yield nightmare.end() diff --git a/test/webrequest-on-completed.spec.js b/test/webrequest-on-completed.spec.js index 211d3ae..45d93f4 100644 --- a/test/webrequest-on-completed.spec.js +++ b/test/webrequest-on-completed.spec.js @@ -66,7 +66,6 @@ describe('onCompleted', function () { }) afterEach(function * () { - nightmare.child.removeAllListeners('onCompleted') nightmare.onCompleted(null) yield nightmare.end() diff --git a/test/webrequest-on-send-headers.spec.js b/test/webrequest-on-send-headers.spec.js index 7c9fdc0..9a033c7 100644 --- a/test/webrequest-on-send-headers.spec.js +++ b/test/webrequest-on-send-headers.spec.js @@ -78,7 +78,6 @@ describe('onSendHeaders', function () { }) afterEach(function * () { - nightmare.child.removeAllListeners('onSendHeaders') nightmare.onSendHeaders(null) yield nightmare.end() })