0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Fixed api vs frontend test suites

refs 3c7a8dead4

- The tests needed adjustments with the native boot mechanism.
- The number of returned posts changed in the test resutls because duing native boot we also insert fixtures which add to the number of initial posts
- The vhost regression suite is still failing and I had no strength to figure out why. The redirect it fails with makes no sense, the clue here is that the test doesn't fail when running in isolation, so probably has to do with some leftover overrides from the previous test cases.
This commit is contained in:
Naz 2021-12-02 19:58:14 +04:00 committed by naz
parent 9e53f36c42
commit 9dc096cb15
4 changed files with 33 additions and 33 deletions

View file

@ -1399,7 +1399,7 @@ describe('Integration - Web - Site canary', function () {
response.statusCode.should.eql(200);
response.template.should.eql('index');
$('.post-card').length.should.equal(4);
$('.post-card').length.should.equal(10);
});
});
@ -1418,7 +1418,7 @@ describe('Integration - Web - Site canary', function () {
response.statusCode.should.eql(200);
response.template.should.eql('index');
$('.post-card').length.should.equal(4);
$('.post-card').length.should.equal(10);
});
});

View file

@ -361,7 +361,7 @@ describe('Integration - Web - Site v2', function () {
describe('extended routes.yaml: collections', function () {
describe('2 collections', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/': {templates: ['home']}
},
@ -486,7 +486,7 @@ describe('Integration - Web - Site v2', function () {
describe('no collections', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/something/': {templates: ['something']}
},
@ -531,7 +531,7 @@ describe('Integration - Web - Site v2', function () {
describe('static permalink route', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -631,7 +631,7 @@ describe('Integration - Web - Site v2', function () {
describe('primary author permalink', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -710,7 +710,7 @@ describe('Integration - Web - Site v2', function () {
describe('primary tag permalink', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -804,7 +804,7 @@ describe('Integration - Web - Site v2', function () {
describe('collection/routes with data key', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/my-page/': {
data: {
@ -969,7 +969,7 @@ describe('Integration - Web - Site v2', function () {
describe('extended routes.yaml: templates', function () {
describe('default template, no template', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -1035,7 +1035,7 @@ describe('Integration - Web - Site v2', function () {
describe('two templates', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -1083,7 +1083,7 @@ describe('Integration - Web - Site v2', function () {
describe('home.hbs priority', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -1158,7 +1158,7 @@ describe('Integration - Web - Site v2', function () {
before(async function () {
localUtils.defaultMocks(sinon, {theme: 'test-theme-channels'});
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/channel1/': {
controller: 'channel',
@ -1402,7 +1402,7 @@ describe('Integration - Web - Site v2', function () {
response.statusCode.should.eql(200);
response.template.should.eql('index');
$('.post-card').length.should.equal(4);
$('.post-card').length.should.equal(10);
});
});
@ -1421,7 +1421,7 @@ describe('Integration - Web - Site v2', function () {
response.statusCode.should.eql(200);
response.template.should.eql('index');
$('.post-card').length.should.equal(4);
$('.post-card').length.should.equal(10);
});
});
@ -1487,7 +1487,7 @@ describe('Integration - Web - Site v2', function () {
describe('extended routes.yaml (5): rss override', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/podcast/rss/': {
templates: ['podcast/rss'],

View file

@ -361,7 +361,7 @@ describe('Integration - Web - Site v3', function () {
describe('extended routes.yaml: collections', function () {
describe('2 collections', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/': {
templates: ['home']
@ -488,7 +488,7 @@ describe('Integration - Web - Site v3', function () {
describe('no collections', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/something/': {templates: ['something']}
},
@ -533,7 +533,7 @@ describe('Integration - Web - Site v3', function () {
describe('static permalink route', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -633,7 +633,7 @@ describe('Integration - Web - Site v3', function () {
describe('primary author permalink', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -712,7 +712,7 @@ describe('Integration - Web - Site v3', function () {
describe('primary tag permalink', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -805,7 +805,7 @@ describe('Integration - Web - Site v3', function () {
describe('collection/routes with data key', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/my-page/': {
data: {
@ -970,7 +970,7 @@ describe('Integration - Web - Site v3', function () {
describe('extended routes.yaml: templates', function () {
describe('default template, no template', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -1036,7 +1036,7 @@ describe('Integration - Web - Site v3', function () {
describe('two templates', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -1084,7 +1084,7 @@ describe('Integration - Web - Site v3', function () {
describe('home.hbs priority', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {},
collections: {
@ -1159,7 +1159,7 @@ describe('Integration - Web - Site v3', function () {
before(async function () {
localUtils.defaultMocks(sinon, {theme: 'test-theme-channels'});
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/channel1/': {
controller: 'channel',
@ -1404,7 +1404,7 @@ describe('Integration - Web - Site v3', function () {
response.statusCode.should.eql(200);
response.template.should.eql('index');
$('.post-card').length.should.equal(4);
$('.post-card').length.should.equal(10);
});
});
@ -1423,7 +1423,7 @@ describe('Integration - Web - Site v3', function () {
response.statusCode.should.eql(200);
response.template.should.eql('index');
$('.post-card').length.should.equal(4);
$('.post-card').length.should.equal(10);
});
});
@ -1489,7 +1489,7 @@ describe('Integration - Web - Site v3', function () {
describe('extended routes.yaml (5): rss override', function () {
before(async function () {
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').get(() => () => ({
sinon.stub(routeSettingsService, 'loadRouteSettings').get(() => () => ({
routes: {
'/about/': 'about',
'/podcast/rss/': {

View file

@ -30,7 +30,7 @@ describe('Integration - Web - vhosts', function () {
configUtils.set('url', 'http://example.com');
configUtils.set('admin:url', null);
app = await localUtils.initGhost();
app = await localUtils.initGhost({backend: true});
});
before(function () {
@ -139,10 +139,10 @@ describe('Integration - Web - vhosts', function () {
configUtils.set('url', 'http://example.com');
configUtils.set('admin:url', 'https://admin.example.com');
app = await localUtils.initGhost({backend: true});
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
app = await localUtils.initGhost();
});
before(function () {
@ -297,7 +297,7 @@ describe('Integration - Web - vhosts', function () {
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
app = await localUtils.initGhost();
app = await localUtils.initGhost({backend: true});
});
before(function () {
@ -337,7 +337,7 @@ describe('Integration - Web - vhosts', function () {
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
app = await localUtils.initGhost();
app = await localUtils.initGhost({backend: true});
});
before(function () {