Use jasmineToString for printing out complicated matchers
This commit is contained in:
@@ -914,6 +914,47 @@ describe("jasmine.Matchers", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Matchers.Any", function () {
|
||||
var any;
|
||||
describe(".jasmineToString", function () {
|
||||
describe("with Object", function () {
|
||||
it ("says it's looking for an object", function () {
|
||||
any = jasmine.any(Object);
|
||||
expect(any.jasmineToString()).toMatch(/<jasmine\.any\(function Object.*\)>/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with Function", function () {
|
||||
it ("says it's looking for a function", function () {
|
||||
any = jasmine.any(Function);
|
||||
expect(any.jasmineToString()).toMatch(/<jasmine\.any\(function Function.*\)>/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with String", function () {
|
||||
it ("says it's looking for a string", function () {
|
||||
any = jasmine.any(String);
|
||||
expect(any.jasmineToString()).toMatch(/<jasmine\.any\(function String.*\)>/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with Number", function () {
|
||||
it ("says it's looking for a number", function () {
|
||||
any = jasmine.any(Number);
|
||||
expect(any.jasmineToString()).toMatch(/<jasmine\.any\(function Number.*\)>/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with some other defined 'class'", function () {
|
||||
it ("says it's looking for an object", function () {
|
||||
function MyClass () {}
|
||||
any = jasmine.any(MyClass);
|
||||
expect(any.jasmineToString()).toMatch(/<jasmine\.any\(function MyClass.*\)>/);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("all matchers", function() {
|
||||
it("should return null, for future-proofing, since we might eventually allow matcher chaining", function() {
|
||||
expect(match(true).toBe(true)).toBeUndefined();
|
||||
|
||||
Reference in New Issue
Block a user