Ejemplo n.º 1
0
        it("is typeOf map matcher", function () {
            var map = sinonMatch.map;

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

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

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

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

        assert(match.test({ deep: { prop: true } }));
    });
Ejemplo n.º 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"));
        });
Ejemplo n.º 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\"))");
        });
Ejemplo n.º 8
0
        it("is typeOf regexp matcher", function () {
            var date = sinonMatch.date;

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

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

            assert(sinonMatch.isMatcher(regexp));
            assert.equals(regexp.toString(), "typeOf(\"regexp\")");
        });
Ejemplo n.º 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" } }));
    });
Ejemplo n.º 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" }));
    });
Ejemplo n.º 13
0
        it("is typeOf set matcher", function () {
            var set = sinonMatch.set;

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

        assert(sinonMatch.isMatcher(match));
    });
Ejemplo n.º 15
0
 db.get('1', function (err, value) {
   assert(err)
   assert.isInstanceOf(err, errors.NotFoundError)
   refute(value)
   callback()
 })
Ejemplo n.º 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)
})
Ejemplo n.º 17
0
 fs.stat(this.cleanupDirs[0], function (err, stat) {
   refute(err)
   assert(stat.isDirectory())
   done()
 })
Ejemplo n.º 18
0
test('#use registers middleware', () => {
  let m = () => {}
  router.use(m)
  assert(router.middleware.length === 1)
  assert(router.middleware[0] === m)
})
Ejemplo n.º 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)
 })
Ejemplo n.º 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" }));
        });
Ejemplo n.º 22
0
 db.get('k4', function (err) {
   assert(err)
   // DONE
   done()
 })
Ejemplo n.º 23
0
    it("returns true if array is equal", function () {
        var match = sinonMatch({ arr: ["a", "b"] });

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

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

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

        assert(match.test("sinon"));
    });
Ejemplo n.º 30
0
        it("returns matcher", function () {
            var has = matcher("foo");

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