-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Disconnect from all adapters when
pause
is called (#291)
BREAKING CHANGE: Calling `polly.pause()` will now disconnect from all connected adapters instead of setting the mode to passthrough. Calling `polly.play()` will reconnect to the disconnected adapters before pause was called.
- Loading branch information
1 parent
92f05d2
commit 5c655bf
Showing
6 changed files
with
121 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default function pollyTests() { | ||
it('should not handle any requests when paused', async function() { | ||
const { server } = this.polly; | ||
const requests = []; | ||
|
||
server.any().on('request', req => requests.push(req)); | ||
|
||
await this.fetchRecord(); | ||
await this.fetchRecord(); | ||
|
||
this.polly.pause(); | ||
await this.fetchRecord(); | ||
await this.fetchRecord(); | ||
|
||
this.polly.play(); | ||
await this.fetchRecord(); | ||
|
||
expect(requests.length).to.equal(3); | ||
expect(this.polly._requests.length).to.equal(3); | ||
expect(requests.map(r => r.order)).to.deep.equal([0, 1, 2]); | ||
}); | ||
} |