mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
2ea8c3e33b
no issue - Switched acceptance tests to run against canary branch - Corrected actions specs - Corrected authentication spec - Moved test suites our of 'old' folder
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
var should = require('should'),
|
|
supertest = require('supertest'),
|
|
testUtils = require('../../utils'),
|
|
config = require('../../../server/config'),
|
|
localUtils = require('./utils'),
|
|
|
|
ghost = testUtils.startGhost,
|
|
request;
|
|
|
|
describe('Slug API', function () {
|
|
let ghostServer;
|
|
|
|
before(function () {
|
|
return ghost()
|
|
.then(function (_ghostServer) {
|
|
ghostServer = _ghostServer;
|
|
request = supertest.agent(config.get('url'));
|
|
})
|
|
.then(function () {
|
|
return localUtils.doAuth(request);
|
|
});
|
|
});
|
|
|
|
it('Can generate a slug ', function (done) {
|
|
request.get(localUtils.API.getApiQuery('slugs/post/a post title/'))
|
|
.set('Origin', config.get('url'))
|
|
.expect('Content-Type', /json/)
|
|
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
.expect(200)
|
|
.end(function (err, res) {
|
|
if (err) {
|
|
return done(err);
|
|
}
|
|
|
|
should.not.exist(res.headers['x-cache-invalidate']);
|
|
var jsonResponse = res.body;
|
|
should.exist(jsonResponse);
|
|
should.exist(jsonResponse.slugs);
|
|
jsonResponse.slugs.should.have.length(1);
|
|
localUtils.API.checkResponse(jsonResponse.slugs[0], 'slug');
|
|
jsonResponse.slugs[0].slug.should.equal('a-post-title');
|
|
|
|
done();
|
|
});
|
|
});
|
|
});
|