application/__tests__/components/common/simple-editor/link-strategy-test.js
jest.unmock('./../../../../components/common/simple-editor/strategy/link');
jest.unmock('./../../../../components/common/simple-editor/util');
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import Immutable from 'immutable';
import sinon from 'sinon';
import AltTestingUtils from 'alt-utils/lib/AltTestingUtils';
import linkStrategy from './../../../../components/common/simple-editor/strategy/link';
describe('Link strategy', () => {
beforeEach(() => {
jasmine.clock().uninstall();
});
it('parses a link', (done) => {
const callback = (index, offset) => {
expect(index).toEqual(10);
expect(offset).toEqual(31);
done();
};
const block = {
getText: () => {
return 'this is a http://statenews.com/ test';
}
};
linkStrategy(block, callback);
});
it('parses a complex link', (done) => {
const callback = (index, offset) => {
expect(index).toEqual(105);
expect(offset).toEqual(238);
done();
};
const block = {
getText: () => {
return 'I am a complex graf with colons: and https and // anmd other sundery stuff I also have this link in here https://www.google.com/search?q=french+toast&biw=1481&bih=963&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiut7KJkpvNAhVDRVIKHVPuAMoQ_AUIBigB';
}
};
linkStrategy(block, callback);
});
});