mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed the issues for all the javascript files reported by the liner.
This commit is contained in:
@@ -12,16 +12,16 @@ define([
|
|||||||
'pgadmin.backform',
|
'pgadmin.backform',
|
||||||
], function ($, Backbone, Backform) {
|
], function ($, Backbone, Backform) {
|
||||||
describe('KeyboardshortcutControl', function () {
|
describe('KeyboardshortcutControl', function () {
|
||||||
let field, innerFields, control, model, event;
|
let field, innerFields, control, model;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
||||||
innerFields = [
|
innerFields = [
|
||||||
{'name': 'key', 'type': 'keyCode', 'label': 'Key'},
|
{'name': 'key', 'type': 'keyCode', 'label': 'Key'},
|
||||||
{'name': 'alt_option', 'type': 'checkbox',
|
{'name': 'alt_option', 'type': 'checkbox',
|
||||||
'label': 'Alt/Option'},
|
'label': 'Alt/Option'},
|
||||||
{'name': 'control', 'type': 'checkbox',
|
{'name': 'control', 'type': 'checkbox',
|
||||||
'label': 'Ctrl'},
|
'label': 'Ctrl'},
|
||||||
{'name': 'shift', 'type': 'checkbox', 'label': 'Shift'},
|
{'name': 'shift', 'type': 'checkbox', 'label': 'Shift'},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ define([
|
|||||||
'key': {
|
'key': {
|
||||||
'key_code': 65,
|
'key_code': 65,
|
||||||
'char': 'A',
|
'char': 'A',
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ define([
|
|||||||
|
|
||||||
model.set(field.get('name'),
|
model.set(field.get('name'),
|
||||||
$.extend(true, val, {
|
$.extend(true, val, {
|
||||||
'control': false
|
'control': false,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ define([
|
|||||||
|
|
||||||
model.set(field.get('name'),
|
model.set(field.get('name'),
|
||||||
$.extend(true, val, {
|
$.extend(true, val, {
|
||||||
'shift': true
|
'shift': true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ define([
|
|||||||
|
|
||||||
model.set(field.get('name'),
|
model.set(field.get('name'),
|
||||||
$.extend(true, val, {
|
$.extend(true, val, {
|
||||||
'alt_option': false
|
'alt_option': false,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -387,14 +387,14 @@ define([
|
|||||||
// this should change
|
// this should change
|
||||||
expect(control.$el.find('input:checkbox[name="alt_option"]')[0].checked).toBeFalsy();
|
expect(control.$el.find('input:checkbox[name="alt_option"]')[0].checked).toBeFalsy();
|
||||||
expect(model.get(field.get('name'))).toEqual({
|
expect(model.get(field.get('name'))).toEqual({
|
||||||
'control': true,
|
'control': true,
|
||||||
'shift': false,
|
'shift': false,
|
||||||
'alt_option': false,
|
'alt_option': false,
|
||||||
'key': {
|
'key': {
|
||||||
'key_code': 73,
|
'key_code': 73,
|
||||||
'char': 'I',
|
'char': 'I',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// below three should not change.
|
// below three should not change.
|
||||||
expect(control.$el.find('input:checkbox[name="shift"]')[0].checked).toBeFalsy();
|
expect(control.$el.find('input:checkbox[name="shift"]')[0].checked).toBeFalsy();
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ define([
|
|||||||
'key': {
|
'key': {
|
||||||
'key_code': 65,
|
'key_code': 65,
|
||||||
'char': 'A',
|
'char': 'A',
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
field = new Backform.Field({
|
field = new Backform.Field({
|
||||||
id: 'key',
|
id: 'key',
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
import $ from 'jquery'
|
import $ from 'jquery';
|
||||||
import modifyAnimation from 'sources/modify_animation'
|
import modifyAnimation from 'sources/modify_animation';
|
||||||
|
|
||||||
|
|
||||||
describe('modifyAnimation', function () {
|
describe('modifyAnimation', function () {
|
||||||
@@ -16,12 +16,12 @@ describe('modifyAnimation', function () {
|
|||||||
let dummyElement;
|
let dummyElement;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
pgBrowser = jasmine.createSpyObj('pgBrowser', ['get_preference', 'tree'])
|
pgBrowser = jasmine.createSpyObj('pgBrowser', ['get_preference', 'tree']);
|
||||||
pgBrowser.tree = jasmine.createSpyObj('tree', ['options']);
|
pgBrowser.tree = jasmine.createSpyObj('tree', ['options']);
|
||||||
pgBrowser.tree.options.and.returnValue({
|
pgBrowser.tree.options.and.returnValue({
|
||||||
show: {},
|
show: {},
|
||||||
hide: {},
|
hide: {},
|
||||||
view: {},
|
view: {},
|
||||||
});
|
});
|
||||||
dummyElement = document.createElement('link');
|
dummyElement = document.createElement('link');
|
||||||
spyOn($.fn, 'find').and.returnValue($(dummyElement));
|
spyOn($.fn, 'find').and.returnValue($(dummyElement));
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ describe('Server#ModelValidation', () => {
|
|||||||
expect(model.errorModel.set).toHaveBeenCalledWith({
|
expect(model.errorModel.set).toHaveBeenCalledWith({
|
||||||
host: 'Either Host name, Address or Service must be specified.',
|
host: 'Either Host name, Address or Service must be specified.',
|
||||||
hostaddr: 'Either Host name, Address or Service must be specified.',
|
hostaddr: 'Either Host name, Address or Service must be specified.',
|
||||||
db: 'Maintenance database must be specified.'
|
db: 'Maintenance database must be specified.',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -81,7 +81,7 @@ describe('Server#ModelValidation', () => {
|
|||||||
hostaddr: 'Either Host name, Address or Service must be specified.',
|
hostaddr: 'Either Host name, Address or Service must be specified.',
|
||||||
db: 'Maintenance database must be specified.',
|
db: 'Maintenance database must be specified.',
|
||||||
username: 'Username must be specified.',
|
username: 'Username must be specified.',
|
||||||
port: 'Port must be specified.'
|
port: 'Port must be specified.',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -96,7 +96,7 @@ describe('Server#ModelValidation', () => {
|
|||||||
hostaddr: 'Host address must be valid IPv4 or IPv6 address.',
|
hostaddr: 'Host address must be valid IPv4 or IPv6 address.',
|
||||||
db: 'Maintenance database must be specified.',
|
db: 'Maintenance database must be specified.',
|
||||||
username: 'Username must be specified.',
|
username: 'Username must be specified.',
|
||||||
port: 'Port must be specified.'
|
port: 'Port must be specified.',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -109,7 +109,7 @@ describe('Server#ModelValidation', () => {
|
|||||||
expect(model.errorModel.set).toHaveBeenCalledWith({
|
expect(model.errorModel.set).toHaveBeenCalledWith({
|
||||||
name: 'Name must be specified.',
|
name: 'Name must be specified.',
|
||||||
username: 'Username must be specified.',
|
username: 'Username must be specified.',
|
||||||
port: 'Port must be specified.'
|
port: 'Port must be specified.',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,18 +10,18 @@
|
|||||||
import keyboardShortcuts from 'sources/keyboard_shortcuts';
|
import keyboardShortcuts from 'sources/keyboard_shortcuts';
|
||||||
|
|
||||||
describe('the keyboard shortcuts', () => {
|
describe('the keyboard shortcuts', () => {
|
||||||
const F1_KEY = 112,
|
const F1_KEY = 112;
|
||||||
EDIT_KEY = 71, // Key: G -> Grid values
|
// const EDIT_KEY = 71; // Key: G -> Grid values
|
||||||
LEFT_ARROW_KEY = 37,
|
// const LEFT_ARROW_KEY = 37;
|
||||||
RIGHT_ARROW_KEY = 39,
|
// const RIGHT_ARROW_KEY = 39;
|
||||||
MOVE_NEXT = 'right';
|
// const MOVE_NEXT = 'right';
|
||||||
|
|
||||||
let debuggerElementSpy, event, debuggerUserShortcutSpy;
|
let debuggerElementSpy, event, debuggerUserShortcutSpy;
|
||||||
debuggerUserShortcutSpy = jasmine.createSpyObj(
|
debuggerUserShortcutSpy = jasmine.createSpyObj(
|
||||||
'userDefinedShortcuts', [
|
'userDefinedShortcuts', [
|
||||||
{ 'edit_grid_keys': null },
|
{ 'edit_grid_keys': null },
|
||||||
{ 'next_panel_keys': null },
|
{ 'next_panel_keys': null },
|
||||||
{ 'previous_panel_keys': null }
|
{ 'previous_panel_keys': null },
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ describe('debuggerUtils', function () {
|
|||||||
let tab_key = {
|
let tab_key = {
|
||||||
which: 9,
|
which: 9,
|
||||||
keyCode: 9,
|
keyCode: 9,
|
||||||
}
|
};
|
||||||
|
|
||||||
let enter_key = {
|
let enter_key = {
|
||||||
which: 13,
|
which: 13,
|
||||||
keyCode: 13,
|
keyCode: 13,
|
||||||
}
|
};
|
||||||
|
|
||||||
describe('debuggerUtils', function () {
|
describe('debuggerUtils', function () {
|
||||||
it('returns undefined if no command is passed', function () {
|
it('returns undefined if no command is passed', function () {
|
||||||
@@ -31,7 +31,7 @@ describe('debuggerUtils', function () {
|
|||||||
|
|
||||||
describe('debuggerUtils', function () {
|
describe('debuggerUtils', function () {
|
||||||
it('should call focus on editor', function () {
|
it('should call focus on editor', function () {
|
||||||
setFocusToDebuggerEditor(editor, enter_key)
|
setFocusToDebuggerEditor(editor, enter_key);
|
||||||
expect(editor.focus).toHaveBeenCalled();
|
expect(editor.focus).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import dialogTabNavigator from 'sources/dialog_tab_navigator';
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import 'bootstrap';
|
import 'bootstrap';
|
||||||
|
|
||||||
describe('dialogTabNavigator', function () {
|
describe('dialogTabNavigator', function () {
|
||||||
let dialog, tabNavigator, backward_shortcut, forward_shortcut;
|
let dialog, tabNavigator, backward_shortcut, forward_shortcut;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
let dialogHtml =$('<div tabindex="1" class="backform-tab" role="tabpanel">'+
|
let dialogHtml =$('<div tabindex="1" class="backform-tab" role="tabpanel">'+
|
||||||
' <ul class="nav nav-tabs" role="tablist">'+
|
' <ul class="nav nav-tabs" role="tablist">'+
|
||||||
' <li role="presentation" class="active">'+
|
' <li role="presentation" class="active">'+
|
||||||
' <a data-toggle="tab" tabindex="-1" data-tab-index="1" href="#1" aria-controls="1"> General</a>'+
|
' <a data-toggle="tab" tabindex="-1" data-tab-index="1" href="#1" aria-controls="1"> General</a>'+
|
||||||
@@ -52,64 +52,64 @@ import 'bootstrap';
|
|||||||
' </ul>'+
|
' </ul>'+
|
||||||
'</div>');
|
'</div>');
|
||||||
|
|
||||||
dialog = {};
|
dialog = {};
|
||||||
|
|
||||||
dialog.el = dialogHtml[0];
|
dialog.el = dialogHtml[0];
|
||||||
dialog.$el = dialogHtml;
|
dialog.$el = dialogHtml;
|
||||||
|
|
||||||
backward_shortcut = {
|
backward_shortcut = {
|
||||||
'alt': false,
|
'alt': false,
|
||||||
'shift': true,
|
'shift': true,
|
||||||
'control': true,
|
'control': true,
|
||||||
'key': {'key_code': 91, 'char': '['}
|
'key': {'key_code': 91, 'char': '['},
|
||||||
};
|
};
|
||||||
|
|
||||||
forward_shortcut = {
|
forward_shortcut = {
|
||||||
'alt': false,
|
'alt': false,
|
||||||
'shift': true,
|
'shift': true,
|
||||||
'control': true,
|
'control': true,
|
||||||
'key': {'key_code': 93, 'char': ']'}
|
'key': {'key_code': 93, 'char': ']'},
|
||||||
};
|
};
|
||||||
|
|
||||||
tabNavigator = new dialogTabNavigator.dialogTabNavigator(
|
tabNavigator = new dialogTabNavigator.dialogTabNavigator(
|
||||||
dialog, backward_shortcut, forward_shortcut);
|
dialog, backward_shortcut, forward_shortcut);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('navigate', function () {
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
spyOn(tabNavigator, 'navigateBackward').and.callThrough();
|
||||||
|
|
||||||
|
spyOn(tabNavigator, 'navigateForward').and.callThrough();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('navigate', function () {
|
it('navigate backward', function () {
|
||||||
|
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+[');
|
||||||
|
|
||||||
beforeEach(() => {
|
expect(tabNavigator.navigateBackward).toHaveBeenCalled();
|
||||||
spyOn(tabNavigator, 'navigateBackward').and.callThrough();
|
|
||||||
|
|
||||||
spyOn(tabNavigator, 'navigateForward').and.callThrough();
|
expect(tabNavigator.navigateForward).not.toHaveBeenCalled();
|
||||||
});
|
|
||||||
|
|
||||||
it('navigate backward', function () {
|
});
|
||||||
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+[');
|
|
||||||
|
|
||||||
expect(tabNavigator.navigateBackward).toHaveBeenCalled();
|
it('navigate forward', function () {
|
||||||
|
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+]');
|
||||||
|
|
||||||
expect(tabNavigator.navigateForward).not.toHaveBeenCalled();
|
expect(tabNavigator.navigateForward).toHaveBeenCalled();
|
||||||
|
|
||||||
});
|
expect(tabNavigator.navigateBackward).not.toHaveBeenCalled();
|
||||||
|
|
||||||
it('navigate forward', function () {
|
});
|
||||||
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+]');
|
|
||||||
|
|
||||||
expect(tabNavigator.navigateForward).toHaveBeenCalled();
|
it('should not navigate', function () {
|
||||||
|
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+a');
|
||||||
|
|
||||||
expect(tabNavigator.navigateBackward).not.toHaveBeenCalled();
|
expect(tabNavigator.navigateForward).not.toHaveBeenCalled();
|
||||||
|
|
||||||
});
|
expect(tabNavigator.navigateBackward).not.toHaveBeenCalled();
|
||||||
|
|
||||||
it('should not navigate', function () {
|
|
||||||
tabNavigator.onKeyboardEvent({}, 'shift+ctrl+a');
|
|
||||||
|
|
||||||
expect(tabNavigator.navigateForward).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
expect(tabNavigator.navigateBackward).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@@ -11,6 +11,6 @@ define(function () {
|
|||||||
return {
|
return {
|
||||||
'static': '/base/pgadmin/static/<path:filename>',
|
'static': '/base/pgadmin/static/<path:filename>',
|
||||||
'sqleditor.poll': '/sqleditor/query_tool/poll/<path:trans_id>',
|
'sqleditor.poll': '/sqleditor/query_tool/poll/<path:trans_id>',
|
||||||
'sqleditor.query_tool_start': '/sqleditor/query_tool/start/<path:trans_id>'
|
'sqleditor.query_tool_start': '/sqleditor/query_tool/start/<path:trans_id>',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
import {nodeHasStatistics} from "../../../../pgadmin/static/js/misc/statistics/statistics";
|
import {nodeHasStatistics} from '../../../../pgadmin/static/js/misc/statistics/statistics';
|
||||||
|
|
||||||
describe('#nodeHasStatistics', () => {
|
describe('#nodeHasStatistics', () => {
|
||||||
describe('when node hasStatistics is not a function', () => {
|
describe('when node hasStatistics is not a function', () => {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe('#calculateQueryRunTime', () => {
|
|||||||
minutes:30,
|
minutes:30,
|
||||||
seconds:21,
|
seconds:21,
|
||||||
milliseconds:70}).toDate();
|
milliseconds:70}).toDate();
|
||||||
expect(calculateQueryRunTime(startDate, endDate))
|
expect(calculateQueryRunTime(startDate, endDate))
|
||||||
.toEqual('947 msec');
|
.toEqual('947 msec');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -52,7 +52,7 @@ describe('#calculateQueryRunTime', () => {
|
|||||||
minutes:31,
|
minutes:31,
|
||||||
seconds:15,
|
seconds:15,
|
||||||
milliseconds:70}).toDate();
|
milliseconds:70}).toDate();
|
||||||
expect(calculateQueryRunTime(startDate, endDate))
|
expect(calculateQueryRunTime(startDate, endDate))
|
||||||
.toEqual('54 secs 947 msec');
|
.toEqual('54 secs 947 msec');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -75,7 +75,7 @@ describe('#calculateQueryRunTime', () => {
|
|||||||
minutes:40,
|
minutes:40,
|
||||||
seconds:15,
|
seconds:15,
|
||||||
milliseconds:70}).toDate();
|
milliseconds:70}).toDate();
|
||||||
expect(calculateQueryRunTime(startDate, endDate))
|
expect(calculateQueryRunTime(startDate, endDate))
|
||||||
.toEqual('9 min 54 secs');
|
.toEqual('9 min 54 secs');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,18 +7,17 @@
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
import filterDialog from 'sources/sqleditor/filter_dialog';
|
import filterDialog from 'sources/sqleditor/filter_dialog';
|
||||||
import filterDialogModel from 'sources/sqleditor/filter_dialog_model';
|
// import filterDialogModel from 'sources/sqleditor/filter_dialog_model';
|
||||||
|
|
||||||
describe('filterDialog', () => {
|
describe('filterDialog', () => {
|
||||||
let sqlEditorController;
|
jasmine.createSpy('sqlEditorController');
|
||||||
sqlEditorController = jasmine.createSpy('sqlEditorController')
|
|
||||||
describe('filterDialog', () => {
|
describe('filterDialog', () => {
|
||||||
describe('when using filter dialog', () => {
|
describe('when using filter dialog', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOn(filterDialog, 'dialog');
|
spyOn(filterDialog, 'dialog');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("it should be defined as function", function() {
|
it('it should be defined as function', function() {
|
||||||
expect(filterDialog.dialog).toBeDefined();
|
expect(filterDialog.dialog).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -35,48 +35,48 @@ describe('the keyboard shortcuts', () => {
|
|||||||
shift: false,
|
shift: false,
|
||||||
control: false,
|
control: false,
|
||||||
key: {
|
key: {
|
||||||
key_code: F5_KEY
|
key_code: F5_KEY,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
explain: {
|
explain: {
|
||||||
alt: false,
|
alt: false,
|
||||||
shift: false,
|
shift: false,
|
||||||
control: false,
|
control: false,
|
||||||
key: {
|
key: {
|
||||||
key_code: F7_KEY
|
key_code: F7_KEY,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
explain_analyze: {
|
explain_analyze: {
|
||||||
alt: false,
|
alt: false,
|
||||||
shift: true,
|
shift: true,
|
||||||
control: false,
|
control: false,
|
||||||
key: {
|
key: {
|
||||||
key_code: F7_KEY
|
key_code: F7_KEY,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
download_csv: {
|
download_csv: {
|
||||||
alt: false,
|
alt: false,
|
||||||
shift: false,
|
shift: false,
|
||||||
control: false,
|
control: false,
|
||||||
key: {
|
key: {
|
||||||
key_code: F8_KEY
|
key_code: F8_KEY,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
move_next: {
|
move_next: {
|
||||||
alt: false,
|
alt: false,
|
||||||
shift: false,
|
shift: false,
|
||||||
control: false,
|
control: false,
|
||||||
key: {
|
key: {
|
||||||
key_code: null
|
key_code: null,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
move_previous: {
|
move_previous: {
|
||||||
alt: false,
|
alt: false,
|
||||||
shift: false,
|
shift: false,
|
||||||
control: false,
|
control: false,
|
||||||
key: {
|
key: {
|
||||||
key_code: null
|
key_code: null,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
httpResponseRequiresNewTransaction,
|
httpResponseRequiresNewTransaction,
|
||||||
handleQueryToolAjaxError
|
handleQueryToolAjaxError,
|
||||||
} from '../../../pgadmin/static/js/sqleditor/query_tool_http_error_handler';
|
} from '../../../pgadmin/static/js/sqleditor/query_tool_http_error_handler';
|
||||||
|
|
||||||
describe('#httpResponseRequiresNewTransaction', () => {
|
describe('#httpResponseRequiresNewTransaction', () => {
|
||||||
@@ -71,29 +71,29 @@ describe('#httpResponseRequiresNewTransaction', () => {
|
|||||||
describe('#handleQueryToolAjaxError', () => {
|
describe('#handleQueryToolAjaxError', () => {
|
||||||
let sqlEditorHandler,
|
let sqlEditorHandler,
|
||||||
exceptionSpy, stateToSave,
|
exceptionSpy, stateToSave,
|
||||||
stateParameters, checkTransaction, UserManagementMock,
|
stateParameters, checkTransaction,
|
||||||
pgBrowserMock;
|
pgBrowserMock;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
stateToSave = 'testState';
|
stateToSave = 'testState';
|
||||||
stateParameters = [];
|
stateParameters = [];
|
||||||
checkTransaction = false;
|
checkTransaction = false;
|
||||||
sqlEditorHandler = jasmine.createSpyObj(
|
sqlEditorHandler = jasmine.createSpyObj(
|
||||||
'handler', ['initTransaction', 'saveState', 'handle_connection_lost']
|
'handler', ['initTransaction', 'saveState', 'handle_connection_lost']
|
||||||
);
|
);
|
||||||
exceptionSpy = {
|
exceptionSpy = {
|
||||||
readyState: 0,
|
readyState: 0,
|
||||||
status: 404,
|
status: 404,
|
||||||
data: {
|
data: {
|
||||||
info: 'CONNECTION_LOST',
|
info: 'CONNECTION_LOST',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
pgBrowserMock = {
|
pgBrowserMock = {
|
||||||
'Browser': {
|
'Browser': {
|
||||||
'UserManagement': jasmine.createSpyObj('UserManagement', ['isPgaLoginRequired', 'pgaLogin'])
|
'UserManagement': jasmine.createSpyObj('UserManagement', ['isPgaLoginRequired', 'pgaLogin']),
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when ready state is 0', () => {
|
describe('when ready state is 0', () => {
|
||||||
it('should return connection', () => {
|
it('should return connection', () => {
|
||||||
@@ -149,7 +149,7 @@ describe('#handleQueryToolAjaxError', () => {
|
|||||||
exceptionSpy.readyState = 1;
|
exceptionSpy.readyState = 1;
|
||||||
exceptionSpy.status = 503;
|
exceptionSpy.status = 503;
|
||||||
exceptionSpy.responseJSON = {
|
exceptionSpy.responseJSON = {
|
||||||
'info': 'CONNECTION_LOST'
|
'info': 'CONNECTION_LOST',
|
||||||
};
|
};
|
||||||
pgBrowserMock.Browser.UserManagement.isPgaLoginRequired.and.returnValue(false);
|
pgBrowserMock.Browser.UserManagement.isPgaLoginRequired.and.returnValue(false);
|
||||||
checkTransaction = false;
|
checkTransaction = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user