Resolve remaining test issues

This commit is contained in:
Greg Cobb and JR Boyens
2013-07-22 11:57:47 -07:00
parent 61a1f93488
commit 8c1881053c
5 changed files with 32 additions and 4 deletions

View File

@@ -9,7 +9,9 @@ describe("ObjectContaining", function() {
it("does not match an empty object actual", function() {
var containing = new j$.ObjectContaining("foo");
expect(containing.jasmineMatches({})).toBe(false);
expect(function() {
containing.jasmineMatches({})
}).toThrowError(/not 'foo'/)
});
it("matches when the key/value pair is present in the actual", function() {
@@ -39,10 +41,21 @@ describe("ObjectContaining", function() {
containing.jasmineMatches({foo: "fooVal", bar: "barVal"}, mismatchKeys, mismatchValues);
expect(mismatchValues.length).toBe(1);
expect(mismatchValues[0]).toEqual("'foo' was 'fooVal' in actual, but was 'other' in expected.");
});
it("adds keys in expected but not actual to the mismatchKeys parameter", function() {
var containing = new j$.ObjectContaining({foo: "fooVal"});
var mismatchKeys = [];
var mismatchValues = [];
containing.jasmineMatches({bar: "barVal"}, mismatchKeys, mismatchValues);
expect(mismatchKeys.length).toBe(1);
expect(mismatchKeys[0]).toEqual("expected has key 'foo', but missing from actual.");
});
it("jasmineToString's itself", function() {
var containing = new j$.ObjectContaining({});