Skip to content

Commit 1e8657c

Browse files
committed
test(ideone): Added unit test for Ideone contructor
1 parent 28298c1 commit 1e8657c

4 files changed

Lines changed: 299 additions & 7 deletions

File tree

test/bundle.test.js

Lines changed: 178 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,20 @@ function getDimensions(options) {
232232
}
233233
}
234234

235+
/**
236+
* Returns a cloned object
237+
* @param {object} obj
238+
* @return {object} cloned object
239+
*/
240+
function cloneObject(obj) {
241+
if (obj === null || (typeof obj === 'undefined' ? 'undefined' : babelHelpers_typeof(obj)) !== 'object') return obj;
242+
var temp = obj.constructor(); // give temp the original obj's constructor
243+
for (var key in obj) {
244+
temp[key] = cloneObject(obj[key]);
245+
}
246+
return temp;
247+
}
248+
235249
function urlRegex() {
236250
return (/((href|src)=["']|)(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])|(?:https?:\/\/)?(?:(?:0rz\.tw)|(?:1link\.in)|(?:1url\.com)|(?:2\.gp)|(?:2big\.at)|(?:2tu\.us)|(?:3\.ly)|(?:307\.to)|(?:4ms\.me)|(?:4sq\.com)|(?:4url\.cc)|(?:6url\.com)|(?:7\.ly)|(?:a\.gg)|(?:a\.nf)|(?:aa\.cx)|(?:abcurl\.net)|(?:ad\.vu)|(?:adf\.ly)|(?:adjix\.com)|(?:afx\.cc)|(?:all\.fuseurl.com)|(?:alturl\.com)|(?:amzn\.to)|(?:ar\.gy)|(?:arst\.ch)|(?:atu\.ca)|(?:azc\.cc)|(?:b23\.ru)|(?:b2l\.me)|(?:bacn\.me)|(?:bcool\.bz)|(?:binged\.it)|(?:bit\.ly)|(?:buff\.ly)|(?:bizj\.us)|(?:bloat\.me)|(?:bravo\.ly)|(?:bsa\.ly)|(?:budurl\.com)|(?:canurl\.com)|(?:chilp\.it)|(?:chzb\.gr)|(?:cl\.lk)|(?:cl\.ly)|(?:clck\.ru)|(?:cli\.gs)|(?:cliccami\.info)|(?:clickthru\.ca)|(?:clop\.in)|(?:conta\.cc)|(?:cort\.as)|(?:cot\.ag)|(?:crks\.me)|(?:ctvr\.us)|(?:cutt\.us)|(?:dai\.ly)|(?:decenturl\.com)|(?:dfl8\.me)|(?:digbig\.com)|(?:digg\.com)|(?:disq\.us)|(?:dld\.bz)|(?:dlvr\.it)|(?:do\.my)|(?:doiop\.com)|(?:dopen\.us)|(?:easyuri\.com)|(?:easyurl\.net)|(?:eepurl\.com)|(?:eweri\.com)|(?:fa\.by)|(?:fav\.me)|(?:fb\.me)|(?:fbshare\.me)|(?:ff\.im)|(?:fff\.to)|(?:fire\.to)|(?:firsturl\.de)|(?:firsturl\.net)|(?:flic\.kr)|(?:flq\.us)|(?:fly2\.ws)|(?:fon\.gs)|(?:freak\.to)|(?:fuseurl\.com)|(?:fuzzy\.to)|(?:fwd4\.me)|(?:fwib\.net)|(?:g\.ro.lt)|(?:gizmo\.do)|(?:gl\.am)|(?:go\.9nl.com)|(?:go\.ign.com)|(?:go\.usa.gov)|(?:goo\.gl)|(?:goshrink\.com)|(?:gurl\.es)|(?:hex\.io)|(?:hiderefer\.com)|(?:hmm\.ph)|(?:href\.in)|(?:hsblinks\.com)|(?:htxt\.it)|(?:huff\.to)|(?:hulu\.com)|(?:hurl\.me)|(?:hurl\.ws)|(?:icanhaz\.com)|(?:idek\.net)|(?:ilix\.in)|(?:is\.gd)|(?:its\.my)|(?:ix\.lt)|(?:j\.mp)|(?:jijr\.com)|(?:kl\.am)|(?:klck\.me)|(?:korta\.nu)|(?:krunchd\.com)|(?:l9k\.net)|(?:lat\.ms)|(?:liip\.to)|(?:liltext\.com)|(?:linkbee\.com)|(?:linkbun\.ch)|(?:liurl\.cn)|(?:ln-s\.net)|(?:ln-s\.ru)|(?:lnk\.gd)|(?:lnk\.ms)|(?:lnkd\.in)|(?:lnkurl\.com)|(?:lru\.jp)|(?:lt\.tl)|(?:lurl\.no)|(?:macte\.ch)|(?:mash\.to)|(?:merky\.de)|(?:migre\.me)|(?:miniurl\.com)|(?:minurl\.fr)|(?:mke\.me)|(?:moby\.to)|(?:moourl\.com)|(?:mrte\.ch)|(?:myloc\.me)|(?:myurl\.in)|(?:n\.pr)|(?:nbc\.co)|(?:nblo\.gs)|(?:nn\.nf)|(?:not\.my)|(?:notlong\.com)|(?:nsfw\.in)|(?:nutshellurl\.com)|(?:nxy\.in)|(?:nyti\.ms)|(?:o-x\.fr)|(?:oc1\.us)|(?:om\.ly)|(?:omf\.gd)|(?:omoikane\.net)|(?:on\.cnn.com)|(?:on\.mktw.net)|(?:onforb\.es)|(?:orz\.se)|(?:ow\.ly)|(?:ping\.fm)|(?:pli\.gs)|(?:pnt\.me)|(?:politi\.co)|(?:post\.ly)|(?:pp\.gg)|(?:profile\.to)|(?:ptiturl\.com)|(?:pub\.vitrue.com)|(?:qlnk\.net)|(?:qte\.me)|(?:qu\.tc)|(?:qy\.fi)|(?:r\.im)|(?:rb6\.me)|(?:read\.bi)|(?:readthis\.ca)|(?:reallytinyurl\.com)|(?:redir\.ec)|(?:redirects\.ca)|(?:redirx\.com)|(?:retwt\.me)|(?:ri\.ms)|(?:rickroll\.it)|(?:riz\.gd)|(?:rt\.nu)|(?:ru\.ly)|(?:rubyurl\.com)|(?:rurl\.org)|(?:rww\.tw)|(?:s4c\.in)|(?:s7y\.us)|(?:safe\.mn)|(?:sameurl\.com)|(?:sdut\.us)|(?:shar\.es)|(?:shink\.de)|(?:shorl\.com)|(?:short\.ie)|(?:short\.to)|(?:shortlinks\.co.uk)|(?:shorturl\.com)|(?:shout\.to)|(?:show\.my)|(?:shrinkify\.com)|(?:shrinkr\.com)|(?:shrt\.fr)|(?:shrt\.st)|(?:shrten\.com)|(?:shrunkin\.com)|(?:simurl\.com)|(?:slate\.me)|(?:smallr\.com)|(?:smsh\.me)|(?:smurl\.name)|(?:sn\.im)|(?:snipr\.com)|(?:snipurl\.com)|(?:snurl\.com)|(?:sp2\.ro)|(?:spedr\.com)|(?:srnk\.net)|(?:srs\.li)|(?:starturl\.com)|(?:su\.pr)|(?:surl\.co.uk)|(?:surl\.hu)|(?:t\.cn)|(?:t\.co)|(?:t\.lh.com)|(?:ta\.gd)|(?:tbd\.ly)|(?:tcrn\.ch)|(?:tgr\.me)|(?:tgr\.ph)|(?:tighturl\.com)|(?:tiniuri\.com)|(?:tiny\.cc)|(?:tiny\.ly)|(?:tiny\.pl)|(?:tinylink\.in)|(?:tinyuri\.ca)|(?:tinyurl\.com)|(?:tl\.gd)|(?:tmi\.me)|(?:tnij\.org)|(?:tnw\.to)|(?:tny\.com)|(?:to\.ly)|(?:togoto\.us)|(?:totc\.us)|(?:toysr\.us)|(?:tpm\.ly)|(?:tr\.im)|(?:tra\.kz)|(?:trunc\.it)|(?:twhub\.com)|(?:twirl\.at)|(?:twitclicks\.com)|(?:twitterurl\.net)|(?:twitterurl\.org)|(?:twiturl\.de)|(?:twurl\.cc)|(?:twurl\.nl)|(?:u\.mavrev.com)|(?:u\.nu)|(?:u76\.org)|(?:ub0\.cc)|(?:ulu\.lu)|(?:updating\.me)|(?:ur1\.ca)|(?:url\.az)|(?:url\.co.uk)|(?:url\.ie)|(?:url360\.me)|(?:url4\.eu)|(?:urlborg\.com)|(?:urlbrief\.com)|(?:urlcover\.com)|(?:urlcut\.com)|(?:urlenco\.de)|(?:urli\.nl)|(?:urls\.im)|(?:urlshorteningservicefortwitter\.com)|(?:urlx\.ie)|(?:urlzen\.com)|(?:usat\.ly)|(?:use\.my)|(?:vb\.ly)|(?:vgn\.am)|(?:vl\.am)|(?:vm\.lc)|(?:w55\.de)|(?:wapo\.st)|(?:wapurl\.co.uk)|(?:wipi\.es)|(?:wp\.me)|(?:x\.vu)|(?:xr\.com)|(?:xrl\.in)|(?:xrl\.us)|(?:xurl\.es)|(?:xurl\.jp)|(?:y\.ahoo.it)|(?:yatuc\.com)|(?:ye\.pe)|(?:yep\.it)|(?:yfrog\.com)|(?:yhoo\.it)|(?:yiyd\.com)|(?:youtu\.be)|(?:yuarel\.com)|(?:z0p\.de)|(?:zi\.ma)|(?:zi\.mu)|(?:zipmyurl\.com)|(?:zud\.me)|(?:zurl\.ws)|(?:zz\.gd)|(?:zzang\.kr)|(?:\.ws)|(?:\.ws)|(?:\.ws)|(?:\.ws)|(?:\.ws)|(?:\.ws)|(?:\.ws)|(?:\.ws)|(?:\.ws)|(?:\.ws)|(?:\.ws))\/[a-z0-9]*/gi
237251
);
@@ -818,8 +832,6 @@ describe('Class Plunker => unit test', function () {
818832
output = _plunker$process2[0];
819833
embeds = _plunker$process2[1];
820834

821-
console.log(embeds);
822-
823835
expect$4(output).to.be.a('string');
824836
expect$4(embeds).to.be.a('array');
825837

@@ -868,10 +880,173 @@ describe('Class Codepen => unit test', function () {
868880
output = _codepen$process2[0];
869881
embeds = _codepen$process2[1];
870882

871-
console.log(embeds);
872883
expect$5(output).to.be.a('string');
873884
expect$5(embeds).to.be.a('array');
874885

875886
expect$5(embeds[0].text.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal('<div class="ejs-embed ejs-codepen"><iframe scrolling="no" height="500" src="http://codepen.io/enxaneta/embed/meYEzO/?height=500"></iframe></div>');
876887
});
888+
});
889+
890+
var Ideone = function (_Base) {
891+
babelHelpers_inherits(Ideone, _Base);
892+
893+
function Ideone(input, output, options, embeds) {
894+
babelHelpers_classCallCheck(this, Ideone);
895+
896+
var _this = babelHelpers_possibleConstructorReturn(this, Object.getPrototypeOf(Ideone).call(this, input, output, options, embeds));
897+
898+
_this.regex = /ideone.com\/[a-zA-Z0-9]{6}/gi;
899+
_this.service = 'ideone';
900+
return _this;
901+
}
902+
903+
babelHelpers_createClass(Ideone, [{
904+
key: 'template',
905+
value: function template(match) {
906+
return ejs.template.ideone(match, this.options) || '<div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/' + match.split('/')[1] + '" frameborder="0" height="' + this.options.codeEmbedHeight + '"></iframe></div>';
907+
}
908+
}]);
909+
return Ideone;
910+
}(Base);
911+
912+
var expect$6 = chai.expect;
913+
914+
describe('Class Ideone => unit test', function () {
915+
describe('test with single matching', function () {
916+
917+
describe('normal embedding', function () {
918+
919+
var output = undefined;
920+
var embeds = [];
921+
var input = output = 'Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?';
922+
var ideone = new Ideone(input, output, options, embeds);
923+
924+
var _ideone$process = ideone.process();
925+
926+
var _ideone$process2 = babelHelpers_slicedToArray(_ideone$process, 2);
927+
928+
output = _ideone$process2[0];
929+
embeds = _ideone$process2[1];
930+
931+
it('should return a valid plunked embedding url', function () {
932+
933+
expect$6(output).to.be.a('string');
934+
expect$6(embeds).to.be.a('array');
935+
936+
expect$6(embeds[0].text.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal('<div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/HH8rmZ" frameborder="0" height="500"></iframe></div>');
937+
});
938+
});
939+
940+
describe('inline embedding', function () {
941+
it('should return correct result for inline embedding with url embed enabled', function () {
942+
var output = undefined;
943+
var embeds = [];
944+
var opts = cloneObject(options);
945+
opts.inlineEmbed = 'all';
946+
947+
var input = 'Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?';
948+
output = new Url(input, opts).process();
949+
var ideone = new Ideone(input, output, opts, embeds);
950+
951+
var _ideone$process3 = ideone.process();
952+
953+
var _ideone$process4 = babelHelpers_slicedToArray(_ideone$process3, 2);
954+
955+
output = _ideone$process4[0];
956+
embeds = _ideone$process4[1];
957+
958+
expect$6(embeds).to.be.empty;
959+
expect$6(output.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal('Sunt castores desiderium <a href="http://ideone.com/HH8rmZ" rel="" target="self">http://ideone.com/HH8rmZ</a><div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/" frameborder="0" height="500"></iframe></div> grandis, pius zetaes.Cur luna persuadere?');
960+
});
961+
962+
it('should return correct result for inline embedding with url embed disabled', function () {
963+
var output = undefined;
964+
var embeds = [];
965+
var opts = cloneObject(options);
966+
opts.inlineEmbed = 'all';
967+
opts.link = false;
968+
969+
var input = output = 'Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?';
970+
var ideone = new Ideone(input, output, opts, embeds);
971+
972+
var _ideone$process5 = ideone.process();
973+
974+
var _ideone$process6 = babelHelpers_slicedToArray(_ideone$process5, 2);
975+
976+
output = _ideone$process6[0];
977+
embeds = _ideone$process6[1];
978+
979+
expect$6(embeds).to.be.empty;
980+
expect$6(output.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal('Sunt castores desiderium http://ideone.com/HH8rmZ<div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/" frameborder="0" height="500"></iframe></div> grandis, pius zetaes.Cur luna persuadere?');
981+
});
982+
983+
it('should return correct result for inline embedding with inlineText and link disabled', function () {
984+
var output = undefined;
985+
var embeds = [];
986+
var opts = cloneObject(options);
987+
opts.inlineEmbed = 'all';
988+
opts.link = false;
989+
opts.inlineText = false;
990+
991+
var input = output = 'Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?';
992+
var ideone = new Ideone(input, output, opts, embeds);
993+
994+
var _ideone$process7 = ideone.process();
995+
996+
var _ideone$process8 = babelHelpers_slicedToArray(_ideone$process7, 2);
997+
998+
output = _ideone$process8[0];
999+
embeds = _ideone$process8[1];
1000+
1001+
expect$6(embeds).to.be.empty;
1002+
expect$6(output.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal('Sunt castores desiderium <div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/" frameborder="0" height="500"></iframe></div> grandis, pius zetaes.Cur luna persuadere?');
1003+
});
1004+
1005+
it('should return correct result for inline embedding with inlineText disabled and link enabled', function () {
1006+
var output = undefined;
1007+
var embeds = [];
1008+
var opts = cloneObject(options);
1009+
opts.inlineEmbed = 'all';
1010+
opts.link = true;
1011+
opts.inlineText = false;
1012+
1013+
var input = 'Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?';
1014+
1015+
output = new Url(input, opts).process();
1016+
1017+
var ideone = new Ideone(input, output, opts, embeds);
1018+
1019+
var _ideone$process9 = ideone.process();
1020+
1021+
var _ideone$process10 = babelHelpers_slicedToArray(_ideone$process9, 2);
1022+
1023+
output = _ideone$process10[0];
1024+
embeds = _ideone$process10[1];
1025+
1026+
expect$6(embeds).to.be.empty;
1027+
expect$6(output.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal('Sunt castores desiderium <a href="http://ideone.com/HH8rmZ" rel="" target="self"><div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/" frameborder="0" height="500"></iframe></div></a> grandis, pius zetaes.Cur luna persuadere?');
1028+
});
1029+
});
1030+
});
1031+
1032+
describe('test with multiple matching', function () {
1033+
1034+
it('should return correct results for multiple embeds', function () {
1035+
1036+
var output = undefined;
1037+
var embeds = [];
1038+
var input = output = 'Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes http://ideone.com/ETAZsa .Cur luna persuadere?';
1039+
var ideone = new Ideone(input, output, options, embeds);
1040+
1041+
var _ideone$process11 = ideone.process();
1042+
1043+
var _ideone$process12 = babelHelpers_slicedToArray(_ideone$process11, 2);
1044+
1045+
output = _ideone$process12[0];
1046+
embeds = _ideone$process12[1];
1047+
1048+
expect$6(embeds).to.have.length(2);
1049+
expect$6(output).to.not.be.undefined;
1050+
});
1051+
});
8771052
});

test/index.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ import './unit_tests/emoticons/emoji.test'
66

77
import './unit_tests/code/plunker.test'
88
import './unit_tests/code/codepen.test'
9+
import './unit_tests/code/ideone.test'
910

test/unit_tests/code/codepen.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('Class Codepen => unit test', function(){
1010
let input = output = `Sunt castores desiderium http://codepen.io/enxaneta/pen/meYEzO#0 grandis, pius zetaes.Cur luna persuadere?`;
1111
let codepen = new Codepen(input, output, options, embeds);
1212
[output, embeds] = codepen.process();
13-
console.log(embeds);
13+
1414
expect(output).to.be.a('string');
1515
expect(embeds).to.be.a('array');
1616

Lines changed: 119 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,119 @@
1-
/**
2-
* Created by ritz078 on 09/01/16.
3-
*/
1+
import Ideone from '../../../src/js/modules/code/ideone.es6';
2+
import {options, ejs} from '../../options';
3+
import { cloneObject } from '../../../src/js/modules/utils.es6'
4+
import Url from '../../../src/js/modules/url.es6'
5+
let expect = chai.expect;
6+
7+
describe('Class Ideone => unit test', function () {
8+
describe('test with single matching', function () {
9+
10+
describe('normal embedding', function () {
11+
12+
let output;
13+
let embeds = [];
14+
let input = output = `Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?`;
15+
let ideone = new Ideone(input, output, options, embeds);
16+
[output, embeds] = ideone.process();
17+
18+
19+
it('should return a valid embedding url', function () {
20+
21+
expect(output).to.be.a('string');
22+
expect(embeds).to.be.a('array');
23+
24+
expect(embeds[0].text.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal(`<div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/HH8rmZ" frameborder="0" height="500"></iframe></div>`)
25+
});
26+
});
27+
28+
29+
describe('inline embedding', function () {
30+
it('should return correct result for inline embedding with url embed enabled', function () {
31+
let output;
32+
let embeds = [];
33+
let opts = cloneObject(options);
34+
opts.inlineEmbed = 'all';
35+
36+
let input = `Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?`;
37+
output = new Url(input, opts).process();
38+
let ideone = new Ideone(input, output, opts, embeds);
39+
40+
[output, embeds] = ideone.process();
41+
42+
expect(embeds).to.be.empty;
43+
expect(output.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal('Sunt castores desiderium <a href="http://ideone.com/HH8rmZ" rel="" target="self">http://ideone.com/HH8rmZ</a><div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/" frameborder="0" height="500"></iframe></div> grandis, pius zetaes.Cur luna persuadere?')
44+
});
45+
46+
47+
it('should return correct result for inline embedding with url embed disabled', function () {
48+
let output;
49+
let embeds = [];
50+
let opts = cloneObject(options);
51+
opts.inlineEmbed = 'all';
52+
opts.link = false;
53+
54+
let input = output = `Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?`;
55+
let ideone = new Ideone(input, output, opts, embeds);
56+
57+
[output, embeds] = ideone.process();
58+
59+
expect(embeds).to.be.empty;
60+
expect(output.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal('Sunt castores desiderium http://ideone.com/HH8rmZ<div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/" frameborder="0" height="500"></iframe></div> grandis, pius zetaes.Cur luna persuadere?')
61+
});
62+
63+
it('should return correct result for inline embedding with inlineText and link disabled', function () {
64+
let output;
65+
let embeds = [];
66+
let opts = cloneObject(options);
67+
opts.inlineEmbed = 'all';
68+
opts.link = false;
69+
opts.inlineText = false;
70+
71+
let input = output = `Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?`;
72+
let ideone = new Ideone(input, output, opts, embeds);
73+
74+
[output, embeds] = ideone.process();
75+
76+
expect(embeds).to.be.empty;
77+
expect(output.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal('Sunt castores desiderium <div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/" frameborder="0" height="500"></iframe></div> grandis, pius zetaes.Cur luna persuadere?')
78+
});
79+
80+
it('should return correct result for inline embedding with inlineText disabled and link enabled', function () {
81+
let output;
82+
let embeds = [];
83+
let opts = cloneObject(options);
84+
opts.inlineEmbed = 'all';
85+
opts.link = true;
86+
opts.inlineText = false;
87+
88+
let input = `Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes.Cur luna persuadere?`;
89+
90+
output = new Url(input, opts).process();
91+
92+
let ideone = new Ideone(input, output, opts, embeds);
93+
94+
[output, embeds] = ideone.process();
95+
96+
expect(embeds).to.be.empty;
97+
expect(output.replace(/(\r\n|\n|\r|\t)/gm, '')).to.equal(
98+
`Sunt castores desiderium <a href="http://ideone.com/HH8rmZ" rel="" target="self"><div class="ejs-ideone ejs-embed"><iframe src="http://ideone.com/embed/" frameborder="0" height="500"></iframe></div></a> grandis, pius zetaes.Cur luna persuadere?`
99+
)
100+
})
101+
});
102+
});
103+
104+
105+
describe('test with multiple matching', function () {
106+
107+
it('should return correct results for multiple embeds', function () {
108+
109+
let output;
110+
let embeds = [];
111+
let input = output = `Sunt castores desiderium http://ideone.com/HH8rmZ grandis, pius zetaes http://ideone.com/ETAZsa .Cur luna persuadere?`;
112+
let ideone = new Ideone(input, output, options, embeds);
113+
[output, embeds] = ideone.process();
114+
115+
expect(embeds).to.have.length(2);
116+
expect(output).to.not.be.undefined;
117+
});
118+
});
119+
});

0 commit comments

Comments
 (0)