@@ -1,13 +1,13 @@
|
||||
describe('toHaveBeenCalledTimes', function() {
|
||||
it('passes when the actual 0 matches the expected 0 ', function() {
|
||||
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
calledSpy = new jasmineUnderTest.Spy('called-spy'),
|
||||
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
calledSpy = new privateUnderTest.Spy('called-spy'),
|
||||
result = matcher.compare(calledSpy, 0);
|
||||
expect(result.pass).toBeTruthy();
|
||||
});
|
||||
it('passes when the actual matches the expected', function() {
|
||||
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
calledSpy = new jasmineUnderTest.Spy('called-spy');
|
||||
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
calledSpy = new privateUnderTest.Spy('called-spy');
|
||||
calledSpy();
|
||||
|
||||
const result = matcher.compare(calledSpy, 1);
|
||||
@@ -15,8 +15,8 @@ describe('toHaveBeenCalledTimes', function() {
|
||||
});
|
||||
|
||||
it('fails when expected numbers is not supplied', function() {
|
||||
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
spy = new jasmineUnderTest.Spy('spy');
|
||||
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
spy = new privateUnderTest.Spy('spy');
|
||||
|
||||
spy();
|
||||
expect(function() {
|
||||
@@ -27,16 +27,16 @@ describe('toHaveBeenCalledTimes', function() {
|
||||
});
|
||||
|
||||
it('fails when the actual was called less than the expected', function() {
|
||||
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
uncalledSpy = new jasmineUnderTest.Spy('uncalled spy');
|
||||
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
uncalledSpy = new privateUnderTest.Spy('uncalled spy');
|
||||
|
||||
const result = matcher.compare(uncalledSpy, 2);
|
||||
expect(result.pass).toBe(false);
|
||||
});
|
||||
|
||||
it('fails when the actual was called more than expected', function() {
|
||||
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
uncalledSpy = new jasmineUnderTest.Spy('uncalled spy');
|
||||
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
uncalledSpy = new privateUnderTest.Spy('uncalled spy');
|
||||
|
||||
uncalledSpy();
|
||||
uncalledSpy();
|
||||
@@ -46,8 +46,8 @@ describe('toHaveBeenCalledTimes', function() {
|
||||
});
|
||||
|
||||
it('throws an exception when the actual is not a spy', function() {
|
||||
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes({
|
||||
pp: jasmineUnderTest.makePrettyPrinter()
|
||||
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes({
|
||||
pp: privateUnderTest.makePrettyPrinter()
|
||||
}),
|
||||
fn = function() {};
|
||||
|
||||
@@ -57,8 +57,8 @@ describe('toHaveBeenCalledTimes', function() {
|
||||
});
|
||||
|
||||
it('has a custom message on failure that tells it was called only once', function() {
|
||||
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
spy = new jasmineUnderTest.Spy('sample-spy');
|
||||
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
spy = new privateUnderTest.Spy('sample-spy');
|
||||
spy();
|
||||
spy();
|
||||
spy();
|
||||
@@ -73,8 +73,8 @@ describe('toHaveBeenCalledTimes', function() {
|
||||
});
|
||||
|
||||
it('has a custom message on failure that tells how many times it was called', function() {
|
||||
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
spy = new jasmineUnderTest.Spy('sample-spy');
|
||||
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
spy = new privateUnderTest.Spy('sample-spy');
|
||||
spy();
|
||||
spy();
|
||||
spy();
|
||||
@@ -89,8 +89,8 @@ describe('toHaveBeenCalledTimes', function() {
|
||||
});
|
||||
|
||||
it('set the correct calls as verified when passing', function() {
|
||||
const matcher = jasmineUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
spy = new jasmineUnderTest.Spy('sample-spy');
|
||||
const matcher = privateUnderTest.matchers.toHaveBeenCalledTimes(),
|
||||
spy = new privateUnderTest.Spy('sample-spy');
|
||||
|
||||
spy();
|
||||
spy();
|
||||
|
||||
Reference in New Issue
Block a user