Refer to MatchersUtil instances as matchersUtil, not util
This commit is contained in:
@@ -192,10 +192,7 @@ describe("toThrowError", function() {
|
||||
});
|
||||
|
||||
it("passes if thrown is an Error and the expected the same Error", function() {
|
||||
var util = {
|
||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||
},
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(),
|
||||
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
||||
fn = function() {
|
||||
throw new Error();
|
||||
},
|
||||
@@ -208,10 +205,7 @@ describe("toThrowError", function() {
|
||||
});
|
||||
|
||||
it("passes if thrown is a custom error that takes arguments and the expected is the same error", function() {
|
||||
var util = {
|
||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
||||
},
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(),
|
||||
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
||||
CustomError = function CustomError(arg) { arg.x },
|
||||
fn = function() {
|
||||
throw new CustomError({ x: 1 });
|
||||
@@ -227,10 +221,7 @@ describe("toThrowError", function() {
|
||||
});
|
||||
|
||||
it("fails if thrown is an Error and the expected is a different Error", function() {
|
||||
var util = {
|
||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
||||
},
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(),
|
||||
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
||||
fn = function() {
|
||||
throw new Error();
|
||||
},
|
||||
@@ -243,11 +234,11 @@ describe("toThrowError", function() {
|
||||
});
|
||||
|
||||
it("passes if thrown is a type of Error and it is equal to the expected Error and message", function() {
|
||||
var util = {
|
||||
var matchersUtil = {
|
||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true),
|
||||
pp: jasmineUnderTest.makePrettyPrinter()
|
||||
},
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(util),
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
|
||||
fn = function() {
|
||||
throw new TypeError("foo");
|
||||
},
|
||||
@@ -260,12 +251,12 @@ describe("toThrowError", function() {
|
||||
});
|
||||
|
||||
it("passes if thrown is a custom error that takes arguments and it is equal to the expected custom error and message", function() {
|
||||
var util = {
|
||||
var matchersUtil = {
|
||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true),
|
||||
pp: jasmineUnderTest.makePrettyPrinter()
|
||||
},
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(util),
|
||||
CustomError = function CustomError(arg) { this.message = arg.message },
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
|
||||
CustomError = function CustomError(arg) { this.message = arg.message; },
|
||||
fn = function() {
|
||||
throw new CustomError({message: "foo"});
|
||||
},
|
||||
@@ -280,11 +271,11 @@ describe("toThrowError", function() {
|
||||
});
|
||||
|
||||
it("fails if thrown is a type of Error and the expected is a different Error", function() {
|
||||
var util = {
|
||||
var matchersUtil = {
|
||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
|
||||
pp: jasmineUnderTest.makePrettyPrinter()
|
||||
},
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(util),
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
|
||||
fn = function() {
|
||||
throw new TypeError("foo");
|
||||
},
|
||||
@@ -297,11 +288,11 @@ describe("toThrowError", function() {
|
||||
});
|
||||
|
||||
it("passes if thrown is a type of Error and has the same type as the expected Error and the message matches the expected message", function() {
|
||||
var util = {
|
||||
var matchersUtil = {
|
||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(true),
|
||||
pp: jasmineUnderTest.makePrettyPrinter()
|
||||
},
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(util),
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
|
||||
fn = function() {
|
||||
throw new TypeError("foo");
|
||||
},
|
||||
@@ -314,11 +305,11 @@ describe("toThrowError", function() {
|
||||
});
|
||||
|
||||
it("fails if thrown is a type of Error and the expected is a different Error", function() {
|
||||
var util = {
|
||||
var matchersUtil = {
|
||||
equals: jasmine.createSpy('delegated-equal').and.returnValue(false),
|
||||
pp: jasmineUnderTest.makePrettyPrinter()
|
||||
},
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(util),
|
||||
matcher = jasmineUnderTest.matchers.toThrowError(matchersUtil),
|
||||
fn = function() {
|
||||
throw new TypeError("foo");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user