From 3d57be4858dcdf812556766bde11c3eeaa60d1cb Mon Sep 17 00:00:00 2001 From: Alan Kligman Date: Wed, 19 Feb 2014 12:53:05 -0500 Subject: [PATCH] Fixes #116. --- tests/lib/test-utils.js | 20 +++++++++++++++++++- tests/spec/adapters/adapters.general.spec.js | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/lib/test-utils.js b/tests/lib/test-utils.js index 46984c0..666a2f2 100644 --- a/tests/lib/test-utils.js +++ b/tests/lib/test-utils.js @@ -79,6 +79,23 @@ function(Filer, IndexedDBTestProvider, WebSQLTestProvider, MemoryTestProvider) { }); } + function typedArrayEqual(a, b) { + if(!(a && b)) { + return false; + } + if(a.length !== b.length) { + return false; + } + + for(var i = 0; i < a.length; ++ i) { + if(a[i] !== b[i]) { + return false; + } + } + + return true; + } + return { uniqueName: uniqueName, setup: setup, @@ -89,7 +106,8 @@ function(Filer, IndexedDBTestProvider, WebSQLTestProvider, MemoryTestProvider) { WebSQL: WebSQLTestProvider, Memory: MemoryTestProvider }, - cleanup: cleanup + cleanup: cleanup, + typedArrayEqual: typedArrayEqual }; }); diff --git a/tests/spec/adapters/adapters.general.spec.js b/tests/spec/adapters/adapters.general.spec.js index 497d7fb..709b53a 100644 --- a/tests/spec/adapters/adapters.general.spec.js +++ b/tests/spec/adapters/adapters.general.spec.js @@ -67,7 +67,7 @@ define(["Filer", "util"], function(Filer, util) { context.get("key", function(error, result) { expect(error).not.to.exist; - expect(result).to.deep.equal(valueBuffer); + expect(util.typedArrayEqual(result, valueBuffer)).to.be.true; done(); }); });