Skip to content

Commit

Permalink
test: add test proving duplicate mock issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mbargiel committed Feb 17, 2024
1 parent 8bab28d commit c366ed1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/got/test_nock_lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,19 @@ describe('Nock lifecycle functions', () => {
await got('http://example.test/')
expect(nock.activeMocks()).to.be.empty()
})

it("activeMocks doesn't return duplicate mocks", () => {
nock('http://example.test')
.get('/').reply()
.get('/second').reply()
.get('/third').reply()

expect(nock.activeMocks()).to.deep.equal([
'GET http://example.test:80/',
'GET http://example.test:80/second',
'GET http://example.test:80/third',
])
})
})

describe('resetting nock catastrophically while a request is in progress', () => {
Expand Down

0 comments on commit c366ed1

Please sign in to comment.