diff --git a/packages/check/match.js b/packages/check/match.js index b80194f71d..13d1699344 100644 --- a/packages/check/match.js +++ b/packages/check/match.js @@ -166,8 +166,8 @@ var checkSubtree = function (value, pattern) { throw new Match.Error("Expected null, got " + EJSON.stringify(value)); } - // Strings and numbers match literally. Goes well with Match.OneOf. - if (typeof pattern === "string" || typeof pattern === "number") { + // Strings, numbers, and booleans match literally. Goes well with Match.OneOf. + if (typeof pattern === "string" || typeof pattern === "number" || typeof pattern === "boolean") { if (value === pattern) return; throw new Match.Error("Expected " + pattern + ", got " + diff --git a/packages/check/match_test.js b/packages/check/match_test.js index 30a124218c..be74f40d28 100644 --- a/packages/check/match_test.js +++ b/packages/check/match_test.js @@ -117,6 +117,11 @@ Tinytest.add("check - check", function (test) { fails(123, 456); fails("123", 123); fails(123, "123"); + matches(true, true); + matches(false, false); + fails(true, false); + fails(true, "true"); + fails("false", false); matches(/foo/, RegExp); fails(/foo/, String);