-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Added support for v4 API in Content API SDK
refs TryGhost/Product#514 - Ghost 4.0 ships with a new set of APIs and v4 is a stable cut from the canary API
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Switch these lines once there are useful utils | ||
// const testUtils = require('./utils'); | ||
|
||
const should = require('should'); | ||
|
||
const {getInstance} = require('../utils/ghost-server-mock'); | ||
const GhostContentApi = require('../../cjs/content-api'); | ||
|
||
describe('GhostContentApi v4', function () { | ||
let server; | ||
const config = { | ||
version: 'v4', | ||
key: '0123456789abcdef0123456789' | ||
}; | ||
|
||
before(function (done) { | ||
server = getInstance(config, (serverURL) => { | ||
config.url = serverURL; | ||
done(); | ||
}); | ||
}); | ||
|
||
after(function () { | ||
server.close(); | ||
}); | ||
|
||
it('works', function (done) { | ||
const api = new GhostContentApi(config); | ||
|
||
server.once('url', ({pathname}) => { | ||
should.equal(pathname, '/ghost/api/v4/content/posts/'); | ||
done(); | ||
}); | ||
|
||
api.posts.browse(); | ||
}); | ||
}); |