0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Fixed Redirects API regression tests

no-issue

These tests were not testing the functionality correctly, but trying to
test it based on metadata, which can become out of date. This tests the
expected responses and is resilient for future changes to fixtures.
This commit is contained in:
Fabien O'Carroll 2020-06-15 18:19:26 +02:00
parent c5b8dab523
commit 8a74cd9e11
3 changed files with 6 additions and 15 deletions

View file

@ -45,8 +45,7 @@ describe('Redirects API', function () {
res.headers['content-type'].should.eql('application/json; charset=utf-8');
should.not.exist(res.headers['x-cache-invalidate']);
// API returns an empty file with the correct file structure (empty [])
res.headers['content-length'].should.eql('2');
should.deepEqual(res.body, []);
});
});
@ -60,10 +59,8 @@ describe('Redirects API', function () {
.then((res) => {
res.headers['content-disposition'].should.eql('Attachment; filename="redirects.json"');
res.headers['content-type'].should.eql('application/json; charset=utf-8');
res.headers['content-length'].should.eql('756');
res.body.should.not.be.empty();
res.body.length.should.equal(13);
should.deepEqual(res.body, require('../../../../utils/fixtures/data/redirects.json'));
});
});
});

View file

@ -45,8 +45,7 @@ describe('Redirects API', function () {
res.headers['content-type'].should.eql('application/json; charset=utf-8');
should.not.exist(res.headers['x-cache-invalidate']);
// API returns an empty file with the correct file structure (empty [])
res.headers['content-length'].should.eql('2');
should.deepEqual(res.body, []);
});
});
@ -60,10 +59,8 @@ describe('Redirects API', function () {
.then((res) => {
res.headers['content-disposition'].should.eql('Attachment; filename="redirects.json"');
res.headers['content-type'].should.eql('application/json; charset=utf-8');
res.headers['content-length'].should.eql('756');
res.body.should.not.be.empty();
res.body.length.should.equal(13);
should.deepEqual(res.body, require('../../../../utils/fixtures/data/redirects.json'));
});
});
});

View file

@ -45,8 +45,7 @@ describe('Redirects API', function () {
res.headers['content-type'].should.eql('application/json; charset=utf-8');
should.not.exist(res.headers['x-cache-invalidate']);
// API returns an empty file with the correct file structure (empty [])
res.headers['content-length'].should.eql('2');
should.deepEqual(res.body, []);
});
});
@ -60,10 +59,8 @@ describe('Redirects API', function () {
.then((res) => {
res.headers['content-disposition'].should.eql('Attachment; filename="redirects.json"');
res.headers['content-type'].should.eql('application/json; charset=utf-8');
res.headers['content-length'].should.eql('756');
res.body.should.not.be.empty();
res.body.length.should.equal(13);
should.deepEqual(res.body, require('../../../../utils/fixtures/data/redirects.json'));
});
});
});