Ghost/ghost/admin/tests/unit/transforms/twitter-url-user-test.js

24 lines
780 B
JavaScript
Raw Normal View History

2016-11-24 01:50:57 +03:00
import {describe, it} from 'mocha';
import {expect} from 'chai';
2016-11-24 01:50:57 +03:00
import {setupTest} from 'ember-mocha';
describe('Unit: Transform: twitter-url-user', function () {
setupTest();
2016-11-24 01:50:57 +03:00
it('deserializes twitter url', function () {
let transform = this.owner.lookup('transform:twitter-url-user');
2016-11-24 01:50:57 +03:00
let serialized = '@testuser';
let result = transform.deserialize(serialized);
2016-11-24 01:50:57 +03:00
expect(result).to.equal('https://twitter.com/testuser');
});
2016-11-24 01:50:57 +03:00
it('serializes url to twitter username', function () {
let transform = this.owner.lookup('transform:twitter-url-user');
2016-11-24 01:50:57 +03:00
let deserialized = 'https://twitter.com/testuser';
let result = transform.serialize(deserialized);
2016-11-24 01:50:57 +03:00
expect(result).to.equal('@testuser');
});
});