gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-backoffice] branch master updated: testing the react


From: gnunet
Subject: [GNUnet-SVN] [taler-backoffice] branch master updated: testing the reaction to a order id not found
Date: Wed, 10 Jan 2018 13:54:26 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository backoffice.

The following commit(s) were added to refs/heads/master by this push:
     new f5bca27  testing the reaction to a order id not found
f5bca27 is described below

commit f5bca274a91bc9eadb9e6c521fde723649eed405
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Jan 10 13:53:53 2018 +0100

    testing the reaction to a order id not found
---
 js/test/main.js | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/js/test/main.js b/js/test/main.js
index 2ded74e..e898210 100644
--- a/js/test/main.js
+++ b/js/test/main.js
@@ -13,6 +13,7 @@ ava.test.beforeEach(t => {
   // Global 'document' mock
   global.document = {};
   global.document.addEventListener = function(){};
+  global.alert = console.log;
 
   // Load back-office code
   t.context.bo = require("../backoffice");
@@ -20,14 +21,22 @@ ava.test.beforeEach(t => {
 
 // Remove mocks from global scope
 ava.test.afterEach(t => {
+  // Is this done by the garbage collector anyway?
   delete global.XMLHttpRequest;
   delete global.document;
+  delete global.alert;
+  delete t.context.xhr;
+  delete t.context.requests;
 });
 
-ava.test("orders tracking", (t) => {
+ava.test("Order id not found", (t) => {
+  /**
+   * FIXME: improve the reaction to a order id not found.
+   * Alerting a message is not acceptable.
+   */
+  var alert = sinon.spy(global, "alert");
   t.context.bo.track_order(22);
-
-  // Clean up
-  t.context.xhr.restore();
+  t.context.requests[0].respond(404);
+  sinon.assert.calledWith(alert, "Order ID unknown");
   t.pass();
 });

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]