From 09a09949f8b3f9c5253f7dff90787ffc04919052 Mon Sep 17 00:00:00 2001 From: Peter Haight Date: Tue, 30 Dec 2014 15:09:41 -0800 Subject: [PATCH] Fixed mispelling: comparitor -> comparator. It's nicer to have things spelled correctly. --- ...JsonComparitor.js => crmJsonComparator.js} | 12 +++---- tests/karma/unit/crmCaseTypeSpec.js | 6 ++-- ...JsonComparitor.js => crmJsonComparator.js} | 32 +++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-) rename tests/karma/lib/{crmJsonComparitor.js => crmJsonComparator.js} (91%) rename tests/karma/unit/{crmJsonComparitor.js => crmJsonComparator.js} (69%) diff --git a/tests/karma/lib/crmJsonComparitor.js b/tests/karma/lib/crmJsonComparator.js similarity index 91% rename from tests/karma/lib/crmJsonComparitor.js rename to tests/karma/lib/crmJsonComparator.js index 44a3207037..070ada2eec 100644 --- a/tests/karma/lib/crmJsonComparitor.js +++ b/tests/karma/lib/crmJsonComparator.js @@ -1,8 +1,8 @@ 'use strict'; (function(root) { - var Comparitor = function() {}; - Comparitor.prototype = { + var Comparator = function() {}; + Comparator.prototype = { compare: function(actual, expected) { this.result = { 'pass': true, @@ -74,16 +74,16 @@ return false; }, register: function(jasmine) { - var comparitor = this; + var comparator = this; jasmine.addMatchers({ toEqualData: function(expected) { return { - compare: $.proxy(comparitor.compare, comparitor) + compare: $.proxy(comparator.compare, comparator) } } }); } }; - var module = angular.module('crmJsonComparitor', []); - module.service('crmJsonComparitor', Comparitor); + var module = angular.module('crmJsonComparator', []); + module.service('crmJsonComparator', Comparator); })(angular); diff --git a/tests/karma/unit/crmCaseTypeSpec.js b/tests/karma/unit/crmCaseTypeSpec.js index ff826a4779..260a6e0dbb 100644 --- a/tests/karma/unit/crmCaseTypeSpec.js +++ b/tests/karma/unit/crmCaseTypeSpec.js @@ -10,9 +10,9 @@ describe('crmCaseType', function() { 'REL_TYPE_CNAME': 'label_b_a' }; module('crmCaseType'); - module('crmJsonComparitor'); - inject(function(crmJsonComparitor) { - crmJsonComparitor.register(jasmine); + module('crmJsonComparator'); + inject(function(crmJsonComparator) { + crmJsonComparator.register(jasmine); }); }); diff --git a/tests/karma/unit/crmJsonComparitor.js b/tests/karma/unit/crmJsonComparator.js similarity index 69% rename from tests/karma/unit/crmJsonComparitor.js rename to tests/karma/unit/crmJsonComparator.js index 653a34b65a..8380ba7951 100644 --- a/tests/karma/unit/crmJsonComparitor.js +++ b/tests/karma/unit/crmJsonComparator.js @@ -1,74 +1,74 @@ 'use strict'; -describe('crmJsonComparitor', function() { - var comparitor; +describe('crmJsonComparator', function() { + var comparator; beforeEach(function() { - module('crmJsonComparitor'); + module('crmJsonComparator'); }); beforeEach(function() { - inject(function(crmJsonComparitor) { - comparitor = crmJsonComparitor; + inject(function(crmJsonComparator) { + comparator = crmJsonComparator; }); }); it('should return false when comparing different objects', function() { - var result = comparitor.compare({'foo': 'bar'}, {'bar': 'foo'}); + var result = comparator.compare({'foo': 'bar'}, {'bar': 'foo'}); expect(result.pass).toBe(false); }); it('should return true when comparing equal objects', function() { - var result = comparitor.compare({'bar': 'foo'}, {'bar': 'foo'}); + var result = comparator.compare({'bar': 'foo'}, {'bar': 'foo'}); expect(result.pass).toBe(true); }); it('should explain what part of the comparison failed when comparing objects', function() { - var result = comparitor.compare({'foo': 'bar'}, {'bar': 'foo'}); + var result = comparator.compare({'foo': 'bar'}, {'bar': 'foo'}); expect(result.message).toBe('Could not find key \'bar\' in actual data at root.'); }); it('should handle nested objects', function() { - var result = comparitor.compare({'foo': {'bif': 'bam'}}, {'foo': {'bif': 'bam'}}); + var result = comparator.compare({'foo': {'bif': 'bam'}}, {'foo': {'bif': 'bam'}}); expect(result.pass).toBe(true); }); it('should handle differences in nested objects', function() { - var result = comparitor.compare({'foo': {'bif': 'bam'}}, {'foo': {'bif': 'bop'}}); + var result = comparator.compare({'foo': {'bif': 'bam'}}, {'foo': {'bif': 'bop'}}); expect(result.pass).toBe(false); expect(result.message).toBe("Expected 'bam' to be 'bop' at root[foo][bif]."); }); it('should handle arrays', function() { - var result = comparitor.compare([1, 2, 3, 4], [1, 2, 3, 4]); + var result = comparator.compare([1, 2, 3, 4], [1, 2, 3, 4]); expect(result.pass).toBe(true); }); it('should handle arrays with differences', function() { - var result = comparitor.compare([1, 2, 2, 4], [1, 2, 3, 4]); + var result = comparator.compare([1, 2, 2, 4], [1, 2, 3, 4]); expect(result.pass).toBe(false); expect(result.message).toBe("Expected '2' to be '3' at root[2]."); }); it('should handle nested arrays and objects', function() { - var result = comparitor.compare([1, 2, {'foo': 'bar'}, 4], [1, 2, {'foo': 'bar'}, 4]); + var result = comparator.compare([1, 2, {'foo': 'bar'}, 4], [1, 2, {'foo': 'bar'}, 4]); expect(result.pass).toBe(true); }); it('should handle nested arrays and objects with differences', function() { - var result = comparitor.compare([1, 2, {'foo': 'bar'}, 4], [1, 2, {'foo': 'bif'}, 4]); + var result = comparator.compare([1, 2, {'foo': 'bar'}, 4], [1, 2, {'foo': 'bif'}, 4]); expect(result.pass).toBe(false); expect(result.message).toBe("Expected 'bar' to be 'bif' at root[2][foo]."); }); it('should complain when comparing an object to an array', function() { - var result = comparitor.compare({'foo': 'bar'}, [1, 2, 3]); + var result = comparator.compare({'foo': 'bar'}, [1, 2, 3]); expect(result.pass).toBe(false); expect(result.message).toBe("The expected data has an array at root, but the actual data has something else ([object Object])"); }); it('should complain when comparing an array to an object', function() { - var result = comparitor.compare([1, 2, 3], {'foo': 'bar'}); + var result = comparator.compare([1, 2, 3], {'foo': 'bar'}); expect(result.pass).toBe(false); expect(result.message).toBe("The expected data has an object at root, but the actual data has something else (1,2,3)"); }); -- 2.25.1