Use const/let in specs, not var

This commit is contained in:
Steve Gravrock
2022-04-16 13:41:44 -07:00
parent 482dc883eb
commit 1166d10e43
111 changed files with 2522 additions and 2675 deletions

View File

@@ -1,12 +1,11 @@
describe('toHaveBeenCalled', function() {
it('passes when the actual was called, with a custom .not fail message', function() {
var matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
calledSpy = new jasmineUnderTest.Spy('called-spy'),
result;
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
calledSpy = new jasmineUnderTest.Spy('called-spy');
calledSpy();
result = matcher.compare(calledSpy);
const result = matcher.compare(calledSpy);
expect(result.pass).toBe(true);
expect(result.message).toEqual(
'Expected spy called-spy not to have been called.'
@@ -14,16 +13,15 @@ describe('toHaveBeenCalled', function() {
});
it('fails when the actual was not called', function() {
var matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
uncalledSpy = new jasmineUnderTest.Spy('uncalled spy'),
result;
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
uncalledSpy = new jasmineUnderTest.Spy('uncalled spy');
result = matcher.compare(uncalledSpy);
const result = matcher.compare(uncalledSpy);
expect(result.pass).toBe(false);
});
it('throws an exception when the actual is not a spy', function() {
var matcher = jasmineUnderTest.matchers.toHaveBeenCalled({
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled({
pp: jasmineUnderTest.makePrettyPrinter()
}),
fn = function() {};
@@ -34,7 +32,7 @@ describe('toHaveBeenCalled', function() {
});
it('throws an exception when invoked with any arguments', function() {
var matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
spy = new jasmineUnderTest.Spy('sample spy');
expect(function() {
@@ -43,11 +41,10 @@ describe('toHaveBeenCalled', function() {
});
it('has a custom message on failure', function() {
var matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
spy = new jasmineUnderTest.Spy('sample-spy'),
result;
const matcher = jasmineUnderTest.matchers.toHaveBeenCalled(),
spy = new jasmineUnderTest.Spy('sample-spy');
result = matcher.compare(spy);
const result = matcher.compare(spy);
expect(result.message).toEqual(
'Expected spy sample-spy to have been called.'