示例#1
0
        it("is typeOf map matcher", function () {
            var map = sinonMatch.map;

            assert(sinonMatch.isMatcher(map));
            assert.equals(map.toString(), "typeOf(\"map\")");
        });
示例#2
0
    it("returns true if string property matches", function () {
        var match = sinonMatch({ length: 5 });

        assert(match.test("sinon"));
    });
示例#3
0
    it("returns true for substring match", function () {
        var match = sinonMatch("no");

        assert(match.test("sinon"));
    });
示例#4
0
        it("can be used with undefined", function () {
            var falsyAndUndefined = sinonMatch.falsy.and(undefined);

            assert.isFalse(falsyAndUndefined.test(false));
            assert(falsyAndUndefined.test(undefined));
        });
示例#5
0
    it("returns true if deep test matches", function () {
        var match = sinonMatch({ deep: { prop: sinonMatch.typeOf("boolean") } });

        assert(match.test({ deep: { prop: true } }));
    });
示例#6
0
        it("returns true if either matcher matches", function () {
            var numberOrString = sinonMatch.number.or(sinonMatch.string);

            assert(numberOrString.test(123));
            assert(numberOrString.test("abc"));
        });
示例#7
0
        it("is matcher", function () {
            var fooAndBar = sinonMatch.has("foo").and(sinonMatch.has("bar"));

            assert(sinonMatch.isMatcher(fooAndBar));
            assert.equals(fooAndBar.toString(), "has(\"foo\").and(has(\"bar\"))");
        });
示例#8
0
        it("is typeOf regexp matcher", function () {
            var date = sinonMatch.date;

            assert(sinonMatch.isMatcher(date));
            assert.equals(date.toString(), "typeOf(\"date\")");
        });
示例#9
0
        it("is typeOf symbol matcher", function () {
            var symbol = sinonMatch.symbol;

            assert(sinonMatch.isMatcher(symbol));
            assert.equals(symbol.toString(), "typeOf(\"symbol\")");
        });
示例#10
0
        it("is typeOf regexp matcher", function () {
            var regexp = sinonMatch.regexp;

            assert(sinonMatch.isMatcher(regexp));
            assert.equals(regexp.toString(), "typeOf(\"regexp\")");
        });
示例#11
0
    it("returns true if properties are deep equal", function () {
        var match = sinonMatch({ deep: { str: "sinon" } });

        assert(match.test({ deep: { str: "sinon", ignored: "value" } }));
    });
示例#12
0
    it("returns true if properties are equal", function () {
        var match = sinonMatch({ str: "sinon", nr: 1 });

        assert(match.test({ str: "sinon", nr: 1, other: "ignored" }));
    });
示例#13
0
        it("is typeOf set matcher", function () {
            var set = sinonMatch.set;

            assert(sinonMatch.isMatcher(set));
            assert.equals(set.toString(), "typeOf(\"set\")");
        });
示例#14
0
    it("returns matcher", function () {
        var match = sinonMatch(function () {});

        assert(sinonMatch.isMatcher(match));
    });
示例#15
0
 db.get('1', function (err, value) {
   assert(err)
   assert.isInstanceOf(err, errors.NotFoundError)
   refute(value)
   callback()
 })
示例#16
0
test('#match ignores the trailing slash', () => {
  router.map(routes)
  assert(router.match('/application/messages').routes.length)
  assert(router.match('/application/messages/').routes.length)
})
示例#17
0
 fs.stat(this.cleanupDirs[0], function (err, stat) {
   refute(err)
   assert(stat.isDirectory())
   done()
 })
示例#18
0
test('#use registers middleware', () => {
  let m = () => {}
  router.use(m)
  assert(router.middleware.length === 1)
  assert(router.middleware[0] === m)
})
示例#19
0
        it("can be used with undefined", function () {
            var numberOrUndef = sinonMatch.number.or(undefined);

            assert(numberOrUndef.test(123));
            assert(numberOrUndef.test(undefined));
        });
 db.get('foo', function (err, value) {
   assert(err)
   assert.equals('EncodingError', err.name)
   refute(value)
   db.close(done)
 })
示例#21
0
        it("returns true if both matchers match", function () {
            var fooAndBar = sinonMatch.has("foo").and({ bar: "bar" });

            assert(fooAndBar.test({ foo: "foo", bar: "bar" }));
        });
 db.get('k4', function (err) {
   assert(err)
   // DONE
   done()
 })
示例#23
0
    it("returns true if array is equal", function () {
        var match = sinonMatch({ arr: ["a", "b"] });

        assert(match.test({ arr: ["a", "b"] }));
    });
 , function () {
     assert(true)
   }
示例#25
0
    it("returns true if error message matches", function () {
        var match = sinonMatch({ message: "evil error" });

        assert(match.test(new Error("evil error")));
    });
示例#26
0
 db.get(data.key, function (err, value) {
   // none of them should exist
   assert(err)
   refute(value)
   callback()
 })
示例#27
0
    it("returns true if number property matches", function () {
        var match = sinonMatch({ toFixed: sinonMatch.func });

        assert(match.test(0));
    });
示例#28
0
 db.get(data.key, function (err, value) {
   assert(err)
   refute(value)
   callback()
 })
示例#29
0
    it("returns true for regexp match", function () {
        var match = sinonMatch(/^[sino]+$/);

        assert(match.test("sinon"));
    });
示例#30
0
        it("returns matcher", function () {
            var has = matcher("foo");

            assert(sinonMatch.isMatcher(has));
        });