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

24 lines
793 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: facebook-url-user', function () {
setupTest();
2016-11-24 01:50:57 +03:00
it('deserializes facebook url', function () {
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-11-24 01:50:57 +03:00
expect(result).to.equal('https://www.facebook.com/testuser');
});
2016-11-24 01:50:57 +03:00
it('serializes url to facebook username', function () {
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-11-24 01:50:57 +03:00
expect(result).to.equal('testuser');
});
});