mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 00:11:49 +03:00
d4f2280a68
no issue - Ghost-Admin is our primary API client, we should keep it in sync with the canary API branch to dog food our API changes
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import Pretender from 'pretender';
|
|
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('/ghost/api/canary/admin/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');
|
|
});
|
|
});
|
|
});
|