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-05-16 21:16:40 +03:00
|
|
|
|
2018-01-05 18:38:23 +03:00
|
|
|
describe('Unit: Transform: facebook-url-user', function () {
|
2019-05-13 15:43:53 +03:00
|
|
|
setupTest();
|
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
it('deserializes facebook url', function () {
|
2019-05-13 15:43:53 +03:00
|
|
|
let transform = this.owner.lookup('transform:facebook-url-user');
|
2016-11-24 01:50:57 +03:00
|
|
|
let serialized = 'testuser';
|
|
|
|
let result = transform.deserialize(serialized);
|
2016-05-16 21:16:40 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
expect(result).to.equal('https://www.facebook.com/testuser');
|
|
|
|
});
|
2016-05-16 21:16:40 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
it('serializes url to facebook username', function () {
|
2019-05-13 15:43:53 +03:00
|
|
|
let transform = this.owner.lookup('transform:facebook-url-user');
|
2016-11-24 01:50:57 +03:00
|
|
|
let deserialized = 'https://www.facebook.com/testuser';
|
|
|
|
let result = transform.serialize(deserialized);
|
2016-05-16 21:16:40 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
expect(result).to.equal('testuser');
|
|
|
|
});
|
|
|
|
});
|