Fix uncaught promise warnings
This commit is contained in:
parent
15b83167b2
commit
97bf833746
@ -41,7 +41,7 @@ describe('Ajax tests', () => {
|
|||||||
|
|
||||||
it('should make POST request', () => {
|
it('should make POST request', () => {
|
||||||
// when
|
// when
|
||||||
uAjax.post(url);
|
uAjax.post(url).catch(() => { /* ignore */ });
|
||||||
// then
|
// then
|
||||||
expect(XMLHttpRequest.prototype.setRequestHeader).toHaveBeenCalledWith('Content-type', 'application/x-www-form-urlencoded');
|
expect(XMLHttpRequest.prototype.setRequestHeader).toHaveBeenCalledWith('Content-type', 'application/x-www-form-urlencoded');
|
||||||
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('POST', url, true);
|
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('POST', url, true);
|
||||||
@ -49,7 +49,7 @@ describe('Ajax tests', () => {
|
|||||||
|
|
||||||
it('should make GET request', () => {
|
it('should make GET request', () => {
|
||||||
// when
|
// when
|
||||||
uAjax.get(url);
|
uAjax.get(url).catch(() => { /* ignore */ });
|
||||||
// then
|
// then
|
||||||
expect(XMLHttpRequest.prototype.setRequestHeader).not.toHaveBeenCalled();
|
expect(XMLHttpRequest.prototype.setRequestHeader).not.toHaveBeenCalled();
|
||||||
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('GET', url, true);
|
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('GET', url, true);
|
||||||
@ -57,7 +57,7 @@ describe('Ajax tests', () => {
|
|||||||
|
|
||||||
it('should make GET request with parameters', () => {
|
it('should make GET request with parameters', () => {
|
||||||
// when
|
// when
|
||||||
uAjax.get(url, { p1: 1, p2: 'test' });
|
uAjax.get(url, { p1: 1, p2: 'test' }).catch(() => { /* ignore */ });
|
||||||
// then
|
// then
|
||||||
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('GET', `${url}?p1=1&p2=test`, true);
|
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('GET', `${url}?p1=1&p2=test`, true);
|
||||||
expect(XMLHttpRequest.prototype.send).toHaveBeenCalledWith(null);
|
expect(XMLHttpRequest.prototype.send).toHaveBeenCalledWith(null);
|
||||||
@ -65,7 +65,7 @@ describe('Ajax tests', () => {
|
|||||||
|
|
||||||
it('should make POST request with parameters', () => {
|
it('should make POST request with parameters', () => {
|
||||||
// when
|
// when
|
||||||
uAjax.post(url, { p1: 1, p2: 'test' });
|
uAjax.post(url, { p1: 1, p2: 'test' }).catch(() => { /* ignore */ });
|
||||||
// then
|
// then
|
||||||
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('POST', url, true);
|
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('POST', url, true);
|
||||||
expect(XMLHttpRequest.prototype.send).toHaveBeenCalledWith('p1=1&p2=test');
|
expect(XMLHttpRequest.prototype.send).toHaveBeenCalledWith('p1=1&p2=test');
|
||||||
@ -73,7 +73,7 @@ describe('Ajax tests', () => {
|
|||||||
|
|
||||||
it('should make POST request with form data', () => {
|
it('should make POST request with form data', () => {
|
||||||
// when
|
// when
|
||||||
uAjax.post(url, form);
|
uAjax.post(url, form).catch(() => { /* ignore */ });
|
||||||
// then
|
// then
|
||||||
expect(XMLHttpRequest.prototype.setRequestHeader).not.toHaveBeenCalled();
|
expect(XMLHttpRequest.prototype.setRequestHeader).not.toHaveBeenCalled();
|
||||||
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('POST', url, true);
|
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('POST', url, true);
|
||||||
@ -82,7 +82,7 @@ describe('Ajax tests', () => {
|
|||||||
|
|
||||||
it('should make GET request with form data', () => {
|
it('should make GET request with form data', () => {
|
||||||
// when
|
// when
|
||||||
uAjax.get(url, form);
|
uAjax.get(url, form).catch(() => { /* ignore */ });
|
||||||
// then
|
// then
|
||||||
expect(XMLHttpRequest.prototype.setRequestHeader).not.toHaveBeenCalled();
|
expect(XMLHttpRequest.prototype.setRequestHeader).not.toHaveBeenCalled();
|
||||||
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('GET', `${url}?p1=test`, true);
|
expect(XMLHttpRequest.prototype.open).toHaveBeenCalledWith('GET', `${url}?p1=test`, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user