From 59427fa8962f1ff02edff21ddce652ae0512fce6 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 18 Oct 2022 12:51:50 +0800 Subject: [PATCH] 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. --- packages/content-handler/test/newsletter.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/content-handler/test/newsletter.test.ts b/packages/content-handler/test/newsletter.test.ts index 4a9524498..ad57a64aa 100644 --- a/packages/content-handler/test/newsletter.test.ts +++ b/packages/content-handler/test/newsletter.test.ts @@ -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', () => {