2016-03-29 11:40:44 +03:00
|
|
|
/* jshint expr:true */
|
|
|
|
import { expect } from 'chai';
|
|
|
|
import { describeModule, it } from 'ember-mocha';
|
2016-06-30 13:21:47 +03:00
|
|
|
import {A as emberA} from 'ember-array/utils';
|
2016-05-24 15:06:59 +03:00
|
|
|
import SlackIntegration from 'ghost-admin/models/slack-integration';
|
2016-03-29 11:40:44 +03:00
|
|
|
|
|
|
|
describeModule(
|
|
|
|
'transform:slack-settings',
|
|
|
|
'Unit: Transform: slack-settings',
|
2016-06-11 19:52:36 +03:00
|
|
|
{},
|
2016-03-29 11:40:44 +03:00
|
|
|
function() {
|
|
|
|
it('deserializes settings json', function () {
|
|
|
|
let transform = this.subject();
|
|
|
|
let serialized = '[{"url":"http://myblog.com/blogpost1"}]';
|
|
|
|
let result = transform.deserialize(serialized);
|
|
|
|
|
|
|
|
expect(result.length).to.equal(1);
|
|
|
|
expect(result[0]).to.be.instanceof(SlackIntegration);
|
|
|
|
expect(result[0].get('url')).to.equal('http://myblog.com/blogpost1');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('serializes array of Slack settings', function () {
|
|
|
|
let transform = this.subject();
|
|
|
|
let deserialized = emberA([
|
|
|
|
SlackIntegration.create({url: 'http://myblog.com/blogpost1'})
|
|
|
|
]);
|
|
|
|
let result = transform.serialize(deserialized);
|
|
|
|
|
|
|
|
expect(result).to.equal('[{"url":"http://myblog.com/blogpost1"}]');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|