Skip to content

Commit f10502f

Browse files
authored
chore: remove unnecessary global name to spy on console (#2443)
1 parent 17ba2a4 commit f10502f

12 files changed

Lines changed: 19 additions & 19 deletions

File tree

frameworks/angular-slickgrid/src/library/components/__tests__/angular-slickgrid.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
864864
});
865865

866866
it('should display a console warning when any of the column definition ids include a dot notation', () => {
867-
const consoleSpy = vi.spyOn(global.console, 'warn').mockReturnValue();
867+
const consoleSpy = vi.spyOn(console, 'warn').mockReturnValue();
868868
const mockColDefs = [{ id: 'user.gender', field: 'user.gender', editor: { model: Editors.text, collection: ['male', 'female'] } }] as Column[];
869869

870870
component.columns = mockColDefs;

packages/common/src/core/__tests__/slickGrid.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('SlickGrid core file', () => {
130130
});
131131

132132
it('should display a console warning when body zoom level is different than 100%', () => {
133-
const consoleWarnSpy = vi.spyOn(global.console, 'warn').mockReturnValue();
133+
const consoleWarnSpy = vi.spyOn(console, 'warn').mockReturnValue();
134134

135135
document.body.style.zoom = '90%';
136136
const columns = [{ id: 'firstName', field: 'firstName', name: 'First Name' }] as Column[];
@@ -142,7 +142,7 @@ describe('SlickGrid core file', () => {
142142
});
143143

144144
it('should not display a console warning when body zoom level is 100%', () => {
145-
const consoleWarnSpy = vi.spyOn(global.console, 'warn').mockReturnValue();
145+
const consoleWarnSpy = vi.spyOn(console, 'warn').mockReturnValue();
146146

147147
document.body.style.zoom = '100%';
148148
const columns = [{ id: 'firstName', field: 'firstName', name: 'First Name' }] as Column[];
@@ -154,7 +154,7 @@ describe('SlickGrid core file', () => {
154154
});
155155

156156
it('should not display a console warning when body zoom is not defined', () => {
157-
const consoleWarnSpy = vi.spyOn(global.console, 'warn').mockReturnValue();
157+
const consoleWarnSpy = vi.spyOn(console, 'warn').mockReturnValue();
158158

159159
document.body.style.zoom = '';
160160
const columns = [{ id: 'firstName', field: 'firstName', name: 'First Name' }] as Column[];
@@ -166,7 +166,7 @@ describe('SlickGrid core file', () => {
166166
});
167167

168168
it('should display a console warning when Row Detail is enabled with `rowTopOffsetRenderType` is set to "transfrom"', () => {
169-
const consoleWarnSpy = vi.spyOn(global.console, 'warn').mockReturnValue();
169+
const consoleWarnSpy = vi.spyOn(console, 'warn').mockReturnValue();
170170

171171
document.body.style.zoom = '90%';
172172
const columns = [{ id: 'firstName', field: 'firstName', name: 'First Name' }] as Column[];
@@ -186,7 +186,7 @@ describe('SlickGrid core file', () => {
186186
});
187187

188188
it('should display a console warning when RowSpan is enabled with `rowTopOffsetRenderType` is set to "transfrom"', () => {
189-
const consoleWarnSpy = vi.spyOn(global.console, 'warn').mockReturnValue();
189+
const consoleWarnSpy = vi.spyOn(console, 'warn').mockReturnValue();
190190

191191
document.body.style.zoom = '90%';
192192
const columns = [{ id: 'firstName', field: 'firstName', name: 'First Name' }] as Column[];
@@ -1499,7 +1499,7 @@ describe('SlickGrid core file', () => {
14991499
});
15001500

15011501
it('should define colspan and rowspan but get a warning when enableCellRowSpan is disabled', () => {
1502-
const consoleWarnSpy = vi.spyOn(global.console, 'warn').mockReturnValue();
1502+
const consoleWarnSpy = vi.spyOn(console, 'warn').mockReturnValue();
15031503
const columns = [
15041504
{ id: 'firstName', field: 'firstName', name: 'First Name' },
15051505
{ id: 'lastName', field: 'lastName', name: 'Last Name' },

packages/common/src/extensions/__tests__/slickGridMenu.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ describe('GridMenuControl', () => {
169169
let div;
170170

171171
describe('with I18N Service', () => {
172-
const consoleErrorSpy = vi.spyOn(global.console, 'error').mockReturnValue();
172+
const consoleErrorSpy = vi.spyOn(console, 'error').mockReturnValue();
173173
let parentContainer: HTMLDivElement;
174174

175175
beforeEach(() => {

packages/common/src/formatters/__tests__/currencyFormatter.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('the Currency Formatter', () => {
99
} as unknown as SlickGrid;
1010

1111
beforeEach(() => {
12-
vi.spyOn(global.console, 'warn').mockReturnValue();
12+
vi.spyOn(console, 'warn').mockReturnValue();
1313
});
1414

1515
it('should display an empty string when no value is provided', () => {

packages/common/src/formatters/__tests__/decimalFormatter.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('the Decimal Formatter', () => {
99
} as unknown as SlickGrid;
1010

1111
beforeEach(() => {
12-
vi.spyOn(global.console, 'warn').mockReturnValue();
12+
vi.spyOn(console, 'warn').mockReturnValue();
1313
});
1414

1515
it('should display an empty string when no value is provided', () => {

packages/common/src/services/__tests__/resizer.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ describe('Resizer Service', () => {
990990

991991
it('should try to resize grid when its UI is deemed broken but expect an error shown in the console when "resizeGrid" throws an error', () =>
992992
new Promise((done: any) => {
993-
const consoleSpy = vi.spyOn(global.console, 'log').mockReturnValue();
993+
const consoleSpy = vi.spyOn(console, 'log').mockReturnValue();
994994
const promise = new Promise((_resolve, reject) => setTimeout(() => reject('some error'), 0));
995995
vi.spyOn(service, 'resizeGrid').mockReturnValue(promise as any);
996996

packages/common/src/services/__tests__/utilities.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,7 @@ describe('Service/Utilies', () => {
14261426
});
14271427

14281428
it('should throw an error when Fetch Promise response bodyUsed is true', async () => {
1429-
const consoleSpy = vi.spyOn(global.console, 'warn').mockReturnValue();
1429+
const consoleSpy = vi.spyOn(console, 'warn').mockReturnValue();
14301430
const mockCollection = ['male', 'female'];
14311431
const collectionAsync = basicFetchStub('http://invalid-url', { method: 'GET' }, mockCollection);
14321432

packages/composite-editor-component/src/slick-composite-editor.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ describe('CompositeEditorService', () => {
295295
});
296296

297297
it('should show an error in console log when using default onError and the Grid Option flag "enableCellNavigation" is not enabled', () => {
298-
const consoleSpy = vi.spyOn(global.console, 'log').mockReturnValue();
298+
const consoleSpy = vi.spyOn(console, 'log').mockReturnValue();
299299
const newGridOptions = { ...gridOptionsMock, enableCellNavigation: false };
300300
vi.spyOn(gridStub, 'getOptions').mockReturnValue(newGridOptions);
301301

packages/custom-tooltip-plugin/src/__tests__/slickCustomTooltip.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ describe('SlickCustomTooltip plugin', () => {
578578
});
579579

580580
it('should throw an error when trying to create an async tooltip without "asyncPostFormatter" defined', () => {
581-
const consoleSpy = vi.spyOn(global.console, 'error').mockReturnValue();
581+
const consoleSpy = vi.spyOn(console, 'error').mockReturnValue();
582582
const cellNode = document.createElement('div');
583583
cellNode.className = 'slick-cell l2 r2';
584584
const mockColumns = [{ id: 'firstName', field: 'firstName' }] as Column[];
@@ -638,7 +638,7 @@ describe('SlickCustomTooltip plugin', () => {
638638
vi.spyOn(gridStub, 'getCellNode').mockReturnValue(cellNode);
639639
vi.spyOn(gridStub, 'getColumns').mockReturnValue(mockColumns);
640640
vi.spyOn(dataviewStub, 'getItem').mockReturnValue({ firstName: 'John', lastName: 'Doe' });
641-
const consoleSpy = vi.spyOn(global.console, 'error').mockReturnValue();
641+
const consoleSpy = vi.spyOn(console, 'error').mockReturnValue();
642642

643643
plugin.init(gridStub, container);
644644
plugin.addRxJsResource(rxjsResourceStub);

packages/row-detail-view-plugin/src/slickRowDetailView.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ describe('SlickRowDetailView plugin', () => {
348348
});
349349

350350
it('should trigger "onAsyncResponse" but throw an error when there is no item provided', () => {
351-
const consoleSpy = vi.spyOn(global.console, 'error').mockReturnValue();
351+
const consoleSpy = vi.spyOn(console, 'error').mockReturnValue();
352352
const updateItemSpy = vi.spyOn(dataviewStub, 'updateItem');
353353
const postViewMock = (item: any) => `<span>Post ${item.id}</span>`;
354354
vi.spyOn(gridStub, 'getOptions').mockReturnValue({ ...gridOptionsMock, rowDetailView: { postTemplate: postViewMock } as any });

0 commit comments

Comments
 (0)