Run Prettier on all files
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
describe("toHaveBeenCalledOnceWith", function () {
|
||||
|
||||
it("passes when the actual was called only once and with matching parameters", function () {
|
||||
describe('toHaveBeenCalledOnceWith', function() {
|
||||
it('passes when the actual was called only once and with matching parameters', function() {
|
||||
var pp = jasmineUnderTest.makePrettyPrinter(),
|
||||
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
|
||||
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
|
||||
@@ -11,13 +10,23 @@ describe("toHaveBeenCalledOnceWith", function () {
|
||||
result = matcher.compare(calledSpy, 'a', 'b');
|
||||
|
||||
expect(result.pass).toBe(true);
|
||||
expect(result.message).toEqual("Expected spy called-spy to have been called 0 times, multiple times, or once, but with arguments different from:\n [ 'a', 'b' ]\nBut the actual call was:\n [ 'a', 'b' ].\n\n");
|
||||
expect(result.message).toEqual(
|
||||
"Expected spy called-spy to have been called 0 times, multiple times, or once, but with arguments different from:\n [ 'a', 'b' ]\nBut the actual call was:\n [ 'a', 'b' ].\n\n"
|
||||
);
|
||||
});
|
||||
|
||||
it("supports custom equality testers", function () {
|
||||
var customEqualityTesters = [function() { return true; }],
|
||||
matchersUtil = new jasmineUnderTest.MatchersUtil({customTesters: customEqualityTesters}),
|
||||
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(matchersUtil),
|
||||
it('supports custom equality testers', function() {
|
||||
var customEqualityTesters = [
|
||||
function() {
|
||||
return true;
|
||||
}
|
||||
],
|
||||
matchersUtil = new jasmineUnderTest.MatchersUtil({
|
||||
customTesters: customEqualityTesters
|
||||
}),
|
||||
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(
|
||||
matchersUtil
|
||||
),
|
||||
calledSpy = new jasmineUnderTest.Spy('called-spy'),
|
||||
result;
|
||||
|
||||
@@ -27,7 +36,7 @@ describe("toHaveBeenCalledOnceWith", function () {
|
||||
expect(result.pass).toBe(true);
|
||||
});
|
||||
|
||||
it("fails when the actual was never called", function () {
|
||||
it('fails when the actual was never called', function() {
|
||||
var pp = jasmineUnderTest.makePrettyPrinter(),
|
||||
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
|
||||
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
|
||||
@@ -37,10 +46,12 @@ describe("toHaveBeenCalledOnceWith", function () {
|
||||
result = matcher.compare(calledSpy, 'a', 'b');
|
||||
|
||||
expect(result.pass).toBe(false);
|
||||
expect(result.message).toEqual("Expected spy called-spy to have been called only once, and with given args:\n [ 'a', 'b' ]\nBut it was never called.\n\n");
|
||||
expect(result.message).toEqual(
|
||||
"Expected spy called-spy to have been called only once, and with given args:\n [ 'a', 'b' ]\nBut it was never called.\n\n"
|
||||
);
|
||||
});
|
||||
|
||||
it("fails when the actual was called once with different parameters", function () {
|
||||
it('fails when the actual was called once with different parameters', function() {
|
||||
var pp = jasmineUnderTest.makePrettyPrinter(),
|
||||
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
|
||||
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
|
||||
@@ -51,10 +62,12 @@ describe("toHaveBeenCalledOnceWith", function () {
|
||||
result = matcher.compare(calledSpy, 'a', 'b');
|
||||
|
||||
expect(result.pass).toBe(false);
|
||||
expect(result.message).toEqual("Expected spy called-spy to have been called only once, and with given args:\n [ 'a', 'b' ]\nBut the actual call was:\n [ 'a', 'c' ].\nExpected $[1] = 'c' to equal 'b'.\n\n");
|
||||
expect(result.message).toEqual(
|
||||
"Expected spy called-spy to have been called only once, and with given args:\n [ 'a', 'b' ]\nBut the actual call was:\n [ 'a', 'c' ].\nExpected $[1] = 'c' to equal 'b'.\n\n"
|
||||
);
|
||||
});
|
||||
|
||||
it("fails when the actual was called multiple times with expected parameters", function () {
|
||||
it('fails when the actual was called multiple times with expected parameters', function() {
|
||||
var pp = jasmineUnderTest.makePrettyPrinter(),
|
||||
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
|
||||
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
|
||||
@@ -66,10 +79,12 @@ describe("toHaveBeenCalledOnceWith", function () {
|
||||
result = matcher.compare(calledSpy, 'a', 'b');
|
||||
|
||||
expect(result.pass).toBe(false);
|
||||
expect(result.message).toEqual("Expected spy called-spy to have been called only once, and with given args:\n [ 'a', 'b' ]\nBut the actual calls were:\n [ 'a', 'b' ],\n [ 'a', 'b' ].\n\n");
|
||||
expect(result.message).toEqual(
|
||||
"Expected spy called-spy to have been called only once, and with given args:\n [ 'a', 'b' ]\nBut the actual calls were:\n [ 'a', 'b' ],\n [ 'a', 'b' ].\n\n"
|
||||
);
|
||||
});
|
||||
|
||||
it("fails when the actual was called multiple times (one of them - with expected parameters)", function () {
|
||||
it('fails when the actual was called multiple times (one of them - with expected parameters)', function() {
|
||||
var pp = jasmineUnderTest.makePrettyPrinter(),
|
||||
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
|
||||
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
|
||||
@@ -81,15 +96,19 @@ describe("toHaveBeenCalledOnceWith", function () {
|
||||
result = matcher.compare(calledSpy, 'a', 'b');
|
||||
|
||||
expect(result.pass).toBe(false);
|
||||
expect(result.message).toEqual("Expected spy called-spy to have been called only once, and with given args:\n [ 'a', 'b' ]\nBut the actual calls were:\n [ 'a', 'b' ],\n [ 'a', 'c' ].\n\n");
|
||||
expect(result.message).toEqual(
|
||||
"Expected spy called-spy to have been called only once, and with given args:\n [ 'a', 'b' ]\nBut the actual calls were:\n [ 'a', 'b' ],\n [ 'a', 'c' ].\n\n"
|
||||
);
|
||||
});
|
||||
|
||||
it("throws an exception when the actual is not a spy", function () {
|
||||
it('throws an exception when the actual is not a spy', function() {
|
||||
var pp = jasmineUnderTest.makePrettyPrinter(),
|
||||
util = new jasmineUnderTest.MatchersUtil({ pp: pp }),
|
||||
matcher = jasmineUnderTest.matchers.toHaveBeenCalledOnceWith(util),
|
||||
fn = function () { };
|
||||
fn = function() {};
|
||||
|
||||
expect(function () { matcher.compare(fn) }).toThrowError(/Expected a spy, but got Function./);
|
||||
expect(function() {
|
||||
matcher.compare(fn);
|
||||
}).toThrowError(/Expected a spy, but got Function./);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user