Mock the substack domain also when testing redirects

We were making the actual call to the redirected URL here,
instead of mocking it. We need to mock both the embedded email
domain, and the domain we are redirected to.
This commit is contained in:
Jackson Harper
2022-10-18 12:51:50 +08:00
parent 57676d381c
commit 59427fa896

View File

@ -172,8 +172,9 @@ describe('Newsletter email test', () => {
Location:
'https://newsletter.slowchinese.net/p/companies-that-eat-people-217',
})
.get('/p/companies-that-eat-people-217')
.reply(200, '')
nock('https://newsletter.slowchinese.net')
.head('/p/companies-that-eat-people-217')
.reply(200, '')
})
after(() => {
nock.restore()
@ -186,7 +187,7 @@ describe('Newsletter email test', () => {
expect(url).to.startWith(
'https://newsletter.slowchinese.net/p/companies-that-eat-people-217'
)
}).timeout(10000)
})
})
context('when email is from beehiiv', () => {