mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
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
This commit is contained in:
parent
9ff7423b2b
commit
a7e17c6b98
1 changed files with 8 additions and 8 deletions
|
@ -62,7 +62,7 @@ describe('Oembed API', function () {
|
||||||
|
|
||||||
describe('type: bookmark', function () {
|
describe('type: bookmark', function () {
|
||||||
it('can fetch a bookmark with ?type=bookmark', async function () {
|
it('can fetch a bookmark with ?type=bookmark', async function () {
|
||||||
const pageMock = nock('https://example.com')
|
const pageMock = nock('http://example.com')
|
||||||
.get('/')
|
.get('/')
|
||||||
.reply(
|
.reply(
|
||||||
200,
|
200,
|
||||||
|
@ -70,7 +70,7 @@ describe('Oembed API', function () {
|
||||||
{'content-type': 'text/html'}
|
{'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`))
|
const res = await request.get(localUtils.API.getApiQuery(`oembed/?url=${url}&type=bookmark`))
|
||||||
.set('Origin', config.get('url'))
|
.set('Origin', config.get('url'))
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
|
@ -79,12 +79,12 @@ describe('Oembed API', function () {
|
||||||
|
|
||||||
pageMock.isDone().should.be.true();
|
pageMock.isDone().should.be.true();
|
||||||
res.body.type.should.eql('bookmark');
|
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');
|
res.body.metadata.title.should.eql('TESTING');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('falls back to bookmark without ?type=embed and no oembed metatag', async function () {
|
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('/')
|
.get('/')
|
||||||
.times(2) // 1st = oembed metatag check, 2nd = metascraper
|
.times(2) // 1st = oembed metatag check, 2nd = metascraper
|
||||||
.reply(
|
.reply(
|
||||||
|
@ -93,7 +93,7 @@ describe('Oembed API', function () {
|
||||||
{'content-type': 'text/html'}
|
{'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}`))
|
const res = await request.get(localUtils.API.getApiQuery(`oembed/?url=${url}`))
|
||||||
.set('Origin', config.get('url'))
|
.set('Origin', config.get('url'))
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
|
@ -102,12 +102,12 @@ describe('Oembed API', function () {
|
||||||
|
|
||||||
pageMock.isDone().should.be.true();
|
pageMock.isDone().should.be.true();
|
||||||
res.body.type.should.eql('bookmark');
|
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');
|
res.body.metadata.title.should.eql('TESTING');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('errors with useful message when title is unavailable', async function () {
|
it('errors with useful message when title is unavailable', async function () {
|
||||||
const pageMock = nock('https://example.com')
|
const pageMock = nock('http://example.com')
|
||||||
.get('/')
|
.get('/')
|
||||||
.reply(
|
.reply(
|
||||||
200,
|
200,
|
||||||
|
@ -115,7 +115,7 @@ describe('Oembed API', function () {
|
||||||
{'content-type': 'text/html'}
|
{'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}`))
|
const res = await request.get(localUtils.API.getApiQuery(`oembed/?type=bookmark&url=${url}`))
|
||||||
.set('Origin', config.get('url'))
|
.set('Origin', config.get('url'))
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
|
|
Loading…
Reference in a new issue