From 44d0e597a8b9aadc00da16d6cbcdfd4ac9df7275 Mon Sep 17 00:00:00 2001 From: Dustin Farris Date: Mon, 23 Jan 2017 12:48:08 -0500 Subject: [PATCH 1/2] fix(test): do not wait for responses that have an error --- test-support/helpers/cashay.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-support/helpers/cashay.js b/test-support/helpers/cashay.js index fbcbb90..d9ebf7e 100644 --- a/test-support/helpers/cashay.js +++ b/test-support/helpers/cashay.js @@ -30,7 +30,7 @@ export const waitForSubscriptions = function() { // will have to manually check cachedSubscriptions // response could be undefined if it was flushed - if (!response || response.status !== "loading") { + if (!response || response.status !== "loading" || response.error) { return false; } else { // Taking the first field, hopefully the only one From 78f30810d14924c32dffff394353c4f0d1cbec4a Mon Sep 17 00:00:00 2001 From: Dustin Farris Date: Mon, 23 Jan 2017 13:16:28 -0500 Subject: [PATCH 2/2] fix(test): lookup cached subscription by key --- test-support/helpers/cashay.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test-support/helpers/cashay.js b/test-support/helpers/cashay.js index d9ebf7e..42eafbb 100644 --- a/test-support/helpers/cashay.js +++ b/test-support/helpers/cashay.js @@ -37,7 +37,8 @@ export const waitForSubscriptions = function() { let fieldName = Object.keys(response.data)[0]; let field = response.data[fieldName]; - let cachedSubscription = cashay.cachedSubscriptions[`${fieldName}::${field.id}`]; + let subscriptionKey = key ? `${fieldName}::${key}` : fieldName; + let cachedSubscription = cashay.cachedSubscriptions[subscriptionKey]; if (cachedSubscription && cachedSubscription.status === "ready") { // This is just a live query, we do not need to hold anything up