UNPKG

685 BJavaScriptView Raw
1var errors = require("../lib/errors");
2
3exports.errorDescriptionIncludesLocationAndActualValueAndExpectedValue = function(test) {
4 var error = errors.error({
5 expected: "Nothing",
6 actual: "Something",
7 location: {
8 describe: function() {
9 return "Here"
10 }
11 }
12 });
13 test.equal("Here:\nExpected Nothing\nbut got Something", error.describe());
14 test.done();
15};
16
17exports.canDescribeErrorWithoutLocation = function(test) {
18 var error = errors.error({
19 expected: "Nothing",
20 actual: "Something"
21 });
22 test.equal("Expected Nothing\nbut got Something", error.describe());
23 test.done();
24};