Ghost/ghost/admin/tests/unit/transforms/slack-settings-test.js
Kevin Ansfield cb59388c5b 💄🐷 sort-imports eslint rule (#712)
no issue

- adds `eslint-plugin-sort-imports-es6-autofix` dependency
  - implements ESLint's base `sort-imports` rule but has a distinction in that `import {foo} from 'bar';` is considered `multiple` rather than `single`
  - fixes ESLint's autofix behaviour so `eslint --fix` will actually fix the sort order
- updates all unordered import rules by using `eslint --fix`

With the increased number of `import` statements since Ember+ecosystem started moving towards es6 modules I've found it frustrating at times trying to search through randomly ordered import statements. Recently I've been sorting imports manually when I've added new code or touched old code so I thought I'd add an ESLint rule to codify it.
2017-05-29 20:50:03 +02:00

30 lines
1.1 KiB
JavaScript

/* jshint expr:true */
import SlackIntegration from 'ghost-admin/models/slack-integration';
import {describe, it} from 'mocha';
import {A as emberA} from 'ember-array/utils';
import {expect} from 'chai';
import {setupTest} from 'ember-mocha';
describe('Unit: Transform: slack-settings', function() {
setupTest('transform:slack-settings', {});
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"}]');
});
});