Skip to content

Commit

Permalink
Add expected arguments to assert.throws calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Standard8 committed Jun 21, 2018
1 parent 282ab0c commit 02eb2f9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/test-base64.js
Expand Up @@ -10,10 +10,10 @@ const base64 = require("../lib/base64");
exports["test out of range encoding"] = function(assert) {
assert.throws(function() {
base64.encode(-1);
});
}, /Must be between 0 and 63/);
assert.throws(function() {
base64.encode(64);
});
}, /Must be between 0 and 63/);
};

exports["test normal encoding and decoding"] = function(assert) {
Expand Down
8 changes: 4 additions & 4 deletions test/test-source-map-generator.js
Expand Up @@ -84,15 +84,15 @@ exports["test adding mappings (invalid)"] = function(assert) {
// Not enough info.
assert.throws(function() {
map.addMapping({});
});
}, /"generated" is a required argument/);

// Original file position, but no source.
assert.throws(function() {
map.addMapping({
generated: { line: 1, column: 1 },
original: { line: 1, column: 1 }
});
});
}, /Invalid mapping/);
};

exports["test adding mappings with skipValidation"] = function(assert) {
Expand All @@ -105,15 +105,15 @@ exports["test adding mappings with skipValidation"] = function(assert) {
// Not enough info, caught by `util.getArgs`
assert.throws(function() {
map.addMapping({});
});
}, /"generated" is a required argument/);

// Original file position, but no source. Not checked.
assert.doesNotThrow(function() {
map.addMapping({
generated: { line: 1, column: 1 },
original: { line: 1, column: 1 }
});
});
}, /Invalid mapping/);
};

exports["test that the correct mappings are being generated"] = function(assert) {
Expand Down
8 changes: 4 additions & 4 deletions test/test-source-node.js
Expand Up @@ -35,10 +35,10 @@ exports["test .add()"] = function(assert) {
// Adding other stuff doesn't.
assert.throws(function() {
node.add({});
});
}, /TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings/);
assert.throws(function() {
node.add(function() {});
});
}, /TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings/);
};

exports["test .prepend()"] = function(assert) {
Expand Down Expand Up @@ -70,10 +70,10 @@ exports["test .prepend()"] = function(assert) {
// Prepending other stuff doesn't.
assert.throws(function() {
node.prepend({});
});
}, /TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings/);
assert.throws(function() {
node.prepend(function() {});
});
}, /TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings/);
};

exports["test .toString()"] = function(assert) {
Expand Down

0 comments on commit 02eb2f9

Please sign in to comment.