mirror of
https://github.com/TryGhost/Ghost.git
synced 2023-12-13 21:00:40 +01:00
Used got
to handle requests for image-size (#8892)
refs #8589, refs #8868 - swap `request` with `got` in `getImageSizeFromUrl` util - less handling for request cases e.g. timeouts, follow redirects
This commit is contained in:
parent
bf47397ac2
commit
30bee115fe
5 changed files with 383 additions and 258 deletions
|
@ -14,17 +14,14 @@
|
|||
// we add the protocol to the incomplete one and use urlFor() to get the absolute URL.
|
||||
// If the request fails or image-size is not able to read the file, we reject with error.
|
||||
|
||||
var sizeOf = require('image-size'),
|
||||
url = require('url'),
|
||||
Promise = require('bluebird'),
|
||||
http = require('http'),
|
||||
https = require('https'),
|
||||
config = require('../config'),
|
||||
utils = require('../utils'),
|
||||
errors = require('../errors'),
|
||||
dimensions,
|
||||
request,
|
||||
requestHandler;
|
||||
var sizeOf = require('image-size'),
|
||||
url = require('url'),
|
||||
Promise = require('bluebird'),
|
||||
got = require('got'),
|
||||
config = require('../config'),
|
||||
utils = require('../utils'),
|
||||
errors = require('../errors'),
|
||||
dimensions;
|
||||
|
||||
/**
|
||||
* @description read image dimensions from URL
|
||||
|
@ -32,90 +29,75 @@ var sizeOf = require('image-size'),
|
|||
* @returns {Promise<Object>} imageObject or error
|
||||
*/
|
||||
module.exports.getImageSizeFromUrl = function getImageSizeFromUrl(imagePath) {
|
||||
return new Promise(function imageSizeRequest(resolve, reject) {
|
||||
var imageObject = {},
|
||||
options,
|
||||
timeout = config.get('times:getImageSizeTimeoutInMS') || 10000;
|
||||
var imageObject = {},
|
||||
requestOptions,
|
||||
timeout = config.get('times:getImageSizeTimeoutInMS') || 10000;
|
||||
|
||||
imageObject.url = imagePath;
|
||||
imageObject.url = imagePath;
|
||||
|
||||
// check if we got an url without any protocol
|
||||
if (imagePath.indexOf('http') === -1) {
|
||||
// our gravatar urls start with '//' in that case add 'http:'
|
||||
if (imagePath.indexOf('//') === 0) {
|
||||
// it's a gravatar url
|
||||
imagePath = 'http:' + imagePath;
|
||||
} else {
|
||||
// get absolute url for image
|
||||
imagePath = utils.url.urlFor('image', {image: imagePath}, true);
|
||||
}
|
||||
// check if we got an url without any protocol
|
||||
if (imagePath.indexOf('http') === -1) {
|
||||
// our gravatar urls start with '//' in that case add 'http:'
|
||||
if (imagePath.indexOf('//') === 0) {
|
||||
// it's a gravatar url
|
||||
imagePath = 'http:' + imagePath;
|
||||
} else {
|
||||
// get absolute url for image
|
||||
imagePath = utils.url.urlFor('image', {image: imagePath}, true);
|
||||
}
|
||||
}
|
||||
|
||||
options = url.parse(imagePath);
|
||||
imagePath = url.parse(imagePath);
|
||||
requestOptions = {
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0'
|
||||
},
|
||||
timeout: timeout,
|
||||
encoding: null
|
||||
};
|
||||
|
||||
requestHandler = imagePath.indexOf('https') === 0 ? https : http;
|
||||
options.headers = {'User-Agent': 'Mozilla/5.0'};
|
||||
return got(
|
||||
imagePath,
|
||||
requestOptions
|
||||
).then(function (response) {
|
||||
try {
|
||||
// response.body contains the Buffer. Using the Buffer rather than an URL
|
||||
// requires to use sizeOf synchronously. See https://github.com/image-size/image-size#asynchronous
|
||||
dimensions = sizeOf(response.body);
|
||||
|
||||
request = requestHandler.get(options, function (res) {
|
||||
var chunks = [];
|
||||
imageObject.width = dimensions.width;
|
||||
imageObject.height = dimensions.height;
|
||||
|
||||
res.on('data', function (chunk) {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
|
||||
res.on('end', function () {
|
||||
if (res.statusCode === 200) {
|
||||
try {
|
||||
dimensions = sizeOf(Buffer.concat(chunks));
|
||||
|
||||
imageObject.width = dimensions.width;
|
||||
imageObject.height = dimensions.height;
|
||||
|
||||
return resolve(imageObject);
|
||||
} catch (err) {
|
||||
return reject(new errors.InternalServerError({
|
||||
code: 'IMAGE_SIZE',
|
||||
err: err,
|
||||
context: imagePath
|
||||
}));
|
||||
}
|
||||
} else if (res.statusCode === 404) {
|
||||
return reject(new errors.NotFoundError({
|
||||
message: 'Image not found.',
|
||||
code: 'IMAGE_SIZE',
|
||||
statusCode: res.statusCode,
|
||||
context: imagePath
|
||||
}));
|
||||
} else {
|
||||
return reject(new errors.InternalServerError({
|
||||
message: 'Unknown Request error.',
|
||||
code: 'IMAGE_SIZE',
|
||||
statusCode: res.statusCode,
|
||||
context: imagePath
|
||||
}));
|
||||
}
|
||||
});
|
||||
}).on('socket', function (socket) {
|
||||
if (timeout) {
|
||||
socket.setTimeout(timeout);
|
||||
|
||||
/**
|
||||
* https://nodejs.org/api/http.html
|
||||
* "...if a callback is assigned to the Server's 'timeout' event, timeouts must be handled explicitly"
|
||||
*
|
||||
* socket.destroy will jump to the error listener
|
||||
*/
|
||||
socket.on('timeout', function () {
|
||||
request.abort();
|
||||
socket.destroy(new Error('Request timed out.'));
|
||||
});
|
||||
}
|
||||
}).on('error', function (err) {
|
||||
return reject(new errors.InternalServerError({
|
||||
return Promise.resolve(imageObject);
|
||||
} catch (err) {
|
||||
return Promise.reject(new errors.InternalServerError({
|
||||
code: 'IMAGE_SIZE',
|
||||
err: err,
|
||||
context: imagePath
|
||||
context: imagePath.href
|
||||
}));
|
||||
});
|
||||
}
|
||||
}).catch(function (err) {
|
||||
if (err.statusCode === 404) {
|
||||
return Promise.reject(new errors.NotFoundError({
|
||||
message: 'Image not found.',
|
||||
code: 'IMAGE_SIZE',
|
||||
statusCode: err.statusCode,
|
||||
context: err.url || imagePath.href || imagePath
|
||||
}));
|
||||
} else if (err.code === 'ETIMEDOUT') {
|
||||
return Promise.reject(new errors.InternalServerError({
|
||||
message: 'Request timed out.',
|
||||
code: 'IMAGE_SIZE',
|
||||
statusCode: err.statusCode,
|
||||
context: err.url || imagePath.href || imagePath
|
||||
}));
|
||||
} else {
|
||||
return Promise.reject(new errors.InternalServerError({
|
||||
message: 'Unknown Request error.',
|
||||
code: 'IMAGE_SIZE',
|
||||
statusCode: err.statusCode,
|
||||
context: err.url || imagePath.href || imagePath
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -42,7 +42,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
return localSettingsCache[key];
|
||||
});
|
||||
|
||||
configUtils.set('url', 'http://localhost:82832/');
|
||||
configUtils.set('url', 'http://localhost:65530/');
|
||||
});
|
||||
|
||||
it('returns meta tag string on paginated index page without structured data and schema', function (done) {
|
||||
|
@ -52,9 +52,9 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="description"/);
|
||||
rendered.string.should.not.match(/<meta property="og/);
|
||||
rendered.string.should.not.match(/<script type=\"application\/ld\+json\">/);
|
||||
|
@ -70,28 +70,28 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="referrer" content="no-referrer-when-downgrade" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="website" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/blog-cover.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/blog-cover.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:card" content="summary_large_image" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/blog-cover.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/blog-cover.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Website"/);
|
||||
rendered.string.should.match(/"publisher": {\n "@type": "Organization",\n "name": "Ghost",/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/blog-cover.png"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/blog-cover.png"/);
|
||||
rendered.string.should.match(/"description": "blog description"/);
|
||||
|
||||
done();
|
||||
|
@ -130,34 +130,34 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/about\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="referrer" content="no-referrer-when-downgrade" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="all about our blog" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="website" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="About" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="all about our blog" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/test-image-about.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/test-image-about.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="article:author" content="https:\/\/www.facebook.com\/testuser" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:card" content="summary_large_image" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="About" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="all about our blog" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/test-image-about.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/test-image-about.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Article"/);
|
||||
rendered.string.should.match(/"publisher": {/);
|
||||
rendered.string.should.match(/"@type": "Organization"/);
|
||||
rendered.string.should.match(/"name": "Ghost"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/about\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/about\/"/);
|
||||
rendered.string.should.match(/"sameAs": \[\n "http:\/\/authorwebsite.com",\n "https:\/\/www.facebook.com\/testuser",\n "https:\/\/twitter.com\/testuser"\n \]/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/test-image-about.png"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:82832\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/test-image-about.png"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:65530\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"description": "all about our blog"/);
|
||||
|
||||
done();
|
||||
|
@ -196,34 +196,34 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/about\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="referrer" content="no-referrer-when-downgrade" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="all about our blog" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="website" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Custom Facebook title" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="Custom Facebook description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/test-og-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/test-og-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="article:author" content="https:\/\/www.facebook.com\/testuser" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:card" content="summary_large_image" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Custom Twitter title" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="Custom Twitter description" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/test-twitter-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/test-twitter-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Article"/);
|
||||
rendered.string.should.match(/"publisher": {/);
|
||||
rendered.string.should.match(/"@type": "Organization"/);
|
||||
rendered.string.should.match(/"name": "Ghost"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/about\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/about\/"/);
|
||||
rendered.string.should.match(/"sameAs": \[\n "http:\/\/authorwebsite.com",\n "https:\/\/www.facebook.com\/testuser",\n "https:\/\/twitter.com\/testuser"\n \]/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/test-image-about.png"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:82832\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/test-image-about.png"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:65530\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"description": "all about our blog"/);
|
||||
|
||||
done();
|
||||
|
@ -244,27 +244,27 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="tag meta description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="website" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="tag meta title" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="tag meta description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/tag-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/tag-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:card" content="summary_large_image" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="tag meta title" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="tag meta description" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/tag-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/tag-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Series"/);
|
||||
rendered.string.should.match(/"publisher": {\n "@type": "Organization",\n "name": "Ghost",/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/tag\/tagtitle\/"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/tag-image.png"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/tag\/tagtitle\/"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/tag-image.png"/);
|
||||
rendered.string.should.match(/"name": "tagtitle"/);
|
||||
rendered.string.should.match(/"description": "tag meta description"/);
|
||||
|
||||
|
@ -287,27 +287,27 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="description"/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="website" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="tagtitle - Ghost" \/>/);
|
||||
rendered.string.should.not.match(/<meta property="og:description"/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/tag-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/tag-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:card" content="summary_large_image" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="tagtitle - Ghost" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="twitter:description"/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/tag-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/tag\/tagtitle\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/tag-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Series"/);
|
||||
rendered.string.should.match(/"publisher": {\n "@type": "Organization",\n "name": "Ghost",/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/tag\/tagtitle\/"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/tag-image.png"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/tag\/tagtitle\/"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/tag-image.png"/);
|
||||
rendered.string.should.match(/"name": "tagtitle"/);
|
||||
rendered.string.should.not.match(/"description":/);
|
||||
|
||||
|
@ -352,10 +352,10 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/tag\/tagtitle\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/tag\/tagtitle\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="tag meta description" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta property="og/);
|
||||
rendered.string.should.not.match(/<script type=\"application\/ld\+json\">/);
|
||||
|
||||
|
@ -381,28 +381,28 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/author\/AuthorName\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/author\/AuthorName\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="description"/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="profile" \/>/);
|
||||
rendered.string.should.not.match(/<meta property="og:description"/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/author\/AuthorName\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/author-cover-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/author\/AuthorName\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/author-cover-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="article:author" content="https:\/\/www.facebook.com\/testuser\" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:card" content="summary_large_image" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Author name - Ghost" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="twitter:description"/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/author\/AuthorName\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/author\/AuthorName\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/author-cover-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/author-cover-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Person"/);
|
||||
rendered.string.should.match(/"sameAs": \[\n "http:\/\/authorwebsite.com",\n "https:\/\/www.facebook.com\/testuser",\n "https:\/\/twitter.com\/testuser"\n \]/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/author\/AuthorName\/"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/author-cover-image.png"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/author\/AuthorName\/"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/author-cover-image.png"/);
|
||||
rendered.string.should.match(/"name": "Author name"/);
|
||||
rendered.string.should.not.match(/"description":/);
|
||||
|
||||
|
@ -433,9 +433,9 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/author\/AuthorName\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/author\/AuthorName\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="description" /);
|
||||
rendered.string.should.not.match(/<meta property="og/);
|
||||
rendered.string.should.not.match(/<script type=\"application\/ld\+json\">/);
|
||||
|
@ -452,7 +452,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.9" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
@ -496,15 +496,15 @@ describe('{{ghost_head}} helper', function () {
|
|||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:65530\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="article" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Custom Facebook title" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="Custom Facebook description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(re1);
|
||||
rendered.string.should.match(re2);
|
||||
rendered.string.should.match(/<meta property="article:tag" content="tag1" \/>/);
|
||||
|
@ -513,8 +513,8 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/<meta property="article:author" content="https:\/\/www.facebook.com\/testuser" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Welcome to Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/test-twitter-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/test-twitter-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Article"/);
|
||||
|
@ -524,20 +524,20 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/"author": {/);
|
||||
rendered.string.should.match(/"@type": "Person"/);
|
||||
rendered.string.should.match(/"name": "Author name"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:82832\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:65530\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"sameAs": \[\n "http:\/\/authorwebsite.com",\n "https:\/\/www.facebook.com\/testuser",\n "https:\/\/twitter.com\/testuser"\n \]/);
|
||||
rendered.string.should.not.match(/"description": "Author bio"/);
|
||||
rendered.string.should.match(/"headline": "Welcome to Ghost"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/post\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/post\/"/);
|
||||
rendered.string.should.match(re3);
|
||||
rendered.string.should.match(re4);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.match(/"keywords": "tag1, tag2, tag3"/);
|
||||
rendered.string.should.match(/"description": "blog description"/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
|
||||
post.should.eql(postBk);
|
||||
|
||||
|
@ -583,15 +583,15 @@ describe('{{ghost_head}} helper', function () {
|
|||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:65530\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="article" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Welcome to Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="post custom excerpt" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/test-facebook-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/test-facebook-image.png" \/>/);
|
||||
rendered.string.should.match(re1);
|
||||
rendered.string.should.match(re2);
|
||||
rendered.string.should.match(/<meta property="article:tag" content="tag1" \/>/);
|
||||
|
@ -600,8 +600,8 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/<meta property="article:author" content="https:\/\/www.facebook.com\/testuser" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Custom Twitter title" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="post custom excerpt" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/test-twitter-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/test-twitter-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Article"/);
|
||||
|
@ -611,20 +611,20 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/"author": {/);
|
||||
rendered.string.should.match(/"@type": "Person"/);
|
||||
rendered.string.should.match(/"name": "Author name"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:82832\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:65530\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"sameAs": \[\n "http:\/\/authorwebsite.com",\n "https:\/\/www.facebook.com\/testuser",\n "https:\/\/twitter.com\/testuser"\n \]/);
|
||||
rendered.string.should.not.match(/"description": "Author bio"/);
|
||||
rendered.string.should.match(/"headline": "Welcome to Ghost"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/post\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/post\/"/);
|
||||
rendered.string.should.match(re3);
|
||||
rendered.string.should.match(re4);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.match(/"keywords": "tag1, tag2, tag3"/);
|
||||
rendered.string.should.match(/"description": "post custom excerpt"/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
|
||||
post.should.eql(postBk);
|
||||
|
||||
|
@ -651,17 +651,17 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:65530\/post\/amp\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="article" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Welcome to Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="This is a short post" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Welcome to Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="This is a short post" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Article"/);
|
||||
rendered.string.should.match(/"publisher": {/);
|
||||
|
@ -670,14 +670,14 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/"author": {/);
|
||||
rendered.string.should.match(/"@type": "Person"/);
|
||||
rendered.string.should.match(/"name": "Author name"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/author\/Author\/"/);
|
||||
rendered.string.should.not.match(/"description": "Author bio"/);
|
||||
rendered.string.should.match(/"headline": "Welcome to Ghost"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/post\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/post\/"/);
|
||||
rendered.string.should.match(/"description": "This is a short post"/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
|
||||
post.should.eql(postBk);
|
||||
|
||||
|
@ -722,15 +722,15 @@ describe('{{ghost_head}} helper', function () {
|
|||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.not.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.not.match(/<link rel="amphtml" href="http:\/\/localhost:65530\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="article" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Custom Facebook title" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/test-facebook-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/test-facebook-image.png" \/>/);
|
||||
rendered.string.should.match(re1);
|
||||
rendered.string.should.match(re2);
|
||||
rendered.string.should.match(/<meta property="article:tag" content="tag1" \/>/);
|
||||
|
@ -739,8 +739,8 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/<meta property="article:author" content="https:\/\/www.facebook.com\/testuser" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Custom Twitter title" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/test-twitter-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/test-twitter-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Article"/);
|
||||
|
@ -750,20 +750,20 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/"author": {/);
|
||||
rendered.string.should.match(/"@type": "Person"/);
|
||||
rendered.string.should.match(/"name": "Author name"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:82832\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:65530\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"sameAs": \[\n "http:\/\/authorwebsite.com",\n "https:\/\/www.facebook.com\/testuser",\n "https:\/\/twitter.com\/testuser"\n \]/);
|
||||
rendered.string.should.not.match(/"description": "Author bio"/);
|
||||
rendered.string.should.match(/"headline": "Welcome to Ghost"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/post\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/post\/"/);
|
||||
rendered.string.should.match(re3);
|
||||
rendered.string.should.match(re4);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.match(/"keywords": "tag1, tag2, tag3"/);
|
||||
rendered.string.should.match(/"description": "blog description"/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
|
||||
post.should.eql(postBk);
|
||||
|
||||
|
@ -802,15 +802,15 @@ describe('{{ghost_head}} helper', function () {
|
|||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:65530\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog "test" description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="article" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Welcome to Ghost "test"" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="blog "test" description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="article:author" content="https:\/\/www.facebook.com\/testuser" \/>/);
|
||||
rendered.string.should.match(re1);
|
||||
rendered.string.should.match(re2);
|
||||
|
@ -820,9 +820,9 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/<meta name="twitter:card" content="summary_large_image" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Welcome to Ghost "test"" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="blog "test" description" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/"@type": "Article"/);
|
||||
|
@ -832,20 +832,20 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/"author": {/);
|
||||
rendered.string.should.match(/"@type": "Person"/);
|
||||
rendered.string.should.match(/"name": "Author name"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:82832\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:65530\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"sameAs": \[\n "http:\/\/authorwebsite.com",\n "https:\/\/www.facebook.com\/testuser",\n "https:\/\/twitter.com\/testuser"\n \]/);
|
||||
rendered.string.should.match(/"headline": "Welcome to Ghost "test""/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/post\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/post\/"/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(re3);
|
||||
rendered.string.should.match(re4);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.match(/"keywords": "tag1, tag2, tag3"/);
|
||||
rendered.string.should.match(/"description": "blog "test" description"/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
@ -880,15 +880,15 @@ describe('{{ghost_head}} helper', function () {
|
|||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:65530\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="article" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Welcome to Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:82832\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:image" content="http:\/\/localhost:65530\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta property="article:author" content="https:\/\/www.facebook.com\/testuser" \/>/);
|
||||
rendered.string.should.match(re1);
|
||||
rendered.string.should.match(re2);
|
||||
|
@ -896,8 +896,8 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/<meta name="twitter:card" content="summary_large_image" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Welcome to Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:82832\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:image" content="http:\/\/localhost:65530\/content\/images\/test-image.png" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
|
||||
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
|
@ -907,20 +907,20 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/"author": {/);
|
||||
rendered.string.should.match(/"@type": "Person"/);
|
||||
rendered.string.should.match(/"name": "Author name"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:82832\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"image\": \"http:\/\/localhost:65530\/content\/images\/test-author-image.png\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"sameAs": \[\n "http:\/\/authorwebsite.com",\n "https:\/\/www.facebook.com\/testuser",\n "https:\/\/twitter.com\/testuser"\n \]/);
|
||||
rendered.string.should.match(/"headline": "Welcome to Ghost"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/post\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/post\/"/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(re3);
|
||||
rendered.string.should.match(re4);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:82832\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.match(/"image": "http:\/\/localhost:65530\/content\/images\/test-image.png"/);
|
||||
rendered.string.should.not.match(/"keywords":/);
|
||||
rendered.string.should.match(/"description": "blog description"/);
|
||||
rendered.string.should.match(/"@context": "https:\/\/schema.org"/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
@ -956,14 +956,14 @@ describe('{{ghost_head}} helper', function () {
|
|||
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:65530\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="article" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Welcome to Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="article:author" content="https:\/\/www.facebook.com\/testuser" \/>/);
|
||||
rendered.string.should.not.match(/<meta property="og:image"/);
|
||||
rendered.string.should.match(re1);
|
||||
|
@ -974,7 +974,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/<meta name="twitter:card" content="summary" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:title" content="Welcome to Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:url" content="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:creator" content="@testuser" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="twitter:image"/);
|
||||
rendered.string.should.match(/<script type=\"application\/ld\+json\">/);
|
||||
|
@ -987,16 +987,16 @@ describe('{{ghost_head}} helper', function () {
|
|||
rendered.string.should.match(/"@type": "Person"/);
|
||||
rendered.string.should.match(/"name": "Author name"/);
|
||||
rendered.string.should.not.match(/"image\"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/author\/Author\/"/);
|
||||
rendered.string.should.match(/"sameAs": \[\n "http:\/\/authorwebsite.com",\n "https:\/\/www.facebook.com\/testuser",\n "https:\/\/twitter.com\/testuser"\n \]/);
|
||||
rendered.string.should.match(/"headline": "Welcome to Ghost"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:82832\/post\/"/);
|
||||
rendered.string.should.match(/"url": "http:\/\/localhost:65530\/post\/"/);
|
||||
rendered.string.should.match(re3);
|
||||
rendered.string.should.match(re4);
|
||||
rendered.string.should.match(/"keywords": "tag1, tag2, tag3"/);
|
||||
rendered.string.should.match(/"description": "blog description"/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
@ -1009,13 +1009,13 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/featured\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/featured\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:site_name" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:type" content="website" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:title" content="Ghost" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:82832\/featured\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:url" content="http:\/\/localhost:65530\/featured\/" \/>/);
|
||||
|
||||
rendered.string.should.not.match(/<script type=\"application\/ld\+json\">/);
|
||||
rendered.string.should.not.match(/<meta name="description" /);
|
||||
|
@ -1040,7 +1040,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
should.exist(rendered);
|
||||
rendered.string.should.not.match(/<meta name="description" /);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:65530\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta property="og:description" content="This is a short post" \/>/);
|
||||
rendered.string.should.match(/<meta name="twitter:description" content="This is a short post" \/>/);
|
||||
|
||||
|
@ -1063,9 +1063,9 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/about\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/about\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
@ -1083,11 +1083,11 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/page\/3\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/page\/3\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="prev" href="http:\/\/localhost:82832\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="next" href="http:\/\/localhost:82832\/page\/4\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="prev" href="http:\/\/localhost:65530\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="next" href="http:\/\/localhost:65530\/page\/4\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta property="og/);
|
||||
rendered.string.should.not.match(/<script type=\"application\/ld\+json\">/);
|
||||
|
||||
|
@ -1107,11 +1107,11 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.ico" type="image\/x-icon" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/page\/2\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="prev" href="http:\/\/localhost:82832\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="next" href="http:\/\/localhost:82832\/page\/3\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="prev" href="http:\/\/localhost:65530\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="next" href="http:\/\/localhost:65530\/page\/3\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta property="og/);
|
||||
rendered.string.should.not.match(/<meta name="description" /);
|
||||
rendered.string.should.not.match(/<script type=\"application\/ld\+json\">/);
|
||||
|
@ -1125,7 +1125,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
localSettingsCache.icon = '/content/images/favicon.png';
|
||||
|
||||
configUtils.set({
|
||||
url: 'http://localhost:82832/blog/'
|
||||
url: 'http://localhost:65530/blog/'
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1136,9 +1136,9 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/blog\/favicon.png" type="image\/png" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/blog\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/blog\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/blog\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/blog\/rss\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta name="description" /);
|
||||
|
||||
done();
|
||||
|
@ -1162,7 +1162,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
});
|
||||
|
||||
configUtils.set({
|
||||
url: 'http://localhost:82832/blog/',
|
||||
url: 'http://localhost:65530/blog/',
|
||||
referrerPolicy: 'origin'
|
||||
});
|
||||
});
|
||||
|
@ -1197,7 +1197,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
});
|
||||
|
||||
configUtils.set({
|
||||
url: 'http://localhost:82832/',
|
||||
url: 'http://localhost:65530/',
|
||||
privacy: {
|
||||
useStructuredData: false
|
||||
}
|
||||
|
@ -1229,11 +1229,11 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.png" type="image\/png" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:82832\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/post\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="amphtml" href="http:\/\/localhost:65530\/post\/amp\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="description" content="blog description" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.not.match(/<meta property="og/);
|
||||
rendered.string.should.not.match(/<script type=\"application\/ld\+json\">/);
|
||||
|
||||
|
@ -1257,7 +1257,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
});
|
||||
|
||||
configUtils.set({
|
||||
url: 'http://localhost:82832/'
|
||||
url: 'http://localhost:65530/'
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1268,9 +1268,9 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.png" type="image\/png" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<style>body {background: red;}<\/style>/);
|
||||
|
||||
// No default meta desc in paged context
|
||||
|
@ -1343,9 +1343,9 @@ describe('{{ghost_head}} helper', function () {
|
|||
).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.match(/<link rel="shortcut icon" href="\/favicon.png" type="image\/png" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:82832\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="canonical" href="http:\/\/localhost:65530\/" \/>/);
|
||||
rendered.string.should.match(/<meta name="generator" content="Ghost 0.3" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:82832\/rss\/" \/>/);
|
||||
rendered.string.should.match(/<link rel="alternate" type="application\/rss\+xml" title="Ghost" href="http:\/\/localhost:65530\/rss\/" \/>/);
|
||||
rendered.string.should.not.match(/<style>body {background: red;}<\/style>/);
|
||||
|
||||
done();
|
||||
|
@ -1356,7 +1356,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
describe('with Ajax Helper', function () {
|
||||
before(function () {
|
||||
configUtils.set({
|
||||
url: 'http://localhost:82832/'
|
||||
url: 'http://localhost:65530/'
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1430,7 +1430,7 @@ describe('{{ghost_head}} helper', function () {
|
|||
|
||||
beforeEach(function () {
|
||||
configUtils.set({
|
||||
url: 'http://localhost:82832/'
|
||||
url: 'http://localhost:65530/'
|
||||
});
|
||||
|
||||
sandbox.stub(settingsCache, 'get', function (key) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
Promise = require('bluebird'),
|
||||
rewire = require('rewire'),
|
||||
nock = require('nock'),
|
||||
configUtils = require('../../utils/configUtils'),
|
||||
|
@ -14,7 +13,8 @@ var should = require('should'),
|
|||
describe('Image Size', function () {
|
||||
var sizeOfStub,
|
||||
result,
|
||||
requestMock;
|
||||
requestMock,
|
||||
secondRequestMock;
|
||||
|
||||
beforeEach(function () {
|
||||
sizeOfStub = sandbox.stub();
|
||||
|
@ -23,6 +23,7 @@ describe('Image Size', function () {
|
|||
afterEach(function () {
|
||||
sandbox.restore();
|
||||
configUtils.restore();
|
||||
imageSize = rewire('../../../server/utils/image-size-from-url');
|
||||
});
|
||||
|
||||
it('should have an image size function', function () {
|
||||
|
@ -45,7 +46,7 @@ describe('Image Size', function () {
|
|||
sizeOfStub.returns({width: 50, height: 50, type: 'jpg'});
|
||||
imageSize.__set__('sizeOf', sizeOfStub);
|
||||
|
||||
result = Promise.resolve(imageSize.getImageSizeFromUrl(url)).then(function (res) {
|
||||
result = imageSize.getImageSizeFromUrl(url).then(function (res) {
|
||||
requestMock.isDone().should.be.true();
|
||||
should.exist(res);
|
||||
should.exist(res.width);
|
||||
|
@ -69,13 +70,13 @@ describe('Image Size', function () {
|
|||
requestMock = nock('https://static.wixstatic.com')
|
||||
.get('/media/355241_d31358572a2542c5a44738ddcb59e7ea.jpg_256')
|
||||
.reply(200, {
|
||||
data: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
body: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
});
|
||||
|
||||
sizeOfStub.returns({width: 256, height: 256, type: 'png'});
|
||||
imageSize.__set__('sizeOf', sizeOfStub);
|
||||
|
||||
result = Promise.resolve(imageSize.getImageSizeFromUrl(url)).then(function (res) {
|
||||
result = imageSize.getImageSizeFromUrl(url).then(function (res) {
|
||||
requestMock.isDone().should.be.true();
|
||||
should.exist(res);
|
||||
should.exist(res.width);
|
||||
|
@ -99,13 +100,13 @@ describe('Image Size', function () {
|
|||
requestMock = nock('http://www.gravatar.com')
|
||||
.get('/avatar/ef6dcde5c99bb8f685dd451ccc3e050a?s=250&d=mm&r=x')
|
||||
.reply(200, {
|
||||
data: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
body: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
});
|
||||
|
||||
sizeOfStub.returns({width: 250, height: 250, type: 'jpg'});
|
||||
imageSize.__set__('sizeOf', sizeOfStub);
|
||||
|
||||
result = Promise.resolve(imageSize.getImageSizeFromUrl(url)).then(function (res) {
|
||||
result = imageSize.getImageSizeFromUrl(url).then(function (res) {
|
||||
requestMock.isDone().should.be.true();
|
||||
should.exist(res);
|
||||
should.exist(res.width);
|
||||
|
@ -134,13 +135,13 @@ describe('Image Size', function () {
|
|||
requestMock = nock('http://myblog.com')
|
||||
.get('/content/images/cat.jpg')
|
||||
.reply(200, {
|
||||
data: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
body: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
});
|
||||
|
||||
sizeOfStub.returns({width: 100, height: 100, type: 'jpg'});
|
||||
imageSize.__set__('sizeOf', sizeOfStub);
|
||||
|
||||
result = Promise.resolve(imageSize.getImageSizeFromUrl(url)).then(function (res) {
|
||||
result = imageSize.getImageSizeFromUrl(url).then(function (res) {
|
||||
requestMock.isDone().should.be.true();
|
||||
should.exist(res);
|
||||
should.exist(res.width);
|
||||
|
@ -160,7 +161,7 @@ describe('Image Size', function () {
|
|||
.get('/files/f/feedough/x/11/1540353_20925115.jpg')
|
||||
.reply(404);
|
||||
|
||||
result = Promise.resolve(imageSize.getImageSizeFromUrl(url))
|
||||
result = imageSize.getImageSizeFromUrl(url)
|
||||
.catch(function (err) {
|
||||
requestMock.isDone().should.be.true();
|
||||
should.exist(err);
|
||||
|
@ -168,6 +169,47 @@ describe('Image Size', function () {
|
|||
});
|
||||
});
|
||||
|
||||
it('can handle redirect', function (done) {
|
||||
var url = 'http://noimagehere.com/files/f/feedough/x/11/1540353_20925115.jpg',
|
||||
expectedImageObject =
|
||||
{
|
||||
height: 100,
|
||||
url: 'http://noimagehere.com/files/f/feedough/x/11/1540353_20925115.jpg',
|
||||
width: 100
|
||||
};
|
||||
|
||||
requestMock = nock('http://noimagehere.com')
|
||||
.get('/files/f/feedough/x/11/1540353_20925115.jpg')
|
||||
.reply(301, {
|
||||
body: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
},
|
||||
{
|
||||
location: 'http://someredirectedurl.com/files/f/feedough/x/11/1540353_20925115.jpg'
|
||||
});
|
||||
|
||||
secondRequestMock = nock('http://someredirectedurl.com')
|
||||
.get('/files/f/feedough/x/11/1540353_20925115.jpg')
|
||||
.reply(200, {
|
||||
body: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
});
|
||||
|
||||
sizeOfStub.returns({width: 100, height: 100, type: 'jpg'});
|
||||
imageSize.__set__('sizeOf', sizeOfStub);
|
||||
|
||||
result = imageSize.getImageSizeFromUrl(url).then(function (res) {
|
||||
requestMock.isDone().should.be.true();
|
||||
secondRequestMock.isDone().should.be.true();
|
||||
should.exist(res);
|
||||
should.exist(res.width);
|
||||
res.width.should.be.equal(expectedImageObject.width);
|
||||
should.exist(res.height);
|
||||
res.height.should.be.equal(expectedImageObject.height);
|
||||
should.exist(res.url);
|
||||
res.url.should.be.equal(expectedImageObject.url);
|
||||
done();
|
||||
}).catch(done);
|
||||
});
|
||||
|
||||
it('will timeout', function (done) {
|
||||
var url = 'https://static.wixstatic.com/media/355241_d31358572a2542c5a44738ddcb59e7ea.jpg_256';
|
||||
requestMock = nock('https://static.wixstatic.com')
|
||||
|
@ -176,7 +218,7 @@ describe('Image Size', function () {
|
|||
.reply(408);
|
||||
|
||||
configUtils.set('times:getImageSizeTimeoutInMS', 10);
|
||||
result = Promise.resolve(imageSize.getImageSizeFromUrl(url))
|
||||
result = imageSize.getImageSizeFromUrl(url)
|
||||
.catch(function (err) {
|
||||
requestMock.isDone().should.be.true();
|
||||
should.exist(err);
|
||||
|
@ -190,13 +232,13 @@ describe('Image Size', function () {
|
|||
requestMock = nock('https://static.wixstatic.com')
|
||||
.get('/media/355241_d31358572a2542c5a44738ddcb59e7ea.jpg_256')
|
||||
.reply(200, {
|
||||
data: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
body: '<Buffer 2c be a4 40 f7 87 73 1e 57 2c c1 e4 0d 79 03 95 42 f0 42 2e 41 95 27 c9 5c 35 a7 71 2c 09 5a 57 d3 04 1e 83 03 28 07 96 b0 c8 88 65 07 7a d1 d6 63 50>'
|
||||
});
|
||||
|
||||
sizeOfStub.throws({error: 'image-size could not find dimensions'});
|
||||
imageSize.__set__('sizeOf', sizeOfStub);
|
||||
|
||||
result = Promise.resolve(imageSize.getImageSizeFromUrl(url))
|
||||
result = imageSize.getImageSizeFromUrl(url)
|
||||
.catch(function (err) {
|
||||
requestMock.isDone().should.be.true();
|
||||
should.exist(err);
|
||||
|
@ -211,7 +253,9 @@ describe('Image Size', function () {
|
|||
.get('/images/notapicture.jpg')
|
||||
.replyWithError({message: 'something awful happened', code: 'AWFUL_ERROR'});
|
||||
|
||||
result = Promise.resolve(imageSize.getImageSizeFromUrl(url))
|
||||
configUtils.set('times:getImageSizeTimeoutInMS', 5);
|
||||
|
||||
result = imageSize.getImageSizeFromUrl(url)
|
||||
.catch(function (err) {
|
||||
requestMock.isDone().should.be.true();
|
||||
should.exist(err);
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
"ghost-ignition": "2.8.14",
|
||||
"ghost-storage-base": "0.0.1",
|
||||
"glob": "5.0.15",
|
||||
"got": "7.1.0",
|
||||
"gscan": "1.1.7",
|
||||
"html-to-text": "3.3.0",
|
||||
"image-size": "0.6.1",
|
||||
|
|
102
yarn.lock
102
yarn.lock
|
@ -1036,6 +1036,12 @@ decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
|
|||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
|
||||
decompress-response@^3.2.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3"
|
||||
dependencies:
|
||||
mimic-response "^1.0.0"
|
||||
|
||||
deep-eql@^0.1.3:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
||||
|
@ -1163,6 +1169,10 @@ duplexer2@0.0.2:
|
|||
dependencies:
|
||||
readable-stream "~1.1.9"
|
||||
|
||||
duplexer3@^0.1.4:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
|
||||
|
||||
eachr@~2.0.2:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/eachr/-/eachr-2.0.4.tgz#466f7caa10708f610509e32c807aafe57fc122bf"
|
||||
|
@ -1721,6 +1731,10 @@ get-stdin@^4.0.1:
|
|||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe"
|
||||
|
||||
get-stream@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
|
||||
|
||||
getobject@~0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/getobject/-/getobject-0.1.0.tgz#047a449789fa160d018f5486ed91320b6ec7885c"
|
||||
|
@ -1883,6 +1897,25 @@ glogg@^1.0.0:
|
|||
dependencies:
|
||||
sparkles "^1.0.0"
|
||||
|
||||
got@7.1.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/got/-/got-7.1.0.tgz#05450fd84094e6bbea56f451a43a9c289166385a"
|
||||
dependencies:
|
||||
decompress-response "^3.2.0"
|
||||
duplexer3 "^0.1.4"
|
||||
get-stream "^3.0.0"
|
||||
is-plain-obj "^1.1.0"
|
||||
is-retry-allowed "^1.0.0"
|
||||
is-stream "^1.0.0"
|
||||
isurl "^1.0.0-alpha5"
|
||||
lowercase-keys "^1.0.0"
|
||||
p-cancelable "^0.3.0"
|
||||
p-timeout "^1.1.1"
|
||||
safe-buffer "^5.0.1"
|
||||
timed-out "^4.0.0"
|
||||
url-parse-lax "^1.0.0"
|
||||
url-to-options "^1.0.1"
|
||||
|
||||
graceful-fs@^4.1.0, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
|
||||
version "4.1.11"
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
|
||||
|
@ -2235,6 +2268,16 @@ has-gulplog@^0.1.0:
|
|||
dependencies:
|
||||
sparkles "^1.0.0"
|
||||
|
||||
has-symbol-support-x@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/has-symbol-support-x/-/has-symbol-support-x-1.4.0.tgz#442d89b1d0ac6cf5ff2f7b916ee539869b93a256"
|
||||
|
||||
has-to-string-tag-x@^1.2.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/has-to-string-tag-x/-/has-to-string-tag-x-1.4.0.tgz#49d7bcde85c2409be38ac327e3e119a451657c7b"
|
||||
dependencies:
|
||||
has-symbol-support-x "^1.4.0"
|
||||
|
||||
has-unicode@^2.0.0:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9"
|
||||
|
@ -2535,7 +2578,11 @@ is-number@^2.0.2, is-number@^2.1.0:
|
|||
dependencies:
|
||||
kind-of "^3.0.2"
|
||||
|
||||
is-plain-obj@^1.0.0:
|
||||
is-object@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.1.tgz#8952688c5ec2ffd6b03ecc85e769e02903083470"
|
||||
|
||||
is-plain-obj@^1.0.0, is-plain-obj@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
|
||||
|
||||
|
@ -2551,6 +2598,14 @@ is-property@^1.0.0:
|
|||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84"
|
||||
|
||||
is-retry-allowed@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34"
|
||||
|
||||
is-stream@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||
|
||||
is-svg@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-svg/-/is-svg-2.1.0.tgz#cf61090da0d9efbcab8722deba6f032208dbb0e9"
|
||||
|
@ -2610,6 +2665,13 @@ istanbul@0.4.5:
|
|||
which "^1.1.1"
|
||||
wordwrap "^1.0.0"
|
||||
|
||||
isurl@^1.0.0-alpha5:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67"
|
||||
dependencies:
|
||||
has-to-string-tag-x "^1.2.0"
|
||||
is-object "^1.0.1"
|
||||
|
||||
jade@0.26.3:
|
||||
version "0.26.3"
|
||||
resolved "https://registry.yarnpkg.com/jade/-/jade-0.26.3.tgz#8f10d7977d8d79f2f6ff862a81b0513ccb25686c"
|
||||
|
@ -3229,6 +3291,10 @@ loud-rejection@^1.0.0:
|
|||
currently-unhandled "^0.4.1"
|
||||
signal-exit "^3.0.0"
|
||||
|
||||
lowercase-keys@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306"
|
||||
|
||||
lru-cache@2:
|
||||
version "2.7.3"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952"
|
||||
|
@ -3406,6 +3472,10 @@ mimelib@~0.2.15:
|
|||
addressparser "~0.3.2"
|
||||
encoding "~0.1.7"
|
||||
|
||||
mimic-response@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.0.tgz#df3d3652a73fded6b9b0b24146e6fd052353458e"
|
||||
|
||||
minimatch@0.3:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.3.0.tgz#275d8edaac4f1bb3326472089e7949c8394699dd"
|
||||
|
@ -3847,6 +3917,20 @@ osenv@^0.1.4:
|
|||
os-homedir "^1.0.0"
|
||||
os-tmpdir "^1.0.0"
|
||||
|
||||
p-cancelable@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa"
|
||||
|
||||
p-finally@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
|
||||
|
||||
p-timeout@^1.1.1:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-1.2.0.tgz#9820f99434c5817868b4f34809ee5291660d5b6c"
|
||||
dependencies:
|
||||
p-finally "^1.0.0"
|
||||
|
||||
pako@~0.2.0:
|
||||
version "0.2.9"
|
||||
resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75"
|
||||
|
@ -4238,7 +4322,7 @@ prelude-ls@~1.1.2:
|
|||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
|
||||
|
||||
prepend-http@^1.0.0:
|
||||
prepend-http@^1.0.0, prepend-http@^1.0.1:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
|
||||
|
||||
|
@ -5188,6 +5272,10 @@ time-stamp@^1.0.0:
|
|||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.0.1.tgz#9f4bd23559c9365966f3302dbba2b07c6b99b151"
|
||||
|
||||
timed-out@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f"
|
||||
|
||||
timespan@2.3.x:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/timespan/-/timespan-2.3.0.tgz#4902ce040bd13d845c8f59b27e9d59bad6f39929"
|
||||
|
@ -5368,6 +5456,16 @@ uri-path@^1.0.0:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/uri-path/-/uri-path-1.0.0.tgz#9747f018358933c31de0fccfd82d138e67262e32"
|
||||
|
||||
url-parse-lax@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73"
|
||||
dependencies:
|
||||
prepend-http "^1.0.1"
|
||||
|
||||
url-to-options@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9"
|
||||
|
||||
user-home@^1.0.0, user-home@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190"
|
||||
|
|
Loading…
Reference in a new issue