migrate more tests to mocha

This commit is contained in:
webzwo0i 2016-02-29 18:30:16 +01:00
parent 6f1b0d9185
commit 0db329e1b3

View file

@ -299,20 +299,32 @@ describe("text line mutations",function(){
}
}
function runApplyToAttributionTest(testId, attribs, cs, inAttr, outCorrect) {
function runApplyToAttributionTest(attribs, cs, inAttr) {
var p = poolOrArray(attribs);
var result = Changeset.applyToAttribution(
Changeset.checkRep(cs), inAttr, p);
assertEqualStrings(outCorrect, result);
return result;
}
describe("applyToAttribution",function(){
// turn c<b>a</b>ctus\n into a<b>c</b>tusabcd\n
runApplyToAttributionTest(1, ['bold,', 'bold,true'], "Z:7>3-1*0=1*1=1=3+4$abcd", "+1*1+1|1+5", "+1*1+1|1+8");
it(" #1",function(done){
var result = runApplyToAttributionTest(['bold,', 'bold,true'], "Z:7>3-1*0=1*1=1=3+4$abcd", "+1*1+1|1+5");
var expected = "+1*1+1|1+8";
if(!assertEqualStrings(expected, result)) throw new Error("applyToAttribution is wrong expected:"+expected+" got "+result);
done();
});
// turn "david\ngreenspan\n" into "<b>david\ngreen</b>\n"
runApplyToAttributionTest(2, ['bold,', 'bold,true'], "Z:g<4*1|1=6*1=5-4$", "|2+g", "*1|1+6*1+5|1+1");
it(" #2",function(done){
var result = runApplyToAttributionTest(['bold,', 'bold,true'], "Z:g<4*1|1=6*1=5-4$", "|2+g");
var expected = "*1|1+6*1+5|1+1";
if(!assertEqualStrings(expected, result)) throw new Error("applyToAttribution is wrong expected:"+expected+" got "+result);
done();
});
});
(function () {
describe("textLinesMutator",function(){
it("hasMore indicates remaining characters",function(done){
var lines = ["1\n", "2\n", "3\n", "4\n"];
var mu;
@ -350,8 +362,9 @@ describe("text line mutations",function(){
assert(mu.hasMore() + ' == false');
mu.close();
assert(mu.hasMore() + ' == false');
})();
done();
});
});
function runMutateAttributionTest(testId, attribs, cs, alines, outCorrect) {
var p = poolOrArray(attribs);