From 97bf8337460f17f3eba88095adac9eb9de4761c7 Mon Sep 17 00:00:00 2001
From: Bartek Fabiszewski <github@fabiszewski.net>
Date: Sat, 16 Nov 2019 19:42:07 +0100
Subject: [PATCH] Fix uncaught promise warnings

---
 js/test/ajax.test.js | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/js/test/ajax.test.js b/js/test/ajax.test.js
index 17f7450..f3e69bf 100644
--- a/js/test/ajax.test.js
+++ b/js/test/ajax.test.js
@@ -41,7 +41,7 @@ describe('Ajax tests', () => {
 
   it('should make POST request', () => {
     // when
-    uAjax.post(url);
+    uAjax.post(url).catch(() => { /* ignore */ });
     // then
     expect(XMLHttpRequest.prototype.setRequestHeader).toHaveBeenCalledWith('Content-type', 'application/x-www-form-urlencoded');
     expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('POST', url, true);
@@ -49,7 +49,7 @@ describe('Ajax tests', () => {
 
   it('should make GET request', () => {
     // when
-    uAjax.get(url);
+    uAjax.get(url).catch(() => { /* ignore */ });
     // then
     expect(XMLHttpRequest.prototype.setRequestHeader).not.toHaveBeenCalled();
     expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('GET', url, true);
@@ -57,7 +57,7 @@ describe('Ajax tests', () => {
 
   it('should make GET request with parameters', () => {
     // when
-    uAjax.get(url, { p1: 1, p2: 'test' });
+    uAjax.get(url, { p1: 1, p2: 'test' }).catch(() => { /* ignore */ });
     // then
     expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('GET', `${url}?p1=1&p2=test`, true);
     expect(XMLHttpRequest.prototype.send).toHaveBeenCalledWith(null);
@@ -65,7 +65,7 @@ describe('Ajax tests', () => {
 
   it('should make POST request with parameters', () => {
     // when
-    uAjax.post(url, { p1: 1, p2: 'test' });
+    uAjax.post(url, { p1: 1, p2: 'test' }).catch(() => { /* ignore */ });
     // then
     expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('POST', url, true);
     expect(XMLHttpRequest.prototype.send).toHaveBeenCalledWith('p1=1&p2=test');
@@ -73,7 +73,7 @@ describe('Ajax tests', () => {
 
   it('should make POST request with form data', () => {
     // when
-    uAjax.post(url, form);
+    uAjax.post(url, form).catch(() => { /* ignore */ });
     // then
     expect(XMLHttpRequest.prototype.setRequestHeader).not.toHaveBeenCalled();
     expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('POST', url, true);
@@ -82,7 +82,7 @@ describe('Ajax tests', () => {
 
   it('should make GET request with form data', () => {
     // when
-    uAjax.get(url, form);
+    uAjax.get(url, form).catch(() => { /* ignore */ });
     // then
     expect(XMLHttpRequest.prototype.setRequestHeader).not.toHaveBeenCalled();
     expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('GET', `${url}?p1=test`, true);