From ed78f0d830b22eb8f280e841cde6287b678fc914 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 15 Dec 2011 01:10:09 -0800 Subject: chore(log): generic test log service with custom toEquals matcher - any test that needs a logger can just inject provideLog - logger has susict api that makes tests more readable - custom toEquals matcher allows for pretty expectations --- test/matchers.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/matchers.js') diff --git a/test/matchers.js b/test/matchers.js index 1e0ae92a..fd706d3c 100644 --- a/test/matchers.js +++ b/test/matchers.js @@ -36,6 +36,15 @@ beforeEach(function() { toBeDirty: cssMatcher('ng-dirty', 'ng-pristine'), toBePristine: cssMatcher('ng-pristine', 'ng-dirty'), + toEqual: function(expected) { + if (this.actual && this.actual.$$log) { + this.actual = (typeof expected === 'string') + ? this.actual.toString() + : this.actual.toArray(); + } + return jasmine.Matchers.prototype.toEqual.call(this, expected); + }, + toEqualData: function(expected) { return angular.equals(this.actual, expected); }, -- cgit v1.2.3