Added matchers: truthy, falsy, empty and notEmpty

This commit is contained in:
sjolicoeur
2017-12-05 13:04:29 -08:00
committed by pivotal
parent 0183b1642d
commit d90e20eb15
11 changed files with 363 additions and 0 deletions
@@ -0,0 +1,39 @@
describe("Empty", function () {
it("matches an empty object", function () {
var empty = new jasmineUnderTest.Empty();
expect(empty.asymmetricMatch({})).toBe(true);
expect(empty.asymmetricMatch({undefined: false})).toBe(false);
});
it("matches an empty array", function () {
var empty = new jasmineUnderTest.Empty();
expect(empty.asymmetricMatch([])).toBe(true);
expect(empty.asymmetricMatch([1, 12, 3])).toBe(false);
});
it("matches an empty string", function () {
var empty = new jasmineUnderTest.Empty();
expect(empty.asymmetricMatch("")).toBe(true);
expect(empty.asymmetricMatch('')).toBe(true);
expect(empty.asymmetricMatch('12312')).toBe(false);
});
if (typeof Map !== 'undefined') {
it("matches an empty map", function () {
var empty = new jasmineUnderTest.Empty();
expect(empty.asymmetricMatch(new Map())).toBe(true);
});
}
if (typeof Set !== 'undefined') {
it("matches an empty map", function () {
var empty = new jasmineUnderTest.Empty();
expect(empty.asymmetricMatch(new Set())).toBe(true);
});
}
});