mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 10:53:34 +03:00
27dadcf1c4
refs https://github.com/TryGhost/Team/issues/221 - we're getting ready for the 4.0 API version so we should be using canary to fully test the changes - changed from `v3` to `canary` in `utils/ghost-paths.js` - updated mirage and tests to use `ghostPaths` util so we only need to change the version in one place in the future
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import Pretender from 'pretender';
|
|
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
|
import {describe, it} from 'mocha';
|
|
import {expect} from 'chai';
|
|
import {setupTest} from 'ember-mocha';
|
|
|
|
describe('Unit: Serializer: notification', function () {
|
|
setupTest();
|
|
|
|
let server;
|
|
|
|
beforeEach(function () {
|
|
server = new Pretender();
|
|
});
|
|
|
|
afterEach(function () {
|
|
server.shutdown();
|
|
});
|
|
|
|
it('converts location->key when deserializing', function () {
|
|
server.get(`${ghostPaths().apiRoot}/notifications`, function () {
|
|
let response = {
|
|
notifications: [{
|
|
id: 1,
|
|
dismissible: false,
|
|
status: 'alert',
|
|
type: 'info',
|
|
location: 'test.foo',
|
|
message: 'This is a test'
|
|
}]
|
|
};
|
|
|
|
return [200, {'Content-Type': 'application/json'}, JSON.stringify(response)];
|
|
});
|
|
|
|
let store = this.owner.lookup('service:store');
|
|
|
|
return store.findAll('notification').then((notifications) => {
|
|
expect(notifications.get('length')).to.equal(1);
|
|
expect(notifications.get('firstObject.key')).to.equal('test.foo');
|
|
});
|
|
});
|
|
});
|