2016-11-24 01:50:57 +03:00
|
|
|
import {describe, it} from 'mocha';
|
2017-05-29 21:50:03 +03:00
|
|
|
import {expect} from 'chai';
|
2016-11-24 01:50:57 +03:00
|
|
|
import {setupTest} from 'ember-mocha';
|
2016-03-03 11:52:27 +03:00
|
|
|
|
2018-01-05 18:38:23 +03:00
|
|
|
describe('Unit: Transform: twitter-url-user', function () {
|
2019-05-13 15:43:53 +03:00
|
|
|
setupTest();
|
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
it('deserializes twitter url', function () {
|
2019-05-13 15:43:53 +03:00
|
|
|
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-03-03 11:52:27 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
expect(result).to.equal('https://twitter.com/testuser');
|
|
|
|
});
|
2016-03-03 11:52:27 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
it('serializes url to twitter username', function () {
|
2019-05-13 15:43:53 +03:00
|
|
|
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-03-03 11:52:27 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
expect(result).to.equal('@testuser');
|
|
|
|
});
|
|
|
|
});
|