Skip to content

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mnater committed May 27, 2018
1 parent cbc2b25 commit 66fc519
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/hyphenopoly.module_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,28 @@ describe("hyphenopoly.module", function () {
});

it("uses language agnostic (global) exceptions", function (done) {
H9Y.config({
"exceptions": {
"global": "Silben-trennung"
},
"hyphen": "•",
"require": ["de"]
}).then(
function (hyphenateText) {
if (hyphenateText("Silbentrennung") === "Silben•trennung") {
done();
} else {
done(new Error(hyphenateText("Silbentrennung")));
}
}
).catch(
function (e) {
done(new Error(e));
}
);
});

it("uses language both kind of exceptions", function (done) {
H9Y.config({
"exceptions": {
"global": "Silben-trennung",
Expand Down Expand Up @@ -348,5 +370,21 @@ describe("hyphenopoly.module", function () {
}
);
});

it("throws for unknown event", function (done) {
H9Y.config({
"require": ["de"],
"handleEvent": {
"error": function (e) {
if (e.msg === "unknown Event \"fantasyEvent\" discarded") {
done();
}
},
"fantasyEvent": function (e) {
console.log(42);
}
}
});
});
});
});

0 comments on commit 66fc519

Please sign in to comment.