Skip to content

Commit

Permalink
test: fix headings
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Oct 2, 2018
1 parent 3b40e25 commit d70a86a
Show file tree
Hide file tree
Showing 8 changed files with 306 additions and 293 deletions.
2 changes: 1 addition & 1 deletion test/format-parts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var test = require("tape")
, formatParts = require("../format-parts");

test("getResolver", function (t) {
test("formatParts", function (t) {
t.test("Should resolve", function (t) {
t.equal(formatParts({ literals: ["foo raz"], substitutions: [], rest: null }), "foo raz");
t.equal(
Expand Down
2 changes: 1 addition & 1 deletion test/get-parts-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var test = require("tape")
, modifierS = require("../modifiers/s")
, getResolver = require("../get-parts-resolver");

test("getResolver", function (t) {
test("getPartsResolver", function (t) {
t.test("Should resolve", function (t) {
// eslint-disable-next-line id-length
var resolve = getResolver({ d: modifierD, s: modifierS });
Expand Down
11 changes: 6 additions & 5 deletions test/modifiers/d.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
var test = require("tape")
, modifier = require("../../modifiers/d");

test("Should resolve", function (t) {
test("modifiers.d", function (t) {
t.equal(
modifier({ valueOf: function () { return "32.23"; } }), "32.23",
"Numeric representation for non-number value"
"Should resolve numeric representation for non-number value"
);
t.equal(modifier(32.34), "32.34", "Numeric representation for non-number value");
t.equal(modifier(Infinity), "Infinity", "Inifity for Infinity");
t.equal(modifier(32.34), "32.34", "Should resolve numeric representation for non-number value");
t.equal(modifier(Infinity), "Infinity", "Should resolve Inifity for Infinity");
t.equal(
modifier(Object.create(null))[0], "<", "meaningful error string for non-corcible value"
modifier(Object.create(null))[0], "<",
"Should resolve meaningful error string for non-corcible value"
);
t.end();
});
15 changes: 9 additions & 6 deletions test/modifiers/f.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
var test = require("tape")
, modifier = require("../../modifiers/f");

test("Should resolve", function (t) {
test("modifiers.f", function (t) {
t.equal(
modifier({ valueOf: function () { return "32.23"; } }), "32.23",
"Float representation for non-number value"
"Should resolve float representation for non-number value"
);
t.equal(modifier(32.34), "32.34", "Float representation for number directly");
t.equal(modifier("32.14hg"), "32.14", "Float representation for string numeric value");
t.equal(modifier(Infinity), "Infinity", "Inifity for Infinity");
t.equal(modifier(32.34), "32.34", "Should resolve float representation for number directly");
t.equal(
modifier(Object.create(null))[0], "<", "meaningful error string for non-corcible value"
modifier("32.14hg"), "32.14", "Should resolve float representation for string numeric value"
);
t.equal(modifier(Infinity), "Infinity", "IShould resolve Inifity for Infinity");
t.equal(
modifier(Object.create(null))[0], "<",
"Should resolve meaningful error string for non-corcible value"
);
t.end();
});
15 changes: 9 additions & 6 deletions test/modifiers/i.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
var test = require("tape")
, modifier = require("../../modifiers/i");

test("Should resolve", function (t) {
test("modifier.i", function (t) {
t.equal(
modifier({ valueOf: function () { return "32.23"; } }), "32",
"Integer representation for non-number value"
"Should resolve integer representation for non-number value"
);
t.equal(modifier(32.34), "32", "Integer representation for number value");
t.equal(modifier("32.14hg"), "32", "Integer representation for string numeric value");
t.equal(modifier(Infinity), "Infinity", "Infinity for infinity");
t.equal(modifier(32.34), "32", "Should resolve integer representation for number value");
t.equal(
modifier(Object.create(null))[0], "<", "meaningful error string for non-corcible value"
modifier("32.14hg"), "32", "Should resolve integer representation for string numeric value"
);
t.equal(modifier(Infinity), "Infinity", "Should resolve Infinity for infinity");
t.equal(
modifier(Object.create(null))[0], "<",
"Should resolve meaningful error string for non-corcible value"
);
t.end();
});
13 changes: 8 additions & 5 deletions test/modifiers/j.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
var test = require("tape")
, modifier = require("../../modifiers/j");

test("Should resolve", function (t) {
t.equal(modifier({ foo: "bar" }), "{\n \"foo\": \"bar\"\n}", "JSON string for JSON object");
test("modifier.j", function (t) {
t.equal(
modifier({ foo: "bar" }), "{\n \"foo\": \"bar\"\n}",
" Should resolve JSON string for JSON object"
);
var obj = { toJSON: function () { throw new Error("foo"); } };
t.equal(modifier(obj)[0], "<", "meaningful error string for invalid value");
t.equal(modifier(obj)[0], "<", "Should resolve meaningful error string for invalid value");
obj = {};
obj.obj = obj;
t.equal(modifier(obj)[0], "<", "meaningful error for circular references");
t.equal(modifier()[0], "<", "meaningful error for non serializable values");
t.equal(modifier(obj)[0], "<", "Should resolve meaningful error for circular references");
t.equal(modifier()[0], "<", " Should resolvemeaningful error for non serializable values");
t.end();
});
9 changes: 5 additions & 4 deletions test/modifiers/s.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
var test = require("tape")
, modifier = require("../../modifiers/s");

test("Should resolve", function (t) {
test("modifier.s", function (t) {
t.equal(
modifier({ toString: function () { return "marko"; } }), "marko",
"String representation for non-string value"
"Should resolve string representation for non-string value"
);
t.equal(modifier("barko"), "barko", "String representation for string");
t.equal(modifier("barko"), "barko", "Should resolve string representation for string");
t.equal(
modifier(Object.create(null))[0], "<", "meaningful error string for non-corcible value"
modifier(Object.create(null))[0], "<",
"Should resolve meaningful error string for non-corcible value"
);
t.end();
});

0 comments on commit d70a86a

Please sign in to comment.