From a7e17c6b983a98ee34ff6ff83400379f4ee07740 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Thu, 3 Dec 2020 21:46:01 +0000 Subject: [PATCH] Changed URL protocol in oembed acceptance tests - `https` was getting caught somewhere with nock and metascraper and caused each test case to hang for 3 seconds - `http` still tests what we want and is instant --- test/api-acceptance/admin/oembed_spec.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/api-acceptance/admin/oembed_spec.js b/test/api-acceptance/admin/oembed_spec.js index 0a2a47ca4a..9c4137fa21 100644 --- a/test/api-acceptance/admin/oembed_spec.js +++ b/test/api-acceptance/admin/oembed_spec.js @@ -62,7 +62,7 @@ describe('Oembed API', function () { describe('type: bookmark', function () { it('can fetch a bookmark with ?type=bookmark', async function () { - const pageMock = nock('https://example.com') + const pageMock = nock('http://example.com') .get('/') .reply( 200, @@ -70,7 +70,7 @@ describe('Oembed API', function () { {'content-type': 'text/html'} ); - const url = encodeURIComponent('https://example.com'); + const url = encodeURIComponent('http://example.com'); const res = await request.get(localUtils.API.getApiQuery(`oembed/?url=${url}&type=bookmark`)) .set('Origin', config.get('url')) .expect('Content-Type', /json/) @@ -79,12 +79,12 @@ describe('Oembed API', function () { pageMock.isDone().should.be.true(); res.body.type.should.eql('bookmark'); - res.body.url.should.eql('https://example.com'); + res.body.url.should.eql('http://example.com'); res.body.metadata.title.should.eql('TESTING'); }); it('falls back to bookmark without ?type=embed and no oembed metatag', async function () { - const pageMock = nock('https://example.com') + const pageMock = nock('http://example.com') .get('/') .times(2) // 1st = oembed metatag check, 2nd = metascraper .reply( @@ -93,7 +93,7 @@ describe('Oembed API', function () { {'content-type': 'text/html'} ); - const url = encodeURIComponent('https://example.com'); + const url = encodeURIComponent('http://example.com'); const res = await request.get(localUtils.API.getApiQuery(`oembed/?url=${url}`)) .set('Origin', config.get('url')) .expect('Content-Type', /json/) @@ -102,12 +102,12 @@ describe('Oembed API', function () { pageMock.isDone().should.be.true(); res.body.type.should.eql('bookmark'); - res.body.url.should.eql('https://example.com'); + res.body.url.should.eql('http://example.com'); res.body.metadata.title.should.eql('TESTING'); }); it('errors with useful message when title is unavailable', async function () { - const pageMock = nock('https://example.com') + const pageMock = nock('http://example.com') .get('/') .reply( 200, @@ -115,7 +115,7 @@ describe('Oembed API', function () { {'content-type': 'text/html'} ); - const url = encodeURIComponent('https://example.com'); + const url = encodeURIComponent('http://example.com'); const res = await request.get(localUtils.API.getApiQuery(`oembed/?type=bookmark&url=${url}`)) .set('Origin', config.get('url')) .expect('Content-Type', /json/)